class_docstr: Records progress through the set of constraints for each item in the beam
  using a trie.
class_docstr_tok: ["Records","progress","through","the","set","of","constraints","for","each","item","in","the","beam","using","a","trie","."]
docstr: The number of constraints (not constraint tokens) that are completed.
  In addition to the already-completed states, we need to account for the
  current state, which might get marked as completed when another token
  is generated.
docstr_tok: ["The","number","of","constraints","(","not","constraint","tokens",")","that","are","completed",".","In","addition","to","the","already-completed","states",",","we","need","to","account","for","the","current","state",",","which","might","get","marked","as","completed","when","another","token","is","generated","."]
code: def num_completed(self):
      """The number of constraints (not constraint tokens) that are completed.
      In addition to the already-completed states, we need to account for the
      current state, which might get marked as completed when another token
      is generated.
      """
      in_final = (
          self.node.terminal
          and self.completed[self.node] < self.node.terminal
      )
      return sum(self.completed.values()) + in_final
  
imports: from collections import Counter
  from typing import List, Optional, Set, Tuple
  import torch
label_desc: Use image node_id 9 for calling the UnorderedConstraintState obj's underlying member method code with example usage: obj.num_completed() and returns: unknown