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","."]
docstr: Get partial token score.
docstr_tok: ["Get","partial","token","score","."]
code: def score_partial_token(self, partial_token: str) -> float:
      """Get partial token score."""
      if self._char_trie is None:
          is_oov = 1.0
      else:
          is_oov = int(self._char_trie.has_node(partial_token) == 0)
      unk_score = self.unk_score_offset * is_oov
      # if unk token length exceeds expected length then additionally decrease score
      if len(partial_token) > 6:
          unk_score = unk_score * len(partial_token) / 6
      return unk_score
  
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 5 for calling the LanguageModel obj's underlying member method code with example usage: obj.score_partial_token(partial_token) and returns: unk_score