initial import

This commit is contained in:
evilchili
2023-11-24 08:48:03 -05:00
commit 45f4d6e401
66 changed files with 3601 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
### Common
Common is a complicated pidgin of influences with multiple regional dialects. Written Common is the language of
traders, and can be relied upon to be understood by most peoples to a greater or lesser degree.
*Proitsiiiy be itkif eesof detytaen. Ojaot tyskuaz apsoo nirtoet prenao.*
**Common Names:**
* Rubi Ca Momaman
* "Quiet" Gushi Murk Lirpusome
* Fewse Kerloborg
**Noble Common Names:**
* Lord Pasti Quusi Maghiheim
* Lady Gotki Lane Lopileigh III
* Dame Cu Lehaberry IX
+7
View File
@@ -0,0 +1,7 @@
"""
Common
"""
from .base import Language
from .names import Name, NobleName
__all__ = [Language, Name, NobleName]
+158
View File
@@ -0,0 +1,158 @@
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,
)
+82
View File
@@ -0,0 +1,82 @@
from language import defaults, types
from language.languages.common import Language
suffixes = types.equal_weights(
[
"berg",
"borg",
"borough",
"bury",
"berry",
"by",
"ford",
"gard",
"grave",
"grove",
"gren",
"hardt",
"hart",
"heim",
"holm",
"land",
"leigh",
"ley",
"ly",
"lof",
"love",
"lund",
"man",
"mark",
"ness",
"olf",
"olph",
"quist",
"rop",
"rup",
"stad",
"stead",
"stein",
"strom",
"thal",
"thorpe",
"ton",
"vall",
"wich",
"win",
"some",
"smith",
"bridge",
"cope",
"town",
"er",
"don",
"den",
"dell",
"son",
]
)
Name = types.NameGenerator(
language=Language,
syllables=types.SyllableSet(
(types.Syllable(template="vowel|consonant"), 0.01),
(types.Syllable(template="consonant,vowel"), 0.2),
(types.Syllable(template="consonant,vowel") * 2, 1.0),
),
templates=types.NameSet(
(types.NameTemplate("adjective,title,name,surname,count"), 1.0),
(types.NameTemplate("title,name,name,surname,count"), 1.0),
(types.NameTemplate("title,name,name,surname,surname,count"), 1.0),
),
names=None,
surnames=None,
nicknames=None,
adjectives=defaults.adjectives,
titles=defaults.titles,
counts=defaults.counts,
suffixes=suffixes,
)
Name.language.prefixes = None
Name.language.suffixes = None
NobleName = Name
+115
View File
@@ -0,0 +1,115 @@
import logging
import re
from language.rules import default_rules
from language.types import Language
logger = logging.getLogger()
permitted_starting_clusters = [
"bh",
"bl",
"br",
"bw",
"by",
"ch",
"cl",
"cr",
"cw",
"cy",
"dh",
"dj",
"dr",
"dw",
"dy",
"fl",
"fn",
"fr",
"fw",
"fy",
"gh",
"gl",
"gn",
"gr",
"gw",
"gy",
"hy",
"jh",
"jy",
"kh",
"kl",
"kr",
"kw",
"ky",
"ll",
"ly",
"mw",
"my",
"ny",
"ph",
"pl",
"pn",
"pr",
"pw",
"py",
"rh",
"ry",
"sb",
"sc",
"sd",
"sf",
"sg",
"sh",
"sj",
"sk",
"sl",
"sm",
"sn",
"sp",
"sr",
"st",
"sv",
"sw",
"sy",
"th",
"tr",
"tw",
"ty",
"vy",
"wh",
"wr",
"wy",
"xh",
"xy",
"yh",
"zb",
"zc",
"zd",
"zh",
"zl",
"zm",
"zn",
"zr",
"zw",
"zy",
]
def cannot_start_with_two_consonants(language: Language, word: str) -> bool:
found = re.compile(r"(^[bcdfghjklmnpqrstvwxz]{2})").search(word)
if not found:
return True
first, second = found.group(1)
if first == second:
logger.debug(f"{word} starts with a repeated consonant.")
return False
return found in permitted_starting_clusters
rules = default_rules.union(
{
cannot_start_with_two_consonants,
}
)