dnd-name-generator/language/languages/common/base.py
2023-11-24 08:48:03 -05:00

159 lines
2.8 KiB
Python

from language import types
from .rules import rules
vowels = types.WeightedSet(
("a", 1.0),
("e", 1.0),
("i", 1.0),
("o", 0.8),
("u", 0.7),
("y", 0.01),
)
consonants = types.WeightedSet(
("b", 0.5),
("c", 0.5),
("d", 0.5),
("f", 0.3),
("g", 0.3),
("h", 0.5),
("j", 0.2),
("k", 0.3),
("l", 1.0),
("m", 0.5),
("n", 1.0),
("p", 0.5),
("q", 0.05),
("r", 1.0),
("s", 1.0),
("t", 1.0),
("v", 0.3),
("w", 0.2),
("x", 0.2),
("y", 0.01),
("z", 0.1),
("bs", 0.3),
("ct", 0.4),
("ch", 0.4),
("ck", 0.4),
("dd", 0.2),
("ff", 0.2),
("gh", 0.3),
("gs", 0.2),
("ms", 0.4),
("ns", 0.4),
("ps", 0.3),
("qu", 0.2),
("rb", 0.1),
("rd", 0.2),
("rf", 0.1),
("rk", 0.2),
("rl", 0.2),
("rm", 0.2),
("rn", 0.2),
("rp", 0.1),
("rs", 0.75),
("rt", 0.75),
("ry", 0.5),
("sh", 1.0),
("sk", 0.5),
("ss", 0.75),
("st", 1.0),
("sy", 0.5),
("th", 1.0),
("tk", 0.5),
("ts", 1.0),
("tt", 1.0),
("ty", 1.0),
("ws", 0.5),
)
prefixes = types.equal_weights(["ex", "re", "pre", "de", "pro", "anti"], 0.05)
suffixes = types.equal_weights(
[
"ad",
"ed",
"id",
"od",
"ud",
"af",
"ef",
"if",
"of",
"uf",
"ah",
"eh",
"ih",
"oh",
"uh",
"al",
"el",
"il",
"ol",
"ul",
"am",
"em",
"im",
"om",
"um",
"an",
"en",
"in",
"on",
"un",
"ar",
"er",
"ir",
"or",
"ur",
"as",
"es",
"is",
"os",
"us",
"at",
"et",
"it",
"ot",
"ut",
"ax",
"ex",
"ix",
"ox",
"ux",
"ay",
"ey",
"iy",
"oy",
"uy",
"az",
"ez",
"iz",
"oz",
"uz",
"ing",
],
0.05,
)
Language = types.Language(
name="common",
vowels=vowels,
consonants=consonants,
prefixes=prefixes,
suffixes=suffixes,
syllables=types.SyllableSet(
(types.Syllable(template="vowel|consonant"), 0.01),
(types.Syllable(template="vowel|consonant") * 2, 0.2),
(types.Syllable(template="vowel|consonant") * 3, 0.4),
(types.Syllable(template="vowel|consonant") * 3, 0.5),
(types.Syllable(template="vowel|consonant") * 4, 1.0),
(types.Syllable(template="vowel|consonant") * 5, 0.3),
(types.Syllable(template="vowel|consonant") * 6, 0.2),
(types.Syllable(template="vowel|consonant") * 7, 0.05),
),
rules=rules,
minimum_grapheme_count=1,
)