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
+14
View File
@@ -0,0 +1,14 @@
### Dwarvish
Dwarvish words are short, sharp, and to the point. Much like the Dwarves
themselves. This is "Low Dwarvish"; an ancient form of High Dwarvish still
exists in some regions, notably the Dewa Q'Asos area of southern Vosh, but it
is considered "dead" by most scholars and is reserved for arcane legal
contracts (and those signifying a high social status).
*Dowêchâ khâ, natu phe tu, futê dêdachî pê she wu?*
**Dwarvish Names:**
* "Black" Yzh Se
* Ka Shidothir
* Zhâ Syzhon
+7
View File
@@ -0,0 +1,7 @@
"""
Dwarvish
"""
from .base import Language
from .names import Name, NobleName
__all__ = [Language, Name, NobleName]
+54
View File
@@ -0,0 +1,54 @@
from language import types
from .rules import rules
vowels = types.WeightedSet(
("a", 1.0),
("e", 1.0),
("i", 0.3),
("o", 0.8),
("u", 0.7),
("y", 0.3),
("j", 0.05),
("î", 0.3),
("ê", 1.0),
("â", 1.0),
("û", 1.0),
)
consonants = types.WeightedSet(
("b", 0.3),
("c", 0.5),
("d", 1.0),
("f", 0.5),
("k", 1.0),
("l", 0.3),
("m", 0.3),
("n", 0.3),
("p", 1.0),
("s", 1.0),
("t", 1.0),
("v", 0.5),
("w", 0.5),
("y", 0.3),
("ph", 1.0),
("th", 1.0),
("ch", 1.0),
("kh", 1.0),
("zh", 1.0),
("sh", 1.0),
)
Language = types.Language(
name="dwarvish",
vowels=vowels,
consonants=consonants,
prefixes=None,
suffixes=None,
syllables=types.SyllableSet(
(types.Syllable(template="consonant,vowel|consonant") * 1, 1.0),
(types.Syllable(template="consonant,vowel|consonant") * 2, 0.5),
(types.Syllable(template="consonant,vowel|consonant") * 3, 0.2),
),
rules=rules,
minimum_grapheme_count=1,
)
+25
View File
@@ -0,0 +1,25 @@
from language import defaults, types
from language.languages.dwarvish import Language
class DwarvishNameGenerator(types.NameGenerator):
def __init__(self):
super().__init__(
language=Language,
templates=types.NameSet(
# (types.NameTemplate("adjective,name,nickname,surname"), 1.0),
(types.NameTemplate("adjective,name,surname"), 1.0),
),
affixes=None,
adjectives=defaults.adjectives,
titles=defaults.titles,
)
self.language.minimum_grapheme_count = 2
self.suffixes = types.equal_weights(["son", "sson", "zhon", "dottir", "dothir", "dottyr"], 1.0)
def get_surname(self) -> str:
return super().get_surname() + self.suffixes.random()
Name = DwarvishNameGenerator()
NobleName = Name
+24
View File
@@ -0,0 +1,24 @@
import logging
import re
from language.rules import default_rules
from language.types import Language
logger = logging.getLogger("dwarvish-rules")
def cannot_start_with_repeated_consonants(language: Language, word: str) -> bool:
found = re.compile(r"(^[bcdfghklmnpqrstvwxz]{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 True
rules = default_rules
rules.add(cannot_start_with_repeated_consonants)