speechbrain.decoders.language_model 模块
kenlm n-gram 的语言模型封装器。
此文件基于PyCTCDecode中的kenLM包装器的实现(参见:https://github.com/kensho-technologies/pyctcdecode),并用于CTC解码器。
参见:speechbrain.decoders.ctc.py
- Authors
阿德尔·穆门 2023
摘要
类:
kenlm状态的包装器。 |
|
语言模型容器类,用于整合功能。 |
函数:
从arpa文件中读取unigrams。 |
参考
- speechbrain.decoders.language_model.load_unigram_set_from_arpa(arpa_path: str) Set[str][source]
从arpa文件中读取unigrams。
- class speechbrain.decoders.language_model.KenlmState(state: State)[source]
基础类:
objectkenlm 状态的包装器。
这是kenlm状态对象的包装器。它用于确保状态不会在语言模型类之外被修改。
取自:https://github.com/kensho-technologies/pyctcdecode
- Parameters:
state (kenlm.State) – Kenlm 状态对象。
- property state: State
获取原始状态对象。
- class speechbrain.decoders.language_model.LanguageModel(kenlm_model: Model, unigrams: Collection[str] | None = None, alpha: float = 0.5, beta: float = 1.5, unk_score_offset: float = -10.0, score_boundary: bool = True)[source]
基础类:
object语言模型容器类,用于整合功能。
该类是围绕kenlm语言模型的封装器。它提供了对标记进行评分和获取初始状态的功能。
取自:https://github.com/kensho-technologies/pyctcdecode
- Parameters:
- get_start_state() KenlmState[source]
获取初始 lm 状态。