class_docstr: Language model container class to consolidate functionality.
  
  This class is a wrapper around the kenlm language model. It provides
  functionality to score tokens and to get the initial state.
  
  Taken from: https://github.com/kensho-technologies/pyctcdecode
  
  Arguments
  ---------
  kenlm_model : kenlm.Model
      Kenlm model.
  unigrams : list
      List of known word unigrams.
  alpha : float
      Weight for language model during shallow fusion.
  beta : float
      Weight for length score adjustment of during scoring.
  unk_score_offset : float
      Amount of log score offset for unknown tokens.
  score_boundary : bool
      Whether to have kenlm respect boundaries when scoring.
class_docstr_tok: ["Language","model","container","class","to","consolidate","functionality",".","This","class","is","a","wrapper","around","the","kenlm","language","model",".","It","provides","functionality","to","score","tokens","and","to","get","the","initial","state",".","Taken","from",":","https",":","\/\/github.com\/kensho-technologies\/pyctcdecode","Arguments","--","--","--","--","-","kenlm_model",":","kenlm.Model","Kenlm","model",".","unigrams",":","list","List","of","known","word","unigrams",".","alpha",":","float","Weight","for","language","model","during","shallow","fusion",".","beta",":","float","Weight","for","length","score","adjustment","of","during","scoring",".","unk_score_offset",":","float","Amount","of","log","score","offset","for","unknown","tokens",".","score_boundary",":","bool","Whether","to","have","kenlm","respect","boundaries","when","scoring","."]
code: def __init__(
      self,
      kenlm_model: "kenlm.Model",
      unigrams: Optional[Collection[str]] = None,
      alpha: float = 0.5,
      beta: float = 1.5,
      unk_score_offset: float = -10.0,
      score_boundary: bool = True,
  ) -> None:
      self._kenlm_model = kenlm_model
      if unigrams is None:
          logger.warning(
              "No known unigrams provided, decoding results might be a lot worse."
          )
          unigram_set = set()
          char_trie = None
      else:
          unigram_set = _prepare_unigram_set(
              unigrams, self._kenlm_model
          )
          char_trie = CharTrie.fromkeys(unigram_set)
      self._unigram_set = unigram_set
      self._char_trie = char_trie
      self.alpha = alpha
      self.beta = beta
      self.unk_score_offset = unk_score_offset
      self.score_boundary = score_boundary
  
file_path: speechbrain/speechbrain/decoders/language_model.py
imports: import logging
  from typing import Collection, Optional, Set, Tuple, cast
  from pygtrie import CharTrie
  import math
label_desc: Use image node_id 1 to create a new LanguageModel object  with example: obj = LanguageModel(kenlm_model, unigrams, alpha, beta, unk_score_offset, score_boundary)