Skip to content
Snippets Groups Projects

Support subword and word language models

Merged Solene Tarride requested to merge subword-and-word-lm into main
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
+ 6
2
@@ -22,7 +22,7 @@ class Token(NamedTuple):
class LMTokenMapping(NamedTuple):
space: Token = Token("", " ")
space: Token = Token("", " ")
linebreak: Token = Token("", "\n")
ctc: Token = Token("", "<ctc>")
@@ -139,7 +139,9 @@ def parse_tokens(filename: str) -> Dict[str, EntityType]:
def read_yaml(yaml_path: str) -> Dict:
"""
Read YAML tokens file
Read YAML tokens file.
:param yaml_path: Path of the YAML file to read.
:return: The content of the read file.
"""
filename = Path(yaml_path)
assert filename.exists(), f"{yaml_path} does not resolve."
@@ -152,6 +154,8 @@ def read_yaml(yaml_path: str) -> Dict:
def read_json(json_path: str) -> Dict:
"""
Read labels JSON file
:param json_path: Path of the JSON file to read.
:return: The content of the read file.
"""
filename = Path(json_path)
assert filename.exists(), f"{json_path} does not resolve."
Loading