class_docstr: ABC for Language Models.
  
  Cannot be directly instantiated itself.
docstr: Trains the model on a text.
  
  :param text: Training text as a sequence of sentences.
docstr_tok: ["Trains","the","model","on","a","text",".",":","param","text",":","Training","text","as","a","sequence","of","sentences","."]
code: def fit(self, text, vocabulary_text=None):
      """Trains the model on a text.
  
      :param text: Training text as a sequence of sentences.
  
      """
      if not self.vocab:
          if vocabulary_text is None:
              raise ValueError(
                  "Cannot fit without a vocabulary or text to create it from."
              )
          self.vocab.update(vocabulary_text)
      self.counts.update(self.vocab.lookup(sent) for sent in text)
  
imports: import random
  import warnings
  from abc import ABCMeta, abstractmethod
  from bisect import bisect
  from itertools import accumulate
  from nltk.lm.counter import NgramCounter
  from nltk.lm.util import log_base2
  from nltk.lm.vocabulary import Vocabulary
label_desc: Use image node_id 2 for calling the LanguageModel obj's underlying member method code with example usage: obj.fit(text, vocabulary_text) without return types