Skip to content

Commit

Permalink
Add new patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrnr committed Mar 1, 2023
1 parent 852eedb commit 94ba04b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
8 changes: 8 additions & 0 deletions regenpfeifer/assets/patterns/right_patterns.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"tt": "t",
"ren": "[-RPB]",
"lsch": "[-RBL]",
"lch": "[-FPL]",
"ldet": "[-LTD]",
"ltst": "[-FLT]",
"lbst": "[-FLT]",
"ndst": "[-FPBT]",
"ngst": "[-FPBGT]",
"fen": "[-FPB]",
Expand All @@ -20,13 +23,17 @@
"mpf": "[-FPL]",
"nst": "[-FPBT]",
"tzt": "[-FT]",
"len": "[-PBL]",
"nem": "[-PBL]",
"men": "[-PBL]",
"ln": "[-PBL]",
"sch": "[-RB]",
"nch": "[-FRPB]",
"rch": "[-FRPB]",
"ser": "[-FR]",
"ßer": "[-FR]",
"end": "[-PBD]",
"rfst": "[-FRT]*",
"rst": "[-FRT]",
"bst": "[-FBT]",
"der": "[-RD]",
Expand All @@ -43,6 +50,7 @@
"rf": "[-FR]",
"nf": "[-FPB]",
"nk": "[-PBG]",
"gen": "[-PBG]",
"ch": "[-FP]",
"tz": "[-TS]",
"dt": "[-TD]",
Expand Down
2 changes: 2 additions & 0 deletions regenpfeifer/assets/patterns/vowel_patterns.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"[e|eu]": "[e|OEU]",
"[e|i]e": "[e|AOEU]",
"[e|i]h": "[e|AOEU]",
"[e|e]e": "[e|AOE]",
"[e|ö]": "[e|OE]",
"[e|ä]": "[e|AE]",
"[e|ü]": "[e|OU]",
"[e|a]": "[e|A]",
"[e|o]o": "[e|AO]",
"[e|o]": "[e|O]",
"[e|e]": "[e|E]",
"[e|u]": "[e|U]",
Expand Down
3 changes: 2 additions & 1 deletion test/test_stroke_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ def test_easy_words(self):
self.run_test("Beute", "sg", ["PWOEU/TE"])
self.run_test("Beutezug", "sg", ["PWOEU/TE/ZUG"])
self.run_test("unglück", "sg", ["UPB/TKPWHROUBG"])
self.run_test("sollend", "part", ["SOL/HREPBD"])
self.run_test("sollend", "part", ["SOPBLD", "SOL/HREPBD"])
self.run_test("Aufgaben", "pl", ["AUF/TKPWA/PWEPB"])
self.run_test("seinen", "prp$", ["SAEU/TPHEPB"])
self.run_test("Boot", "nn", ["PWAOT"])

def run_test(self, word, word_type, expected):
self.assertEqual(expected, self.stroke_generator.generate(word, word_type))
Expand Down
4 changes: 3 additions & 1 deletion test/test_word_emphasizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ def setUp(self):
self.word_emphasizer = WordEmphasizer()

def test_simple_words(self):
print()
self.run_test("wegen", "inf", "w[e|e]gen")
self.run_test("beim", "in", "b[e|ei]m")
self.run_test("erst", "rb", "[e|e]rst")
self.run_test("bend", "other", "b[e|e]nd")
self.run_test("un", "other", "[e|u]n")
self.run_test("glück", "other", "gl[e|ü]ck")

def test_double_vowel_words(self):
self.run_test("Boot", "other", "B[e|o]ot")

def test_compound_words(self):
self.run_test("Baustellenschild", "other", "B[e|au]stellenschild")

Expand Down
12 changes: 8 additions & 4 deletions test/test_word_syllable_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ def test_split(self):
self.run_test("erklären", ["er", "klä", "ren"])
self.run_test("gesprochen", ["ge", "spro", "chen"])
self.run_test("Million", ["Mil", "li", "on"])
# self.run_test('Millionen', ['Mil', 'li', 'o', 'nen'])
# self.run_test('Januar', ['Ja', 'nu', 'ar'])
# self.run_test('Januare', ['Ja', 'nu', 'a', 're'])
self.run_test("Millionen", ["Mil", "lio", "nen"])
self.run_test("Ionen", ["Io", "nen"])
self.run_test("Arbeit", ["Ar", "beit"])
self.run_test("seiet", ["sei", "et"])
Expand All @@ -46,10 +44,16 @@ def test_split(self):
self.run_test("Hoffnung", ["Hoff", "nung"])
self.run_test("Liste", ["Lis", "te"])
self.run_test("neue", ["neu", "e"])
# self.run_test('andere', ['an', 'de', 're'])
self.run_test("altes", ["al", "tes"])
self.run_test("müssten", ["müss", "ten"])
self.run_test("seinen", ["sei", "nen"])
# currently failing:
# self.run_test("gestanden", ["ge", "stan","den"])
# self.run_test('gestellt', ['ge', 'stellt'])
# self.run_test('andere', ['an', 'de', 're'])
# self.run_test('Januar', ['Ja', 'nu', 'ar'])
# self.run_test('Januare', ['Ja', 'nu', 'a', 're'])
# self.run_test('bereits', ['be', 'reits'])

def run_test(self, word, expected):
self.assertEqual(expected, self.syllable_splitter.split(word))
Expand Down

0 comments on commit 94ba04b

Please sign in to comment.