Download runtime/lexicon.py from islomov/gapi-uz-gapiring-v2: direct link, hf CLI and curl.
- Browser
- Download file 850 Bytes
-
https://huggingface.co/islomov/gapi-uz-gapiring-v2/resolve/main/runtime/lexicon.py
- Command line
-
hf download hf://islomov/gapi-uz-gapiring-v2/runtime/lexicon.py
-
curl -L -o lexicon.py https://huggingface.co/islomov/gapi-uz-gapiring-v2/resolve/main/runtime/lexicon.py
850 Bytes
| """The dictionary of English words of Gapiring v1, kept as a name so that v1 code runs. Gapiring v2 reads English words, | |
| brands and abbreviations from their ordinary spelling, so this dictionary changes nothing: load() warns once, apply() | |
| returns the text as it is.""" | |
| from __future__ import annotations | |
| import warnings | |
| class Held: | |
| def __init__(self, text: str): | |
| self.text, self.readings = text, [] | |
| def restore(self, said: str) -> str: | |
| return said | |
| class Lexicon: | |
| def load(cls, path=None) -> "Lexicon": | |
| warnings.warn("the dictionary (Lexicon) does nothing in Gapiring v2: English words are read as they are written", UserWarning, stacklevel=2) | |
| return cls() | |
| def apply(self, text: str) -> str: | |
| return text | |
| def hold(self, text: str) -> Held: | |
| return Held(text) | |