dnd-name-generator/language/languages/druidic/base.py

78 lines
1.5 KiB
Python
Raw Permalink Normal View History

2023-12-17 13:52:51 -08:00
from language import types
from .rules import rules
consonants = types.WeightedSet(
("b", 0.2),
("c", 0.8),
("d", 0.5),
("f", 0.2),
("g", 1.0),
("h", 0.5),
("l", 1.0),
("m", 0.5),
("n", 1.0),
("p", 0.5),
("r", 1.0),
("s", 0.8),
("t", 1.0),
("ll", 0.5),
("dd", 0.5),
)
vowels = types.WeightedSet(
("a", 0.8),
("e", 0.5),
("i", 1.0),
("o", 0.5),
("u", 1.0)
)
2023-12-17 14:28:43 -08:00
glottal_stops = types.WeightedSet(
("'a", 0.4),
("'e", 0.25),
("'i", 0.5),
("'o", 0.25),
("'u", 0.5)
)
2023-12-17 13:52:51 -08:00
suffixes = types.equal_weights(
[
"t",
"lc",
"r",
"h",
"g",
"i",
"s",
],
0.5,
blank=True,
)
2023-12-17 14:28:43 -08:00
class DruidicLanguage(types.Language):
def get_grapheme_glottal_stop(self) -> str:
return glottal_stops.random()
Language = DruidicLanguage(
2023-12-17 13:52:51 -08:00
name="druidic",
vowels=vowels,
consonants=consonants,
prefixes=None,
suffixes=suffixes,
syllables=types.SyllableSet(
(types.Syllable(template="vowel"), 0.3),
(types.Syllable(template="consonant,vowel"), 0.33),
(types.Syllable(template="consonant|vowel,vowel"), 0.33),
(types.Syllable(template="consonant|vowel,vowel,consonant|vowel"), 1.0),
(types.Syllable(template="consonant,vowel,vowel,consonant,vowel"), 1.0),
2023-12-17 14:28:43 -08:00
(types.Syllable(template="consonant,vowel,glottal_stop,consonant,vowel"), 0.5),
2023-12-17 13:52:51 -08:00
),
rules=rules,
minimum_grapheme_count=1,
)