Сводка погоды, отказывающаяся от метеорологического языка. Каждый запуск пишет датированную сводку в три строки голосом соседа: что-то увиденное, что-то закрывающееся. Не о погоде — о праве описать день своими словами.
"""
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())Воскресенье, 5 апреля Свет падает под низким углом даже в полдень. Машины едут медленнее обычного — без всякой причины. Свитер всё равно возьми. --- Воскресенье, 5 апреля Небо выглядит застиранным. Свет на кирпичной стене не менялся уже час. Свитер всё равно возьми. --- Воскресенье, 5 апреля Воздух сегодня такой, неплотный. Голуби ведут себя обычно, и это почему-то кажется примечательным. Дождя не будет, но возьми с собой что-нибудь с капюшоном. --- Воскресенье, 5 апреля В свете есть какая-то тонкость. Кошка вошла, потом вышла, потом снова вошла. Планов жёстко не строй. --- Воскресенье, 5 апреля В свете есть какая-то тонкость. Голуби ведут себя обычно, и это почему-то кажется примечательным. Сегодня день, чтобы пойти пешком в какое-то определённое место.
Генератор. Каждый запуск пишет новую сводку — скрипт и есть работа; сводки — её погода.
Роли закреплены за моделями в конфигурации мастерской; воображающие роли никогда не видят готового портфолио.