Модуль:SimpleGenerator: различия между версиями
Материал из Поле цифровой дидактики
Patarakin (обсуждение | вклад) Новая страница: «local p = {} function p.generateText(frame) local sentences = { "the sun was shining brightly.", "a gentle breeze was blowing.", "the birds were singing melodiously.", "the streets were unusually quiet.", "a cat was lazily lying in the shade.", "children were playing in the park.", "someone was humming a tune nearby.", "clouds started gathering on the horizon.", "a sudden downpour s...» |
Patarakin (обсуждение | вклад) Нет описания правки |
||
| Строка 10: | Строка 10: | ||
"children were playing in the park.", | "children were playing in the park.", | ||
"someone was humming a tune nearby.", | "someone was humming a tune nearby.", | ||
"на площадке медиавики была презентация" , | |||
"clouds started gathering on the horizon.", | "clouds started gathering on the horizon.", | ||
"a sudden downpour surprised everyone.", | "a sudden downpour surprised everyone.", | ||
Версия от 09:59, 26 февраля 2026
Краткое описание
Модуль SimpleGenerator генерирует короткий псевдослучайный текст из двух заранее заданных предложений.
Каждый вызов выбирает две фразы из внутреннего списка и склеивает их в мини‑историю, начинающуюся словами One day....
Модуль можно использовать:
- как простой «шумовой» генератор текста для примеров;
- как источник вариативных фраз в учебных заданиях по гипертексту и генеративным текстам;
- для демонстрации принципов случайности и композиции в цифровой литературе.
Использование
Базовый вызов:
{{#invoke:SimpleGenerator|generateText}}
Каждый вызов вернёт чуть разный текст, составленный из двух случайных предложений из внутреннего списка.
local p = {}
function p.generateText(frame)
local sentences = {
"the sun was shining brightly.",
"a gentle breeze was blowing.",
"the birds were singing melodiously.",
"the streets were unusually quiet.",
"a cat was lazily lying in the shade.",
"children were playing in the park.",
"someone was humming a tune nearby.",
"на площадке медиавики была презентация" ,
"clouds started gathering on the horizon.",
"a sudden downpour surprised everyone.",
"the air smelled of fresh rain."
}
math.randomseed(os.time())
local sentence1 = sentences[math.random(#sentences)]
local sentence2 = sentences[math.random(#sentences)]
return "One day... " .. sentence1 .. " " .. sentence2
end
return p
