class_docstr: Ngram base implemented through ScorerInterface.
class_docstr_tok: ["Ngram","base","implemented","through","ScorerInterface","."]
docstr: Initialize Ngrambase.
  
  Args:
      ngram_model: ngram model path
      token_list: token list from dict or model.json
docstr_tok: ["Initialize","Ngrambase",".","Args",":","ngram_model",":","ngram","model","path","token_list",":","token","list","from","dict","or","model.json"]
code: def __init__(self, ngram_model, token_list):
      """Initialize Ngrambase.
  
      Args:
          ngram_model: ngram model path
          token_list: token list from dict or model.json
  
      """
      self.chardict = [
          x if x != "<eos>" else "</s>" for x in token_list
      ]
      self.charlen = len(self.chardict)
      self.lm = kenlm.LanguageModel(ngram_model)
      self.tmpkenlmstate = kenlm.State()
  
file_path: espnet/espnet/nets/scorers/ngram.py
imports: from abc import ABC
  import kenlm
  import torch
  from espnet.nets.scorer_interface import BatchScorerInterface, PartialScorerInterface
label_desc: Use image node_id 1 to create a new Ngrambase object from inherited base classes: ABC with example: obj = Ngrambase(ngram_model, token_list)