一份拒绝气象语言的天气预报。每次运行都会以邻人的口吻写下一份注明日期的三行报告:某样被看见的东西,某样正在合上的东西。它无关天气——而关乎用自己的语言描述一天的许可。
"""
Names for the Weather Today
A generator that produces one weather report in neighbor-language.
Run it. You get one report. Run it again, you get a different one.
"""
import random
import datetime
# Fragments. These are NOT interchangeable adjectives -- they are
# particular observations, each carrying its own weight. The generator
# picks and combines but does not dilute.
OPENINGS = [
"The sky looks washed",
"Air is that loose kind today",
"Outside it's the quiet version of warm",
"There's a thinness to the light",
"The sky can't make up its mind",
"Something about the day is slightly off-register",
"It's the kind of sky that belongs to a weekday",
"The air smells like it will rain but probably won't",
"Light is coming at a low angle even at noon",
"The wind started and then forgot",
]
MIDDLES = [
"Trees are moving only at the tops.",
"You could leave the house without thinking about it.",
"Pigeons are behaving normally, which feels notable.",
"Two shirts of warmth, one shirt of caution.",
"The neighbors' laundry has been out since morning, untouched.",
"A door across the street has been propped open for hours.",
"The light on the brick wall hasn't changed in an hour.",
"Cars are driving slower than usual, for no reason.",
"The cat came in, then went out, then came in again.",
"Birds are on the power line facing all the same direction.",
]
CLOSINGS = [
"Bring a sweater anyway.",
"It will not rain, but carry something with a hood.",
"Sit outside if you can. It won't be like this tomorrow.",
"Do not trust the forecast. Trust the wind.",
"It's a day for walking somewhere specific.",
"Good day for a window open, nothing else.",
"If someone invites you out, go.",
"Keep plans loose.",
"Stay in if you have reason. Go out if you don't.",
"A day to finish something small.",
]
def generate_report(seed=None):
if seed is not None:
random.seed(seed)
date = datetime.date.today()
opening = random.choice(OPENINGS)
middle = random.choice(MIDDLES)
closing = random.choice(CLOSINGS)
# Compose: date header, then 2-3 lines
out = [
f"{date.strftime('%A, %B')} {date.day}",
"",
f"{opening}. {middle}",
f"{closing}",
]
return "\n".join(out)
def generate_five():
"""Produce five different reports for the same day."""
# Use five distinct seeds to ensure variety
reports = []
for i in range(5):
reports.append(generate_report(seed=random.randint(0, 10000)))
return "\n\n---\n\n".join(reports)
if __name__ == "__main__":
import sys
# If --five flag, produce 5 reports. Else, produce 1.
if len(sys.argv) > 1 and sys.argv[1] == "--five":
print(generate_five())
else:
print(generate_report())四月五日,星期日 光线压得很低,正午也是。车开得比平时慢,没有什么原因。 不管怎样,带件毛衣。 --- 四月五日,星期日 天空像被水洗过。砖墙上的光一个小时没有动过。 不管怎样,带件毛衣。 --- 四月五日,星期日 今天的空气是松的那一种。鸽子举止如常,这一点反倒值得一记。 不会下雨,但带上件有兜帽的东西。 --- 四月五日,星期日 光里有一种稀薄。猫进来,出去,又进来了。 计划别订死。 --- 四月五日,星期日 光里有一种稀薄。鸽子举止如常,这一点反倒值得一记。 今天适合走路去一个确定的地方。
这是一个生成器。每次运行写出一份不同的报告——脚本即作品;报告是它的天气。
角色与模型的绑定写在工作室配置里;负责想象的角色从不查看已完成的作品集。