class_docstr: Collection of _Hypothesis objects
class_docstr_tok: ["Collection","of","_Hypothesis","objects"]
docstr: Add ``hypothesis`` to the stack.
  Removes lowest scoring hypothesis if the stack is full.
  After insertion, hypotheses that score less than
  ``beam_threshold`` times the score of the best hypothesis
  are removed.
docstr_tok: ["Add","``","hypothesis","``","to","the","stack",".","Removes","lowest","scoring","hypothesis","if","the","stack","is","full",".","After","insertion",",","hypotheses","that","score","less","than","``","beam_threshold","``","times","the","score","of","the","best","hypothesis","are","removed","."]
code: def push(self, hypothesis):
      """
      Add ``hypothesis`` to the stack.
      Removes lowest scoring hypothesis if the stack is full.
      After insertion, hypotheses that score less than
      ``beam_threshold`` times the score of the best hypothesis
      are removed.
      """
      self.items.append(hypothesis)
      self.items.sort(key=lambda h: h.score(), reverse=True)
      while len(self.items) > self.max_size:
          self.items.pop()
      self.threshold_prune()
  
imports: import warnings
  from collections import defaultdict
  from math import log
label_desc: Use image node_id 2 for calling the _Stack obj's underlying member method code with example usage: obj.push(hypothesis) without return types