Skip to content

Commit

Permalink
feat: allow panphon 0.21 where possible
Browse files Browse the repository at this point in the history
And make the unit test accept 0.21 and older versions.

Fixes #388
  • Loading branch information
joanise committed Sep 11, 2024
1 parent d48a7a9 commit 966a057
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
24 changes: 14 additions & 10 deletions g2p/tests/test_fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,20 @@ def test_mapping(self):
],
)
test_ipa = align_to_dummy_fallback(ipa_mapping, "out", quiet=True)
self.assertEqual(
test_ipa.rules,
[
Rule(rule_input="æ", rule_output="ɑ", match_pattern="æ"),
Rule(rule_input="ɐ", rule_output="ɑ", match_pattern="ɐ"),
Rule(rule_input="ɑ̃", rule_output="ɑ", match_pattern="ɑ̃"),
Rule(rule_input="β", rule_output="s", match_pattern="β"),
Rule(rule_input="ɡ", rule_output="t", match_pattern="ɡ"),
],
)
panphon_021_ref = [
Rule(rule_input="æ", rule_output="ɑ", match_pattern="æ"),
Rule(rule_input="ɐ", rule_output="i", match_pattern="ɐ"),
Rule(rule_input="ɑ̃", rule_output="ɑ", match_pattern="ɑ̃"),
Rule(rule_input="β", rule_output="s", match_pattern="β"),
Rule(rule_input="ɡ", rule_output="t", match_pattern="ɡ"),
]
panphon_020_ref = [
panphon_021_ref[0],
Rule(rule_input="ɐ", rule_output="ɑ", match_pattern="ɐ"),
*panphon_021_ref[2:],
]
if test_ipa.rules != panphon_021_ref:
self.assertEqual(test_ipa.rules, panphon_020_ref)


if __name__ == "__main__":
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ dependencies = [
"coloredlogs>=15.0.1",
"networkx>=2.6",
"openpyxl",
"panphon>=0.19,<0.21",
"panphon>=0.19",
"panphon<0.21; python_version<'3.9'",
"panphon<0.21; platform_system=='Windows'",
"pydantic>=2.4",
"pyyaml>=5.2",
"regex",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ openpyxl==3.1.2
# via hatch.envs.prod
packaging==24.0
# via gunicorn
panphon==0.20.0
panphon==0.21.2
# via hatch.envs.prod
pydantic==2.6.4
# via
Expand Down

0 comments on commit 966a057

Please sign in to comment.