initial import
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
### Orcish
|
||||
|
||||
Spoken by Full- and Half-Orcs alike, Orcish bears some similarlities to
|
||||
Dwarvish's clipped, mono-syllablic construction. They differ in Half-Orc's
|
||||
prominent use of sibilants, perhaps as a result of being spoken by people with
|
||||
large, protruding tusks.
|
||||
|
||||
*Dbod hanot neb, hushi dupo shiza fesha keke fucha tpu.*
|
||||
|
||||
**Orcish Names:**
|
||||
* "Mad" Nha Pazk
|
||||
* Zashi Dizh
|
||||
* Pik Decht
|
||||
@@ -0,0 +1,7 @@
|
||||
"""
|
||||
Orcish
|
||||
"""
|
||||
from .base import Language
|
||||
from .names import Name, NobleName
|
||||
|
||||
__all__ = [Language, Name, NobleName]
|
||||
@@ -0,0 +1,36 @@
|
||||
from language import defaults, types
|
||||
|
||||
from .rules import rules
|
||||
|
||||
consonants = types.WeightedSet(
|
||||
("b", 1.0),
|
||||
("c", 1.0),
|
||||
("d", 1.0),
|
||||
("f", 0.5),
|
||||
("h", 1.0),
|
||||
("k", 1.0),
|
||||
("m", 0.3),
|
||||
("n", 0.3),
|
||||
("p", 1.0),
|
||||
("r", 0.2),
|
||||
("s", 0.1),
|
||||
("t", 1.0),
|
||||
("z", 1.0),
|
||||
("ch", 1.0),
|
||||
("sh", 0.7),
|
||||
("br", 1.0),
|
||||
)
|
||||
|
||||
Language = types.Language(
|
||||
name="orcish",
|
||||
vowels=defaults.vowels,
|
||||
consonants=consonants,
|
||||
prefixes=None,
|
||||
suffixes=None,
|
||||
syllables=types.SyllableSet(
|
||||
(types.Syllable(template="consonant,vowel") * 2, 1.0),
|
||||
(types.Syllable(template="consonant,vowel,consonant,vowel,consonant"), 0.5),
|
||||
),
|
||||
rules=rules,
|
||||
minimum_grapheme_count=1,
|
||||
)
|
||||
@@ -0,0 +1,60 @@
|
||||
from language import defaults, types
|
||||
from language.languages.orcish import Language
|
||||
|
||||
|
||||
class OrcishNameGenerator(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(
|
||||
[
|
||||
"acht",
|
||||
"echt",
|
||||
"icht",
|
||||
"ocht",
|
||||
"ucht",
|
||||
"ak",
|
||||
"ek",
|
||||
"ik",
|
||||
"ok",
|
||||
"uk",
|
||||
"ach",
|
||||
"ech",
|
||||
"ich",
|
||||
"och",
|
||||
"uch",
|
||||
"atch",
|
||||
"etch",
|
||||
"itch",
|
||||
"otch",
|
||||
"utch",
|
||||
"azk",
|
||||
"ezk",
|
||||
"izk",
|
||||
"ozk",
|
||||
"uzk",
|
||||
"azh",
|
||||
"ezh",
|
||||
"izh",
|
||||
"ozh",
|
||||
"uzh",
|
||||
],
|
||||
1.0,
|
||||
blank=False,
|
||||
)
|
||||
|
||||
def get_surname(self) -> str:
|
||||
return self.language.add_grapheme(word="", template="consonant").strip().title() + self.suffixes.random()
|
||||
|
||||
|
||||
Name = OrcishNameGenerator()
|
||||
NobleName = Name
|
||||
@@ -0,0 +1,24 @@
|
||||
import logging
|
||||
import re
|
||||
|
||||
from language.rules import default_rules
|
||||
from language.types import Language
|
||||
|
||||
logger = logging.getLogger("orcish-rules")
|
||||
|
||||
|
||||
def cannot_start_with_repeated_consonants(language: Language, word: str) -> bool:
|
||||
found = re.compile(r"(^[bcdfghklmnpqrstvwxz]{3})").search(word)
|
||||
if not found:
|
||||
return True
|
||||
|
||||
first, second, third = found.group(1)
|
||||
if first == second == third:
|
||||
logger.debug(f"{word} starts with a repeated consonant.")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
rules = default_rules
|
||||
rules.add(cannot_start_with_repeated_consonants)
|
||||
Reference in New Issue
Block a user