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
+18
View File
@@ -0,0 +1,18 @@
### Undercommon
The language of the Drow is the defacto language of the Underdark, and is
spoken by most peoples there. Like the Drow themselves, Undercommon diverged
from an Elvish dialect in ancient times. The two still bear some resemblance,
notably in the construction of names.
*Okvösaa licopod lohiwia uüyötüe uywubit uegäsit uäpisoa, caquyee redoxöd, mraomoa.*
**Undercommon Names:**
* Tfubam Umaiuhüen
* Nanosd Aneedaöbaas
* Rerwus Amzuremolr
**Noble Undercommon (Drow) Names:**
* Uopiyie Alzejakäurn
* Opyäulol Elchöläss
* Iqyäuwed Anlcoduir
@@ -0,0 +1,7 @@
"""
Undercommon
"""
from .base import Language
from .names import Name, NobleName
__all__ = [Language, Name, NobleName]
+21
View File
@@ -0,0 +1,21 @@
from language import defaults, types
from .rules import rules
vowels = defaults.vowels + types.equal_weights(["ä", "ö", "ü", "äu"], 0.5, blank=False)
prefixes = defaults.vowels + types.equal_weights(["c", "g", "l", "m", "n", "r", "s", "t", "v", "z"], 1.0, blank=False)
suffixes = types.equal_weights(["a", "e", "i", "t", "s", "m", "n", "l", "r", "d", "a", "th"], 1.0, blank=False)
Language = types.Language(
name="undercommon",
vowels=vowels,
consonants=defaults.consonants,
prefixes=prefixes,
suffixes=suffixes,
syllables=types.SyllableSet(
(types.Syllable(template="vowel,consonant,vowel") * 2, 0.15),
(types.Syllable(template="consonant|vowel,consonant,vowel,consonant,vowel"), 1.0),
),
rules=rules,
minimum_grapheme_count=2,
)
+37
View File
@@ -0,0 +1,37 @@
import random
from language import defaults, types
from language.languages.undercommon import Language
PlaceName = types.NameGenerator(
language=Language,
syllables=Language.syllables,
templates=types.NameSet(
(types.NameTemplate("affix,name"), 1.0),
),
affixes=types.WeightedSet(("el", 1.0)),
adjectives=defaults.adjectives,
suffixes=Language.suffixes,
)
class DrowName(types.NameGenerator):
def __init__(self):
super().__init__(
language=Language,
syllables=Language.syllables,
templates=types.NameSet(
(types.NameTemplate("name,surname"), 1.0),
),
)
self.language.minimum_grapheme_count = 2
self.place_generator = PlaceName
self.affixes = types.equal_weights(["am", "an", "al", "um"], weight=1.0, blank=False)
def get_surname(self) -> str:
name = self.place_generator.name()[0]["name"][0]
return (self.affixes.random() + name + random.choice(["th", "s", "r", "n"])).title()
Name = DrowName()
NobleName = Name
+88
View File
@@ -0,0 +1,88 @@
import logging
import re
from language.rules import default_rules
from language.types import Language
logger = logging.getLogger()
valid_consonant_sequences = [
"cc",
"ht",
"kd",
"kl",
"km",
"kp",
"kt",
"kv",
"kw",
"ky",
"lc",
"ld",
"lf",
"ll",
"lm",
"lp",
"lt",
"lv",
"lw",
"ly",
"mb",
"mm",
"mp",
"my",
"nc",
"nd",
"ng",
"nn",
"nt",
"nw",
"ny",
"ps",
"pt",
"rc",
"rd",
"rm",
"rn",
"rp",
"rr",
"rs",
"rt",
"rw",
"ry",
"sc",
"ss",
"ts",
"tt",
"th",
"tw",
"ty",
]
def valid_sequences(language: Language, word: str) -> bool:
found = re.compile(r"([bcdfghjklmnpqrstvwxz]{2})").findall(word)
if not found:
return True
invalid = [seq for seq in found if seq not in valid_consonant_sequences]
if invalid:
logger.debug(f"{word} contains invalid consonant sequences: {invalid}")
return False
return True
def too_many_vowels(language: Language, word: str) -> bool:
found = re.compile(r"[" + "".join(language.vowels.members) + r"]{3}").findall(word)
if found == []:
return True
logger.debug(f"{word} has too many contiguous vowels: {found}")
return False
rules = default_rules.union(
{
valid_sequences,
too_many_vowels,
}
)