class_docstr: Underlying LSTM model for MSTParser used by BIST parser.
class_docstr_tok: ["Underlying","LSTM","model","for","MSTParser","used","by","BIST","parser","."]
code: def predict(self, conll_path=None, conll=None):
      # pylint: disable=missing-docstring
      if conll is None:
          conll = read_conll(conll_path)
  
      for sentence in conll:
          conll_sentence = [
              entry
              for entry in sentence
              if isinstance(entry, ConllEntry)
          ]
  
          for entry in conll_sentence:
              wordvec = (
                  self.wlookup[int(self.vocab.get(entry.norm, 0))]
                  if self.wdims > 0
                  else None
              )
              posvec = (
                  self.plookup[int(self.pos[entry.pos])]
                  if self.pdims > 0
                  else None
              )
              entry.vec = concatenate(
                  [_f for _f in [wordvec, posvec, None] if _f]
              )
  
              entry.lstms = [entry.vec, entry.vec]
              entry.headfov = None
              entry.modfov = None
  
              entry.rheadfov = None
              entry.rmodfov = None
  
          if self.blstm_flag:
              lstm_forward = self.builders[0].initial_state()
              lstm_backward = self.builders[1].initial_state()
  
              for entry, rentry in zip(
                  conll_sentence, reversed(conll_sentence)
              ):
                  lstm_forward = lstm_forward.add_input(entry.vec)
                  lstm_backward = lstm_backward.add_input(rentry.vec)
  
                  entry.lstms[1] = lstm_forward.output()
                  rentry.lstms[0] = lstm_backward.output()
  
              if self.bibi_flag:
                  for entry in conll_sentence:
                      entry.vec = concatenate(entry.lstms)
  
                  blstm_forward = self.bbuilders[0].initial_state()
                  blstm_backward = self.bbuilders[1].initial_state()
  
                  for entry, rentry in zip(
                      conll_sentence, reversed(conll_sentence)
                  ):
                      blstm_forward = blstm_forward.add_input(entry.vec)
                      blstm_backward = blstm_backward.add_input(
                          rentry.vec
                      )
  
                      entry.lstms[1] = blstm_forward.output()
                      rentry.lstms[0] = blstm_backward.output()
  
          scores, _ = self._evaluate(conll_sentence)
          heads = decoder.parse_proj(scores)
  
          for entry, head in zip(conll_sentence, heads):
              entry.pred_parent_id = head
              entry.pred_relation = "_"
  
          dump = False
  
          if self.labels_flag:
              for modifier, head in enumerate(heads[1:]):
                  scores, _ = self._evaluate_label(
                      conll_sentence, head, modifier + 1
                  )
                  conll_sentence[
                      modifier + 1
                  ].pred_relation = self.irels[
                      max(enumerate(scores), key=itemgetter(1))[0]
                  ]
  
          renew_cg()
          if not dump:
              yield sentence
  
file_path: nlp-architect/nlp_architect/models/bist/mstlstm.py
imports: import random
  import time
  from collections import namedtuple
  from operator import itemgetter
  from dynet import ParameterCollection, AdamTrainer, LSTMBuilder, tanh, logistic, rectify, cmult, SimpleRNNBuilder, concatenate, np, renew_cg, esum
  from nlp_architect.data.conll import ConllEntry
  from nlp_architect.models.bist import decoder
  from nlp_architect.models.bist.utils import read_conll
label_desc: Use image node_id 5 for calling the MSTParserLSTM obj's underlying member method code with example usage: obj.predict(conll_path, conll) without return types