class_docstr: Algorithms for learning HMM parameters from training data. These include
  both supervised learning (MLE) and unsupervised learning (Baum-Welch).
  
  Creates an HMM trainer to induce an HMM with the given states and
  output symbol alphabet. A supervised and unsupervised training
  method may be used. If either of the states or symbols are not given,
  these may be derived from supervised training.
  
  :param states:  the set of state labels
  :type states:   sequence of any
  :param symbols: the set of observation symbols
  :type symbols:  sequence of any
docstr: Trains the HMM using both (or either of) supervised and unsupervised
  techniques.
  
  :return: the trained model
  :rtype: HiddenMarkovModelTagger
  :param labelled_sequences: the supervised training data, a set of
      labelled sequences of observations
      ex: [ (word_1, tag_1),...,(word_n,tag_n) ]
  :type labelled_sequences: list
  :param unlabeled_sequences: the unsupervised training data, a set of
      sequences of observations
      ex: [ word_1, ..., word_n ]
  :type unlabeled_sequences: list
  :param kwargs: additional arguments to pass to the training methods
docstr_tok: ["Trains","the","HMM","using","both","(","or","either","of",")","supervised","and","unsupervised","techniques",".",":","return",":","the","trained","model",":","rtype",":","HiddenMarkovModelTagger",":","param","labelled_sequences",":","the","supervised","training","data",",","a","set","of","labelled","sequences","of","observations","ex",":","[","(","word_1",",","tag_1",")",",","...",",","(","word_n",",","tag_n",")","]",":","type","labelled_sequences",":","list",":","param","unlabeled_sequences",":","the","unsupervised","training","data",",","a","set","of","sequences","of","observations","ex",":","[","word_1",",","...",",","word_n","]",":","type","unlabeled_sequences",":","list",":","param","kwargs",":","additional","arguments","to","pass","to","the","training","methods"]
code: def train(
      self, labeled_sequences=None, unlabeled_sequences=None, **kwargs
  ):
      """
      Trains the HMM using both (or either of) supervised and unsupervised
      techniques.
  
      :return: the trained model
      :rtype: HiddenMarkovModelTagger
      :param labelled_sequences: the supervised training data, a set of
          labelled sequences of observations
          ex: [ (word_1, tag_1),...,(word_n,tag_n) ]
      :type labelled_sequences: list
      :param unlabeled_sequences: the unsupervised training data, a set of
          sequences of observations
          ex: [ word_1, ..., word_n ]
      :type unlabeled_sequences: list
      :param kwargs: additional arguments to pass to the training methods
      """
      assert labeled_sequences or unlabeled_sequences
      model = None
      if labeled_sequences:
          model = self.train_supervised(labeled_sequences, **kwargs)
      if unlabeled_sequences:
          if model:
              kwargs["model"] = model
          model = self.train_unsupervised(unlabeled_sequences, **kwargs)
      return model
  
imports: import itertools
  import re
  from nltk.metrics import accuracy
  from nltk.probability import ConditionalFreqDist, ConditionalProbDist, DictionaryConditionalProbDist, DictionaryProbDist, FreqDist, LidstoneProbDist, MLEProbDist, MutableProbDist, RandomProbDist
  from nltk.tag.api import TaggerI
  from nltk.util import LazyMap, unique_list
label_desc: Use image node_id 2 for calling the HiddenMarkovModelTrainer obj's underlying member method code with example usage: obj.train(labeled_sequences, unlabeled_sequences) and returns: model