class_docstr: This base class defines abstract methods for manipulating a State.
  
  Applying transitions may change important metadata about a State
  such as the vectors associated with LSTM hidden states, for example.
  
  The constructor forwards all unused arguments to other classes in the
  constructor sequence, so put this before other classes such as nn.Module
class_docstr_tok: ["This","base","class","defines","abstract","methods","for","manipulating","a","State",".","Applying","transitions","may","change","important","metadata","about","a","State","such","as","the","vectors","associated","with","LSTM","hidden","states",",","for","example",".","The","constructor","forwards","all","unused","arguments","to","other","classes","in","the","constructor","sequence",",","so","put","this","before","other","classes","such","as","nn.Module"]
docstr: what is passed in should be a list of list of preterminals
docstr_tok: ["what","is","passed","in","should","be","a","list","of","list","of","preterminals"]
code: def initial_state_from_preterminals(
      self, preterminal_lists, gold_trees
  ):
      """
      what is passed in should be a list of list of preterminals
      """
      word_queues = self.initial_word_queues(preterminal_lists)
      # this is the bottom of the TreeStack and will be the same for each State
      transitions = self.initial_transitions()
      constituents = self.initial_constituents()
      states = [
          State(
              sentence_length=len(wq)
              - 2,  # -2 because it starts and ends with a sentinel
              num_opens=0,
              word_queue=wq,
              gold_tree=None,
              gold_sequence=None,
              transitions=transitions,
              constituents=constituents,
              word_position=0,
              score=0.0,
          )
          for idx, wq in enumerate(word_queues)
      ]
      if gold_trees:
          states = [
              state._replace(gold_tree=gold_tree)
              for gold_tree, state in zip(gold_trees, states)
          ]
      return states
  
imports: from abc import ABC, abstractmethod
  from collections import defaultdict
  import logging
  import torch
  from stanza.models.common import utils
  from stanza.models.constituency import parse_transitions
  from stanza.models.constituency import transition_sequence
  from stanza.models.constituency.parse_transitions import State, TransitionScheme, CloseConstituent
  from stanza.models.constituency.parse_tree import Tree
  from stanza.models.constituency.tree_stack import TreeStack
  from stanza.server.parser_eval import ParseResult, ScoredTree
label_desc: Use image node_id 22 for calling the BaseModel obj's underlying member method code with example usage: obj.initial_state_from_preterminals(preterminal_lists, gold_trees) and returns: states