mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-27 02:34:21 +00:00
Minor fixes.
This commit is contained in:
parent
ec9927c4bf
commit
5ff660c84d
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This script takes as input lang_dir and generates HLG from
|
This script takes as input lang_dir and generates LG from
|
||||||
|
|
||||||
- L, the lexicon, built from lang_dir/L_disambig.pt
|
- L, the lexicon, built from lang_dir/L_disambig.pt
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ def compile_LG(lang_dir: str) -> kaldifst.StdVectorFst:
|
|||||||
assert "#0" in tokens
|
assert "#0" in tokens
|
||||||
assert "#0" in words
|
assert "#0" in words
|
||||||
|
|
||||||
token_disambig_id = tokens.find("#02")
|
token_disambig_id = tokens.find("#0")
|
||||||
word_disambig_id = words.find("#0")
|
word_disambig_id = words.find("#0")
|
||||||
|
|
||||||
L = k2.Fsa.from_dict(torch.load(f"{lang_dir}/L_disambig.pt"))
|
L = k2.Fsa.from_dict(torch.load(f"{lang_dir}/L_disambig.pt"))
|
||||||
@ -84,7 +84,7 @@ def compile_LG(lang_dir: str) -> kaldifst.StdVectorFst:
|
|||||||
)
|
)
|
||||||
kaldifst.arcsort(G, sort_type="ilabel")
|
kaldifst.arcsort(G, sort_type="ilabel")
|
||||||
|
|
||||||
logging.info(f"Composing LG")
|
logging.info("Composing LG")
|
||||||
LG = kaldifst.compose(
|
LG = kaldifst.compose(
|
||||||
L,
|
L,
|
||||||
G,
|
G,
|
||||||
@ -93,10 +93,10 @@ def compile_LG(lang_dir: str) -> kaldifst.StdVectorFst:
|
|||||||
connect=True,
|
connect=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.info(f"Determinize star LG")
|
logging.info("Determinize star LG")
|
||||||
kaldifst.determinize_star(LG)
|
kaldifst.determinize_star(LG)
|
||||||
|
|
||||||
logging.info(f"minimizeencoded")
|
logging.info("minimizeencoded")
|
||||||
kaldifst.minimize_encoded(LG)
|
kaldifst.minimize_encoded(LG)
|
||||||
|
|
||||||
# Set all disambig IDs to eps
|
# Set all disambig IDs to eps
|
||||||
|
Loading…
x
Reference in New Issue
Block a user