class_docstr: This Teacher is responsible for performing the task of Dialogue State Tracking.
  
  It can be used to evaluate LM on JGA (Joint Goal Accuracy) metric (as shown in
  [SimpleTOD](https://arxiv.org/abs/2005.00796) and
  [Soloist](https://arxiv.org/abs/2005.05298)).
class_docstr_tok: ["This","Teacher","is","responsible","for","performing","the","task","of","Dialogue","State","Tracking",".","It","can","be","used","to","evaluate","LM","on","JGA","(","Joint","Goal","Accuracy",")","metric","(","as","shown","in","[","SimpleTOD","]","(","https",":","\/\/arxiv.org\/abs\/2005.00796",")","and","[","Soloist","]","(","https",":","\/\/arxiv.org\/abs\/2005.05298",")",")","."]
docstr: Either ground truth or generated result should be in the format: "dom slot_type
  slot_val, dom slot_type slot_val, ..., dom slot_type slot_val," and this
  function would reformat the string into list:
  
  ["dom--slot_type--slot_val", ... ]
docstr_tok: ["Either","ground","truth","or","generated","result","should","be","in","the","format",":","``","dom","slot_type","slot_val",",","dom","slot_type","slot_val",",","...",",","dom","slot_type","slot_val",",","''","and","this","function","would","reformat","the","string","into","list",":","[","``","dom","--","slot_type","--","slot_val","''",",","...","]"]
code: def _extract_slot_from_string(self, slots_string):
      """
      Either ground truth or generated result should be in the format: "dom slot_type
      slot_val, dom slot_type slot_val, ..., dom slot_type slot_val," and this
      function would reformat the string into list:
  
      ["dom--slot_type--slot_val", ... ]
      """
  
      slots_list = []
      per_domain_slot_lists = {}
      named_entity_slot_lists = []
  
      # split according to ";"
      str_split = slots_string.split(self.BELIEF_STATE_DELIM)
  
      if str_split[-1] == "":
          str_split = str_split[:-1]
  
      str_split = [slot.strip() for slot in str_split]
  
      for slot_ in str_split:
          slot = slot_.split()
          if len(slot) > 2 and slot[0] in self.domains:
              domain = slot[0]
              slot_type = slot[1]
              slot_val = " ".join(slot[2:])
              if not slot_val == "dontcare":
                  slots_list.append(
                      domain + "--" + slot_type + "--" + slot_val
                  )
              if domain in per_domain_slot_lists:
                  per_domain_slot_lists[domain].add(
                      slot_type + "--" + slot_val
                  )
              else:
                  per_domain_slot_lists[domain] = {
                      slot_type + "--" + slot_val
                  }
              if domain + "--" + slot_type in self.named_entity_slots:
                  named_entity_slot_lists.append(
                      domain + "--" + slot_type + "--" + slot_val
                  )
      return slots_list, per_domain_slot_lists, named_entity_slot_lists
  
imports: import copy
  import json
  import os
  from typing import Optional
  import numpy
  import pandas
  import parlai.core.tod.tod_agents
  import parlai.core.tod.tod_core
  import parlai.tasks.multiwoz_v22.build
  from parlai.core.message import Message
  from parlai.core.metrics import AverageMetric
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.utils.data import DatatypeHelper
  from parlai.utils.io import PathManager
  from parlai.utils.testing import is_this_circleci
label_desc: Use image node_id 4 for calling the MultiWOZv22DSTTeacher obj's underlying member method code with example usage: obj._extract_slot_from_string(slots_string) and returns: slots_list,  per_domain_slot_lists,  named_entity_slot_lists