kitten-text-processing 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kitten_text_processing-0.1.0/LICENSE +201 -0
- kitten_text_processing-0.1.0/LICENSE-SACREMOSES +21 -0
- kitten_text_processing-0.1.0/MANIFEST.in +4 -0
- kitten_text_processing-0.1.0/NOTICE +26 -0
- kitten_text_processing-0.1.0/PKG-INFO +132 -0
- kitten_text_processing-0.1.0/README.md +114 -0
- kitten_text_processing-0.1.0/kitten_text_processing/__init__.py +5 -0
- kitten_text_processing-0.1.0/kitten_text_processing/__main__.py +23 -0
- kitten_text_processing-0.1.0/kitten_text_processing/_detokenize.py +62 -0
- kitten_text_processing-0.1.0/kitten_text_processing/_fst.py +304 -0
- kitten_text_processing-0.1.0/kitten_text_processing/_ordering.py +126 -0
- kitten_text_processing-0.1.0/kitten_text_processing/_punctuation.py +112 -0
- kitten_text_processing-0.1.0/kitten_text_processing/_token_parser.py +193 -0
- kitten_text_processing-0.1.0/kitten_text_processing/_unicode_data.py +6 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ar/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ar/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ar/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/de/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/de/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/de/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/en/metadata.json +26 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/en/post.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/en/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/en/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/es/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/es/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/es/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/fr/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/fr/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/fr/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/hi/metadata.json +26 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/hi/post.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/hi/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/hi/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/hu/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/hu/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/hu/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/hy/metadata.json +24 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/hy/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/hy/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/it/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/it/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/it/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ja/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ja/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ja/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ko/metadata.json +24 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ko/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ko/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/pt/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/pt/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/pt/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ru/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ru/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/ru/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/rw/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/rw/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/rw/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/sv/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/sv/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/sv/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/vi/metadata.json +26 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/vi/post.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/vi/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/vi/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/zh/metadata.json +20 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/zh/tagger.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/data/zh/verbalizer.fst.gz +0 -0
- kitten_text_processing-0.1.0/kitten_text_processing/normalizer.py +114 -0
- kitten_text_processing-0.1.0/kitten_text_processing.egg-info/PKG-INFO +132 -0
- kitten_text_processing-0.1.0/kitten_text_processing.egg-info/SOURCES.txt +321 -0
- kitten_text_processing-0.1.0/kitten_text_processing.egg-info/dependency_links.txt +1 -0
- kitten_text_processing-0.1.0/kitten_text_processing.egg-info/entry_points.txt +2 -0
- kitten_text_processing-0.1.0/kitten_text_processing.egg-info/top_level.txt +1 -0
- kitten_text_processing-0.1.0/pyproject.toml +32 -0
- kitten_text_processing-0.1.0/setup.cfg +4 -0
- kitten_text_processing-0.1.0/tests/corpus/README.md +25 -0
- kitten_text_processing-0.1.0/tests/corpus/ar.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/ar.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/de.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/de.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/en.reference.json +944 -0
- kitten_text_processing-0.1.0/tests/corpus/en.txt +104 -0
- kitten_text_processing-0.1.0/tests/corpus/es.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/es.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/fr.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/fr.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/hi.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/hi.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/hu.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/hu.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/hy.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/hy.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/it.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/it.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/ja.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/ja.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/ko.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/ko.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/pt.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/pt.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/ru.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/ru.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/rw.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/rw.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/sv.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/sv.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/vi.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/vi.txt +56 -0
- kitten_text_processing-0.1.0/tests/corpus/zh.reference.json +512 -0
- kitten_text_processing-0.1.0/tests/corpus/zh.txt +56 -0
- kitten_text_processing-0.1.0/tests/extended/README.md +16 -0
- kitten_text_processing-0.1.0/tests/extended/ar.jsonl +1237 -0
- kitten_text_processing-0.1.0/tests/extended/de.jsonl +1433 -0
- kitten_text_processing-0.1.0/tests/extended/en.jsonl +1684 -0
- kitten_text_processing-0.1.0/tests/extended/es.jsonl +1683 -0
- kitten_text_processing-0.1.0/tests/extended/fr.jsonl +1236 -0
- kitten_text_processing-0.1.0/tests/extended/hi.jsonl +1796 -0
- kitten_text_processing-0.1.0/tests/extended/hu.jsonl +1321 -0
- kitten_text_processing-0.1.0/tests/extended/hy.jsonl +1252 -0
- kitten_text_processing-0.1.0/tests/extended/it.jsonl +1168 -0
- kitten_text_processing-0.1.0/tests/extended/ja.jsonl +1659 -0
- kitten_text_processing-0.1.0/tests/extended/ko.jsonl +1488 -0
- kitten_text_processing-0.1.0/tests/extended/manifest.json +370 -0
- kitten_text_processing-0.1.0/tests/extended/pt.jsonl +1478 -0
- kitten_text_processing-0.1.0/tests/extended/ru.jsonl +1310 -0
- kitten_text_processing-0.1.0/tests/extended/rw.jsonl +1218 -0
- kitten_text_processing-0.1.0/tests/extended/sv.jsonl +1373 -0
- kitten_text_processing-0.1.0/tests/extended/vi.jsonl +1591 -0
- kitten_text_processing-0.1.0/tests/extended/zh.jsonl +1484 -0
- kitten_text_processing-0.1.0/tests/regressions.json +578 -0
- kitten_text_processing-0.1.0/tests/test_api.py +78 -0
- kitten_text_processing-0.1.0/tests/test_corpus.py +44 -0
- kitten_text_processing-0.1.0/tests/test_decoder.py +65 -0
- kitten_text_processing-0.1.0/tests/test_extended.py +53 -0
- kitten_text_processing-0.1.0/tests/test_regressions.py +25 -0
- kitten_text_processing-0.1.0/tests/upstream/README.md +25 -0
- kitten_text_processing-0.1.0/tests/upstream/ar/test_cases_cardinal.txt +27 -0
- kitten_text_processing-0.1.0/tests/upstream/ar/test_cases_decimal.txt +30 -0
- kitten_text_processing-0.1.0/tests/upstream/ar/test_cases_fraction.txt +20 -0
- kitten_text_processing-0.1.0/tests/upstream/ar/test_cases_measure.txt +14 -0
- kitten_text_processing-0.1.0/tests/upstream/ar/test_cases_money.txt +27 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_cardinal.txt +50 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_date.txt +15 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_decimal.txt +10 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_electronic.txt +19 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_fraction.txt +34 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_measure.txt +29 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_money.txt +21 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_normalize_with_audio.txt +131 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_ordinal.txt +19 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_telephone.txt +4 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_time.txt +28 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_whitelist.txt +6 -0
- kitten_text_processing-0.1.0/tests/upstream/de/test_cases_word.txt +49 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_address.txt +11 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_cardinal.txt +18 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_date.txt +54 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_decimal.txt +12 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_electronic.txt +45 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_fraction.txt +16 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_math.txt +4 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_measure.txt +21 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_money.txt +71 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_normalize_with_audio.txt +182 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_ordinal.txt +27 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_punctuation.txt +63 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_punctuation_match_input.txt +13 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_range.txt +20 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_roman.txt +4 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_serial.txt +31 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_special_text.txt +10 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_telephone.txt +20 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_time.txt +21 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_whitelist.txt +7 -0
- kitten_text_processing-0.1.0/tests/upstream/en/test_cases_word.txt +39 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_cardinal.txt +69 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_date.txt +21 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_decimal.txt +24 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_electronic.txt +22 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_fraction.txt +75 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_measure.txt +32 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_money.txt +69 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_normalize_with_audio.txt +162 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_ordinal.txt +120 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_telephone.txt +15 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_time.txt +35 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_whitelist.txt +7 -0
- kitten_text_processing-0.1.0/tests/upstream/es/test_cases_word.txt +48 -0
- kitten_text_processing-0.1.0/tests/upstream/fr/test_cases_cardinal.txt +14 -0
- kitten_text_processing-0.1.0/tests/upstream/fr/test_cases_date.txt +13 -0
- kitten_text_processing-0.1.0/tests/upstream/fr/test_cases_decimal.txt +7 -0
- kitten_text_processing-0.1.0/tests/upstream/fr/test_cases_fraction.txt +12 -0
- kitten_text_processing-0.1.0/tests/upstream/fr/test_cases_ordinal.txt +15 -0
- kitten_text_processing-0.1.0/tests/upstream/fr/test_cases_whitelist.txt +7 -0
- kitten_text_processing-0.1.0/tests/upstream/fr/test_cases_word.txt +49 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_address.txt +55 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_cardinal.txt +150 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_date.txt +34 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_decimal.txt +20 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_electronic.txt +60 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_fraction.txt +23 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_measure.txt +73 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_money.txt +118 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_ordinal.txt +72 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_telephone.txt +25 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_time.txt +18 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_whitelist.txt +14 -0
- kitten_text_processing-0.1.0/tests/upstream/hi/test_cases_word.txt +16 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_cardinal.txt +69 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_date.txt +17 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_decimal.txt +6 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_electronic.txt +8 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_fraction.txt +4 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_measure.txt +6 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_money.txt +9 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_ordinal.txt +5 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_telephone.txt +9 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_time.txt +10 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_whitelist.txt +10 -0
- kitten_text_processing-0.1.0/tests/upstream/hu/test_cases_word.txt +52 -0
- kitten_text_processing-0.1.0/tests/upstream/hy/test_cases_cardinal.txt +12 -0
- kitten_text_processing-0.1.0/tests/upstream/hy/test_cases_decimal.txt +9 -0
- kitten_text_processing-0.1.0/tests/upstream/hy/test_cases_fraction.txt +10 -0
- kitten_text_processing-0.1.0/tests/upstream/hy/test_cases_measure.txt +9 -0
- kitten_text_processing-0.1.0/tests/upstream/hy/test_cases_money.txt +10 -0
- kitten_text_processing-0.1.0/tests/upstream/hy/test_cases_ordinal.txt +11 -0
- kitten_text_processing-0.1.0/tests/upstream/hy/test_cases_time.txt +9 -0
- kitten_text_processing-0.1.0/tests/upstream/hy/test_cases_whitelist.txt +14 -0
- kitten_text_processing-0.1.0/tests/upstream/hy/test_cases_word.txt +50 -0
- kitten_text_processing-0.1.0/tests/upstream/it/test_cases_cardinal.txt +13 -0
- kitten_text_processing-0.1.0/tests/upstream/it/test_cases_decimal.txt +4 -0
- kitten_text_processing-0.1.0/tests/upstream/it/test_cases_electronic.txt +13 -0
- kitten_text_processing-0.1.0/tests/upstream/it/test_cases_measure.txt +7 -0
- kitten_text_processing-0.1.0/tests/upstream/it/test_cases_money.txt +5 -0
- kitten_text_processing-0.1.0/tests/upstream/it/test_cases_time.txt +6 -0
- kitten_text_processing-0.1.0/tests/upstream/it/test_cases_whitelist.txt +4 -0
- kitten_text_processing-0.1.0/tests/upstream/ja/test_cases_cardinal.txt +43 -0
- kitten_text_processing-0.1.0/tests/upstream/ja/test_cases_date.txt +200 -0
- kitten_text_processing-0.1.0/tests/upstream/ja/test_cases_decimal.txt +15 -0
- kitten_text_processing-0.1.0/tests/upstream/ja/test_cases_fraction.txt +18 -0
- kitten_text_processing-0.1.0/tests/upstream/ja/test_cases_ordinal.txt +64 -0
- kitten_text_processing-0.1.0/tests/upstream/ja/test_cases_time.txt +202 -0
- kitten_text_processing-0.1.0/tests/upstream/ko/test_cases_cardinal.txt +48 -0
- kitten_text_processing-0.1.0/tests/upstream/ko/test_cases_date.txt +29 -0
- kitten_text_processing-0.1.0/tests/upstream/ko/test_cases_decimal.txt +28 -0
- kitten_text_processing-0.1.0/tests/upstream/ko/test_cases_electronic.txt +20 -0
- kitten_text_processing-0.1.0/tests/upstream/ko/test_cases_fraction.txt +28 -0
- kitten_text_processing-0.1.0/tests/upstream/ko/test_cases_measure.txt +40 -0
- kitten_text_processing-0.1.0/tests/upstream/ko/test_cases_money.txt +64 -0
- kitten_text_processing-0.1.0/tests/upstream/ko/test_cases_ordinal.txt +54 -0
- kitten_text_processing-0.1.0/tests/upstream/ko/test_cases_telephone.txt +33 -0
- kitten_text_processing-0.1.0/tests/upstream/ko/test_cases_time.txt +25 -0
- kitten_text_processing-0.1.0/tests/upstream/manifest.json +2251 -0
- kitten_text_processing-0.1.0/tests/upstream/pt/test_cases_cardinal.txt +121 -0
- kitten_text_processing-0.1.0/tests/upstream/pt/test_cases_date.txt +26 -0
- kitten_text_processing-0.1.0/tests/upstream/pt/test_cases_decimal.txt +58 -0
- kitten_text_processing-0.1.0/tests/upstream/pt/test_cases_electronic.txt +13 -0
- kitten_text_processing-0.1.0/tests/upstream/pt/test_cases_fraction.txt +22 -0
- kitten_text_processing-0.1.0/tests/upstream/pt/test_cases_measure.txt +18 -0
- kitten_text_processing-0.1.0/tests/upstream/pt/test_cases_money.txt +25 -0
- kitten_text_processing-0.1.0/tests/upstream/pt/test_cases_ordinal.txt +39 -0
- kitten_text_processing-0.1.0/tests/upstream/pt/test_cases_telephone.txt +7 -0
- kitten_text_processing-0.1.0/tests/upstream/pt/test_cases_time.txt +30 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_cardinal.txt +28 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_cardinal_normalize_with_audio.txt +51 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_date.txt +6 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_decimal.txt +17 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_electronic.txt +4 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_measure.txt +13 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_money.txt +9 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_ordinal.txt +75 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_telephone.txt +1 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_time.txt +9 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_whitelist.txt +4 -0
- kitten_text_processing-0.1.0/tests/upstream/ru/test_cases_word.txt +3 -0
- kitten_text_processing-0.1.0/tests/upstream/rw/test_cases_cardinal.txt +57 -0
- kitten_text_processing-0.1.0/tests/upstream/rw/test_cases_time.txt +14 -0
- kitten_text_processing-0.1.0/tests/upstream/rw/test_cases_whitelist.txt +3 -0
- kitten_text_processing-0.1.0/tests/upstream/rw/test_cases_word.txt +26 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_cardinal.txt +68 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_date.txt +17 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_decimal.txt +7 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_electronic.txt +12 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_fraction.txt +2 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_measure.txt +7 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_money.txt +65 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_normalize_with_audio.txt +14 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_ordinal.txt +7 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_telephone.txt +7 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_time.txt +12 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_whitelist.txt +1 -0
- kitten_text_processing-0.1.0/tests/upstream/sv/test_cases_word.txt +48 -0
- kitten_text_processing-0.1.0/tests/upstream/vi/test_cases_cardinal.txt +109 -0
- kitten_text_processing-0.1.0/tests/upstream/vi/test_cases_date.txt +13 -0
- kitten_text_processing-0.1.0/tests/upstream/vi/test_cases_decimal.txt +29 -0
- kitten_text_processing-0.1.0/tests/upstream/vi/test_cases_fraction.txt +13 -0
- kitten_text_processing-0.1.0/tests/upstream/vi/test_cases_measure.txt +63 -0
- kitten_text_processing-0.1.0/tests/upstream/vi/test_cases_money.txt +30 -0
- kitten_text_processing-0.1.0/tests/upstream/vi/test_cases_ordinal.txt +30 -0
- kitten_text_processing-0.1.0/tests/upstream/vi/test_cases_range.txt +11 -0
- kitten_text_processing-0.1.0/tests/upstream/vi/test_cases_roman.txt +57 -0
- kitten_text_processing-0.1.0/tests/upstream/vi/test_cases_time.txt +117 -0
- kitten_text_processing-0.1.0/tests/upstream/zh/test_cases_cardinal.txt +85 -0
- kitten_text_processing-0.1.0/tests/upstream/zh/test_cases_date.txt +35 -0
- kitten_text_processing-0.1.0/tests/upstream/zh/test_cases_decimal.txt +35 -0
- kitten_text_processing-0.1.0/tests/upstream/zh/test_cases_fraction.txt +26 -0
- kitten_text_processing-0.1.0/tests/upstream/zh/test_cases_measure.txt +11 -0
- kitten_text_processing-0.1.0/tests/upstream/zh/test_cases_money.txt +22 -0
- kitten_text_processing-0.1.0/tests/upstream/zh/test_cases_ordinal.txt +84 -0
- kitten_text_processing-0.1.0/tests/upstream/zh/test_cases_time.txt +34 -0
- kitten_text_processing-0.1.0/tests/upstream/zh/test_cases_whitelist.txt +10 -0
- kitten_text_processing-0.1.0/tests/upstream/zh/test_cases_word.txt +25 -0
- kitten_text_processing-0.1.0/tools/baseline_fst.py +196 -0
- kitten_text_processing-0.1.0/tools/benchmark.py +109 -0
- kitten_text_processing-0.1.0/tools/export_detokenizer.py +32 -0
- kitten_text_processing-0.1.0/tools/export_grammars.py +71 -0
- kitten_text_processing-0.1.0/tools/freeze_extended.py +53 -0
- kitten_text_processing-0.1.0/tools/import_upstream_tests.py +72 -0
- kitten_text_processing-0.1.0/tools/requirements-reference.txt +4 -0
- kitten_text_processing-0.1.0/tools/speed_benchmark.py +85 -0
- kitten_text_processing-0.1.0/tools/stress_test.py +214 -0
- kitten_text_processing-0.1.0/tools/upstream_cases.py +38 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 alvations
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Kitten Text Processing
|
|
2
|
+
|
|
3
|
+
Bundled grammar data is derived from NVIDIA NeMo Text Processing 1.2.0:
|
|
4
|
+
https://github.com/NVIDIA/NeMo-text-processing
|
|
5
|
+
Copyright NVIDIA CORPORATION and NeMo contributors.
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
7
|
+
|
|
8
|
+
_token_parser.py, _ordering.py, and _punctuation.py are adapted from
|
|
9
|
+
NeMo Text Processing 1.2.0. Original copyright notices are retained.
|
|
10
|
+
The grammar exporter preserves the upstream cased grammar weights and labels.
|
|
11
|
+
Russian uses deterministic=False, as required by the upstream grammar.
|
|
12
|
+
|
|
13
|
+
The byte-transducer decoder and package interface are implemented here using
|
|
14
|
+
only the Python standard library. No Pynini, OpenFst, or NeMo executable code
|
|
15
|
+
is required at runtime. OpenFst's documented shortest-path queue ordering
|
|
16
|
+
informs the decoder's tie-breaking behavior.
|
|
17
|
+
|
|
18
|
+
The unchanged text-normalization fixtures in tests/upstream are from NeMo
|
|
19
|
+
r1.2.0, commit 7efa127d968c081793ebf11fa94dfb4257302d48 (Apache-2.0).
|
|
20
|
+
|
|
21
|
+
_unicode_data.py contains Unicode character tables exported from Sacremoses
|
|
22
|
+
0.2.0, copyright Sacremoses contributors, licensed under the MIT License
|
|
23
|
+
(see LICENSE-SACREMOSES). _detokenize.py reproduces its relevant behavior.
|
|
24
|
+
|
|
25
|
+
The output-epsilon removal ordering follows the OpenFst RmEpsilon algorithm
|
|
26
|
+
(Copyright Google, Inc., Apache-2.0); the implementation here uses Python.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kitten-text-processing
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Standalone, standard-library-only multilingual text normalization for TTS
|
|
5
|
+
License-Expression: Apache-2.0 AND MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/KittenML/kitten-text-processing
|
|
7
|
+
Project-URL: Repository, https://github.com/KittenML/kitten-text-processing
|
|
8
|
+
Project-URL: Issues, https://github.com/KittenML/kitten-text-processing/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
License-File: LICENSE-SACREMOSES
|
|
16
|
+
License-File: NOTICE
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# Kitten Text Processing
|
|
20
|
+
|
|
21
|
+
A standalone multilingual written-to-spoken normalizer with **zero runtime
|
|
22
|
+
dependencies**. It uses Python's standard library to interpret bundled NeMo
|
|
23
|
+
1.2.0 grammar data. No NeMo, Pynini, OpenFst, models, network access, or grammar
|
|
24
|
+
compilation is needed when installing or running the library.
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pip install kitten-text-processing
|
|
28
|
+
python -m kitten_text_processing --lang en 'I paid $12.50 for 3 books.'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from kitten_text_processing import normalize_text, warm, Normalizer
|
|
33
|
+
|
|
34
|
+
warm() # optional; load English ahead of the first call
|
|
35
|
+
normalize_text('I paid $12.50 for 3 books.')
|
|
36
|
+
# 'I paid twelve dollars fifty cents for three books.'
|
|
37
|
+
normalize_text('Tengo 2 gatos.', locale='es-ES')
|
|
38
|
+
# 'Tengo dos gatos.'
|
|
39
|
+
|
|
40
|
+
normalizer = Normalizer(input_case='cased', lang='ja')
|
|
41
|
+
normalizer.normalize('猫が2匹います。', punct_post_process=True)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Languages: `en es fr de pt it zh ja ko hi ar ru vi hu sv hy rw`.
|
|
45
|
+
Locale tags such as `en-US`, `pt-BR`, `zh-CN`, and `hi_IN` select the corresponding
|
|
46
|
+
language grammar; they do not select separate regional grammars. Python 3.10+.
|
|
47
|
+
|
|
48
|
+
## Convenience API
|
|
49
|
+
|
|
50
|
+
`normalize_text(text, locale='en-US', return_spans=False)` normalizes text and
|
|
51
|
+
cleans up punctuation. `warm(locale='en-US')` preloads a language grammar.
|
|
52
|
+
`PRESERVES_SENTINELS` indicates that private-use expression markers are retained.
|
|
53
|
+
|
|
54
|
+
`return_spans=True` raises `NotImplementedError`. Empty values are preserved by
|
|
55
|
+
`normalize_text`; `Normalizer.normalize` requires a string. Unsupported languages
|
|
56
|
+
raise `ValueError`.
|
|
57
|
+
|
|
58
|
+
## Design and scope
|
|
59
|
+
|
|
60
|
+
The runtime is Python code plus about 14 MB of compressed, portable grammar
|
|
61
|
+
arrays. It runs weighted byte transducers over UTF-8, parses the classified
|
|
62
|
+
tokens, tries the upstream field-order permutations, then verbalizes and applies
|
|
63
|
+
punctuation cleanup. Grammars are loaded lazily per language. The convenience
|
|
64
|
+
API retains at most four normalizers; explicit instances let callers control
|
|
65
|
+
lifetime. Instances are safe to call concurrently. Normalize sentence-sized
|
|
66
|
+
chunks: ambiguous long inputs can build large intermediate lattices.
|
|
67
|
+
|
|
68
|
+
The cased written-to-spoken grammars from the pinned NeMo release are included.
|
|
69
|
+
Inverse normalization, audio rescoring, custom whitelists, grammar compilation,
|
|
70
|
+
and separate `lower_cased` grammar variants are outside this package's scope.
|
|
71
|
+
Korean and Armenian also accept `lower_cased`: their upstream graphs were verified
|
|
72
|
+
to be identical to their cased graphs.
|
|
73
|
+
Russian uses NeMo's non-deterministic grammar and chooses a minimum-weight
|
|
74
|
+
reading; this is not a context-sensitive grammatical disambiguator.
|
|
75
|
+
|
|
76
|
+
Upstream limitations remain visible. In particular, Portuguese and Kinyarwanda
|
|
77
|
+
can reject ordinary inputs; a no-path error is raised rather than silently
|
|
78
|
+
claiming successful normalization. Some upstream outputs leave digits intact or
|
|
79
|
+
choose linguistically awkward readings. Compatibility is not a claim of perfect
|
|
80
|
+
linguistic correctness for all inputs.
|
|
81
|
+
|
|
82
|
+
## Validation and reproduction
|
|
83
|
+
|
|
84
|
+
For development, clone the repository and install locally with `pip install .`.
|
|
85
|
+
|
|
86
|
+
The `tests/corpus` directory contains 1,000 manually authored input sentences
|
|
87
|
+
across all 17 supported languages and separately recorded NeMo outputs. This is
|
|
88
|
+
a regression corpus, not an untouched holdout or native-speaker quality audit.
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
# Standard-library-only checks and comparison with frozen reference outputs
|
|
92
|
+
python -m unittest discover -s tests -v
|
|
93
|
+
python tools/benchmark.py
|
|
94
|
+
|
|
95
|
+
# Build-time/reference tooling only (never runtime dependencies)
|
|
96
|
+
python -m venv .venv-reference
|
|
97
|
+
.venv-reference/bin/pip install -r tools/requirements-reference.txt
|
|
98
|
+
.venv-reference/bin/python tools/export_grammars.py
|
|
99
|
+
.venv-reference/bin/python tools/benchmark.py --record-reference
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Expanded comparison: 22,976 exact outputs and 1,435 matching rejections, with
|
|
103
|
+
zero mismatches across 24,411 cases.** Validation also includes the original 1,000 authored
|
|
104
|
+
sentences, every one of the 5,407 upstream fixture inputs, and over 1,000 additional
|
|
105
|
+
generated/edge cases per language. Accepted outputs must match exactly; matching
|
|
106
|
+
rejections are counted separately. There are 18 original fixture expectations that
|
|
107
|
+
NeMo itself disagrees with; these remain unchanged and are explicitly recorded.
|
|
108
|
+
Audio/n-best fixture inputs are included, but audio rescoring is outside our scope.
|
|
109
|
+
See [upstream provenance](https://github.com/KittenML/kitten-text-processing/blob/main/tests/upstream/README.md).
|
|
110
|
+
|
|
111
|
+
The optimized engine is **1.8–7.8× faster than the previous implementation** on our
|
|
112
|
+
warm-call benchmark. English improved from 65.7 to 23.8 ms per sentence (NeMo:
|
|
113
|
+
7.7 ms); speed relative to NeMo varies by language. Measurements use 20
|
|
114
|
+
sentences per language, three repetitions, warmed grammar indexes, and rotating
|
|
115
|
+
execution order. Run `tools/speed_benchmark.py` in the reference environment to
|
|
116
|
+
produce a local report. Generated benchmark results are excluded from Git.
|
|
117
|
+
Grammar metadata records state/arc counts, upstream version, settings, and SHA-256 hashes.
|
|
118
|
+
The exporter skips already exported languages; to rebuild one, remove its
|
|
119
|
+
`metadata.json` and pass `--languages en` (or another language).
|
|
120
|
+
|
|
121
|
+
To regenerate the expanded oracle suite (development dependencies required):
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
.venv-reference/bin/python tools/stress_test.py --case-source upstream --count 0 --output .cache/upstream-canonical
|
|
125
|
+
.venv-reference/bin/python tools/stress_test.py --case-source generated --seed 20261002 --count 1000 --output .cache/generated-canonical
|
|
126
|
+
python tools/freeze_extended.py .cache/upstream-canonical .cache/generated-canonical
|
|
127
|
+
.venv-reference/bin/python tools/speed_benchmark.py
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The package and NeMo-derived grammar data use Apache-2.0. Frozen Sacremoses
|
|
131
|
+
Unicode tables use MIT. See `LICENSE`, `LICENSE-SACREMOSES`, and `NOTICE` for
|
|
132
|
+
provenance and retained notices.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Kitten Text Processing
|
|
2
|
+
|
|
3
|
+
A standalone multilingual written-to-spoken normalizer with **zero runtime
|
|
4
|
+
dependencies**. It uses Python's standard library to interpret bundled NeMo
|
|
5
|
+
1.2.0 grammar data. No NeMo, Pynini, OpenFst, models, network access, or grammar
|
|
6
|
+
compilation is needed when installing or running the library.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pip install kitten-text-processing
|
|
10
|
+
python -m kitten_text_processing --lang en 'I paid $12.50 for 3 books.'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from kitten_text_processing import normalize_text, warm, Normalizer
|
|
15
|
+
|
|
16
|
+
warm() # optional; load English ahead of the first call
|
|
17
|
+
normalize_text('I paid $12.50 for 3 books.')
|
|
18
|
+
# 'I paid twelve dollars fifty cents for three books.'
|
|
19
|
+
normalize_text('Tengo 2 gatos.', locale='es-ES')
|
|
20
|
+
# 'Tengo dos gatos.'
|
|
21
|
+
|
|
22
|
+
normalizer = Normalizer(input_case='cased', lang='ja')
|
|
23
|
+
normalizer.normalize('猫が2匹います。', punct_post_process=True)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Languages: `en es fr de pt it zh ja ko hi ar ru vi hu sv hy rw`.
|
|
27
|
+
Locale tags such as `en-US`, `pt-BR`, `zh-CN`, and `hi_IN` select the corresponding
|
|
28
|
+
language grammar; they do not select separate regional grammars. Python 3.10+.
|
|
29
|
+
|
|
30
|
+
## Convenience API
|
|
31
|
+
|
|
32
|
+
`normalize_text(text, locale='en-US', return_spans=False)` normalizes text and
|
|
33
|
+
cleans up punctuation. `warm(locale='en-US')` preloads a language grammar.
|
|
34
|
+
`PRESERVES_SENTINELS` indicates that private-use expression markers are retained.
|
|
35
|
+
|
|
36
|
+
`return_spans=True` raises `NotImplementedError`. Empty values are preserved by
|
|
37
|
+
`normalize_text`; `Normalizer.normalize` requires a string. Unsupported languages
|
|
38
|
+
raise `ValueError`.
|
|
39
|
+
|
|
40
|
+
## Design and scope
|
|
41
|
+
|
|
42
|
+
The runtime is Python code plus about 14 MB of compressed, portable grammar
|
|
43
|
+
arrays. It runs weighted byte transducers over UTF-8, parses the classified
|
|
44
|
+
tokens, tries the upstream field-order permutations, then verbalizes and applies
|
|
45
|
+
punctuation cleanup. Grammars are loaded lazily per language. The convenience
|
|
46
|
+
API retains at most four normalizers; explicit instances let callers control
|
|
47
|
+
lifetime. Instances are safe to call concurrently. Normalize sentence-sized
|
|
48
|
+
chunks: ambiguous long inputs can build large intermediate lattices.
|
|
49
|
+
|
|
50
|
+
The cased written-to-spoken grammars from the pinned NeMo release are included.
|
|
51
|
+
Inverse normalization, audio rescoring, custom whitelists, grammar compilation,
|
|
52
|
+
and separate `lower_cased` grammar variants are outside this package's scope.
|
|
53
|
+
Korean and Armenian also accept `lower_cased`: their upstream graphs were verified
|
|
54
|
+
to be identical to their cased graphs.
|
|
55
|
+
Russian uses NeMo's non-deterministic grammar and chooses a minimum-weight
|
|
56
|
+
reading; this is not a context-sensitive grammatical disambiguator.
|
|
57
|
+
|
|
58
|
+
Upstream limitations remain visible. In particular, Portuguese and Kinyarwanda
|
|
59
|
+
can reject ordinary inputs; a no-path error is raised rather than silently
|
|
60
|
+
claiming successful normalization. Some upstream outputs leave digits intact or
|
|
61
|
+
choose linguistically awkward readings. Compatibility is not a claim of perfect
|
|
62
|
+
linguistic correctness for all inputs.
|
|
63
|
+
|
|
64
|
+
## Validation and reproduction
|
|
65
|
+
|
|
66
|
+
For development, clone the repository and install locally with `pip install .`.
|
|
67
|
+
|
|
68
|
+
The `tests/corpus` directory contains 1,000 manually authored input sentences
|
|
69
|
+
across all 17 supported languages and separately recorded NeMo outputs. This is
|
|
70
|
+
a regression corpus, not an untouched holdout or native-speaker quality audit.
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
# Standard-library-only checks and comparison with frozen reference outputs
|
|
74
|
+
python -m unittest discover -s tests -v
|
|
75
|
+
python tools/benchmark.py
|
|
76
|
+
|
|
77
|
+
# Build-time/reference tooling only (never runtime dependencies)
|
|
78
|
+
python -m venv .venv-reference
|
|
79
|
+
.venv-reference/bin/pip install -r tools/requirements-reference.txt
|
|
80
|
+
.venv-reference/bin/python tools/export_grammars.py
|
|
81
|
+
.venv-reference/bin/python tools/benchmark.py --record-reference
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Expanded comparison: 22,976 exact outputs and 1,435 matching rejections, with
|
|
85
|
+
zero mismatches across 24,411 cases.** Validation also includes the original 1,000 authored
|
|
86
|
+
sentences, every one of the 5,407 upstream fixture inputs, and over 1,000 additional
|
|
87
|
+
generated/edge cases per language. Accepted outputs must match exactly; matching
|
|
88
|
+
rejections are counted separately. There are 18 original fixture expectations that
|
|
89
|
+
NeMo itself disagrees with; these remain unchanged and are explicitly recorded.
|
|
90
|
+
Audio/n-best fixture inputs are included, but audio rescoring is outside our scope.
|
|
91
|
+
See [upstream provenance](https://github.com/KittenML/kitten-text-processing/blob/main/tests/upstream/README.md).
|
|
92
|
+
|
|
93
|
+
The optimized engine is **1.8–7.8× faster than the previous implementation** on our
|
|
94
|
+
warm-call benchmark. English improved from 65.7 to 23.8 ms per sentence (NeMo:
|
|
95
|
+
7.7 ms); speed relative to NeMo varies by language. Measurements use 20
|
|
96
|
+
sentences per language, three repetitions, warmed grammar indexes, and rotating
|
|
97
|
+
execution order. Run `tools/speed_benchmark.py` in the reference environment to
|
|
98
|
+
produce a local report. Generated benchmark results are excluded from Git.
|
|
99
|
+
Grammar metadata records state/arc counts, upstream version, settings, and SHA-256 hashes.
|
|
100
|
+
The exporter skips already exported languages; to rebuild one, remove its
|
|
101
|
+
`metadata.json` and pass `--languages en` (or another language).
|
|
102
|
+
|
|
103
|
+
To regenerate the expanded oracle suite (development dependencies required):
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
.venv-reference/bin/python tools/stress_test.py --case-source upstream --count 0 --output .cache/upstream-canonical
|
|
107
|
+
.venv-reference/bin/python tools/stress_test.py --case-source generated --seed 20261002 --count 1000 --output .cache/generated-canonical
|
|
108
|
+
python tools/freeze_extended.py .cache/upstream-canonical .cache/generated-canonical
|
|
109
|
+
.venv-reference/bin/python tools/speed_benchmark.py
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The package and NeMo-derived grammar data use Apache-2.0. Frozen Sacremoses
|
|
113
|
+
Unicode tables use MIT. See `LICENSE`, `LICENSE-SACREMOSES`, and `NOTICE` for
|
|
114
|
+
provenance and retained notices.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"""Dependency-free multilingual text normalization for speech synthesis."""
|
|
2
|
+
from .normalizer import Normalizer, PRESERVES_SENTINELS, SUPPORTED_LANGUAGES, normalize_text, warm
|
|
3
|
+
|
|
4
|
+
__version__ = '0.1.0'
|
|
5
|
+
__all__ = ['Normalizer', 'PRESERVES_SENTINELS', 'SUPPORTED_LANGUAGES', 'normalize_text', 'warm']
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Command-line interface: python -m kitten_text_processing --lang es 'Tengo 2 gatos.'"""
|
|
2
|
+
import argparse
|
|
3
|
+
import sys
|
|
4
|
+
from . import SUPPORTED_LANGUAGES, normalize_text
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main():
|
|
8
|
+
parser = argparse.ArgumentParser(description='Normalize written text for speech; no downloads or dependencies.')
|
|
9
|
+
parser.add_argument('text', nargs='?', help='Text to normalize; otherwise read stdin line by line')
|
|
10
|
+
parser.add_argument('--lang', default='en', help='Language code or locale (' + ', '.join(SUPPORTED_LANGUAGES) + ')')
|
|
11
|
+
args = parser.parse_args()
|
|
12
|
+
try:
|
|
13
|
+
if args.text is not None:
|
|
14
|
+
print(normalize_text(args.text, locale=args.lang))
|
|
15
|
+
else:
|
|
16
|
+
for line in sys.stdin:
|
|
17
|
+
print(normalize_text(line.rstrip('\n'), locale=args.lang))
|
|
18
|
+
except (ValueError, RuntimeError) as exc:
|
|
19
|
+
parser.exit(1, f'{exc}\n')
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
if __name__ == '__main__':
|
|
23
|
+
main()
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Moses-compatible punctuation handling for the supported TN languages.
|
|
2
|
+
|
|
3
|
+
Reimplemented using only re and Unicode character properties. NeMo calls Moses
|
|
4
|
+
with a single string in a list, which is then split on whitespace.
|
|
5
|
+
"""
|
|
6
|
+
import re
|
|
7
|
+
from bisect import bisect_right
|
|
8
|
+
from ._unicode_data import ALPHA_RANGES, CURRENCY_SYMBOLS
|
|
9
|
+
|
|
10
|
+
_ALPHA_STARTS = tuple(a for a, _ in ALPHA_RANGES)
|
|
11
|
+
|
|
12
|
+
def _alpha(character):
|
|
13
|
+
value = ord(character)
|
|
14
|
+
i = bisect_right(_ALPHA_STARTS, value) - 1
|
|
15
|
+
return i >= 0 and value <= ALPHA_RANGES[i][1]
|
|
16
|
+
|
|
17
|
+
_CJK = ((4352, 4607), (11904, 42191), (43072, 43135), (44032, 55215),
|
|
18
|
+
(63744, 64255), (65072, 65103), (65381, 65500), (94208, 101119),
|
|
19
|
+
(110592, 110895), (110960, 111359), (131072, 196607))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _cjk(c):
|
|
23
|
+
return any(a <= ord(c) <= b for a, b in _CJK)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def detokenize(text, lang):
|
|
27
|
+
tokens = re.sub(r' @-@ ', '-', ' ' + text + ' ').split()
|
|
28
|
+
quotes = {}
|
|
29
|
+
space, result = ' ', ''
|
|
30
|
+
for i, token in enumerate(tokens):
|
|
31
|
+
if _cjk(token[0]) and lang != 'ko':
|
|
32
|
+
result += ('' if i and _cjk(tokens[i-1][-1]) else space) + token
|
|
33
|
+
space = ' '
|
|
34
|
+
elif all(c in CURRENCY_SYMBOLS or c in '([{¿¡' for c in token):
|
|
35
|
+
result += space + token
|
|
36
|
+
space = ''
|
|
37
|
+
elif re.fullmatch(r'[,\.?!:;\\%}\])]+', token):
|
|
38
|
+
result += (' ' if lang == 'fr' and re.fullmatch(r'[?!:;\\%]', token) else '') + token
|
|
39
|
+
space = ' '
|
|
40
|
+
elif lang == 'en' and i and len(token) > 1 and token[0] == "'" and _alpha(token[1]):
|
|
41
|
+
result += token
|
|
42
|
+
space = ' '
|
|
43
|
+
elif (lang in ('fr', 'it') and i+1 < len(tokens) and len(token) > 1
|
|
44
|
+
and token[-1] == "'" and _alpha(token[-2]) and _alpha(tokens[i+1][0])):
|
|
45
|
+
result += space + token
|
|
46
|
+
space = ''
|
|
47
|
+
elif re.fullmatch('[\'"„“`]+', token):
|
|
48
|
+
key = '"' if all(c in '„“”' for c in token) else token
|
|
49
|
+
count = quotes.get(key, 0)
|
|
50
|
+
if count % 2 or (lang == 'en' and token == "'" and i and tokens[i-1].endswith('s')):
|
|
51
|
+
result += token
|
|
52
|
+
space = ' '
|
|
53
|
+
if count % 2:
|
|
54
|
+
quotes[key] = count + 1
|
|
55
|
+
else:
|
|
56
|
+
result += space + token
|
|
57
|
+
space = ''
|
|
58
|
+
quotes[key] = count + 1
|
|
59
|
+
else:
|
|
60
|
+
result += space + token
|
|
61
|
+
space = ' '
|
|
62
|
+
return re.sub(' {2,}', ' ', result).strip()
|