feat: add support for natural vowell initial form in 'ana' pronoun and corresponding test
Browse files- app/grammar.py +3 -1
- tests/test_scoring.py +11 -0
app/grammar.py
CHANGED
|
@@ -15,7 +15,9 @@ import itertools
|
|
| 15 |
# subject pronouns, in the order used by every verb table below
|
| 16 |
# key Hebrew course tr (arabic, ipa) readings, main one first
|
| 17 |
PRONOUNS = [
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
("inte", "אתה", "אִנְתֵ", [("انت", "ʔ i n t e"), ("انت", "ʔ i n t a")]),
|
| 20 |
("inti", "את", "אִנְתִי", [("انتي", "ʔ i n t i")]),
|
| 21 |
("huwwe", "הוא", "הוּّ", [("هوّ", "h u w w e"), ("هو", "h uː")]),
|
|
|
|
| 15 |
# subject pronouns, in the order used by every verb table below
|
| 16 |
# key Hebrew course tr (arabic, ipa) readings, main one first
|
| 17 |
PRONOUNS = [
|
| 18 |
+
# The initial glottal stop is routinely absent in natural Palestinian speech. Keep both alignments so a weak
|
| 19 |
+
# breathy onset is not forced against ʔ and reported as h, while the written and displayed form stays identical.
|
| 20 |
+
("ana", "אני", "אַנַא", [("انا", "ʔ a n a"), ("انا", "a n a")]),
|
| 21 |
("inte", "אתה", "אִנְתֵ", [("انت", "ʔ i n t e"), ("انت", "ʔ i n t a")]),
|
| 22 |
("inti", "את", "אִנְתִי", [("انتي", "ʔ i n t i")]),
|
| 23 |
("huwwe", "הוא", "הוּّ", [("هوّ", "h u w w e"), ("هو", "h uː")]),
|
tests/test_scoring.py
CHANGED
|
@@ -344,6 +344,17 @@ def test_dropped_glottal_stop_is_not_an_error():
|
|
| 344 |
assert not r["tips"] and not any("עצירה" in i["sound"] for i in r["issues"])
|
| 345 |
|
| 346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
def test_tts_endpoint_serves_phrase_audio_and_503_without_key():
|
| 348 |
from fastapi.testclient import TestClient
|
| 349 |
|
|
|
|
| 344 |
assert not r["tips"] and not any("עצירה" in i["sound"] for i in r["issues"])
|
| 345 |
|
| 346 |
|
| 347 |
+
def test_ana_explicitly_accepts_the_natural_vowell_initial_form():
|
| 348 |
+
from app.grammar import PRONOUNS
|
| 349 |
+
|
| 350 |
+
ana = next(p for p in PRONOUNS if p[0] == "ana")
|
| 351 |
+
assert ("انا", "a n a") in ana[3]
|
| 352 |
+
phrase = {"variants": ana[3]}
|
| 353 |
+
r = scorer_for(emissions(["a", "n", "a"])).score(None, phrase)
|
| 354 |
+
assert r["variant"]["ipa"] == "a n a" and r["score"] >= 90
|
| 355 |
+
assert not r["tips"] and not r["issues"]
|
| 356 |
+
|
| 357 |
+
|
| 358 |
def test_tts_endpoint_serves_phrase_audio_and_503_without_key():
|
| 359 |
from fastapi.testclient import TestClient
|
| 360 |
|