class_docstr: A trainer for training models. 
class_docstr_tok: ["A","trainer","for","training","models","."]
docstr: Train a dict lemmatizer given training (word, pos, lemma) triples.
  
  Can update only the composite_dict (word/pos) in situations where
  the data might be limited from the tags, such as when adding more
  words at pipeline time
docstr_tok: ["Train","a","dict","lemmatizer","given","training","(","word",",","pos",",","lemma",")","triples",".","Can","update","only","the","composite_dict","(","word\/pos",")","in","situations","where","the","data","might","be","limited","from","the","tags",",","such","as","when","adding","more","words","at","pipeline","time"]
code: def train_dict(self, triples, update_word_dict=True):
      """
      Train a dict lemmatizer given training (word, pos, lemma) triples.
  
      Can update only the composite_dict (word/pos) in situations where
      the data might be limited from the tags, such as when adding more
      words at pipeline time
      """
      # accumulate counter
      ctr = Counter()
      ctr.update([(p[0], p[1], p[2]) for p in triples])
      # find the most frequent mappings
      for p, _ in ctr.most_common():
          w, pos, l = p
          if (w, pos) not in self.composite_dict:
              self.composite_dict[(w, pos)] = l
          if update_word_dict and w not in self.word_dict:
              self.word_dict[w] = l
      return
  
imports: import os
  import sys
  import numpy
  from collections import Counter
  import logging
  import torch
  from torch import nn
  import torch.nn.init
  import stanza.models.common.seq2seq_constant
  from stanza.models.common.foundation_cache import load_charlm
  from stanza.models.common.seq2seq_model import Seq2SeqModel
  from stanza.models.common.char_model import CharacterLanguageModelWordAdapter
  from stanza.models.common import utils, loss
  from stanza.models.lemma import edit
  from stanza.models.lemma.vocab import MultiVocab
label_desc: Use image node_id 7 for calling the Trainer obj's underlying member method code with example usage: obj.train_dict(triples, update_word_dict) without return types