class_docstr: A wrapper for schema for a service.
class_docstr_tok: ["A","wrapper","for","schema","for","a","service","."]
docstr: Constructor for ServiceSchema.
  Args:
      schema_json: schema json dict
      service_id: service ID
docstr_tok: ["Constructor","for","ServiceSchema",".","Args",":","schema_json",":","schema","json","dict","service_id",":","service","ID"]
code: def __init__(
      self, schema_json: dict, service_id: Optional[int] = None
  ):
      """
      Constructor for ServiceSchema.
      Args:
          schema_json: schema json dict
          service_id: service ID
      """
      self._service_name = schema_json["service_name"]
      self._description = schema_json["description"]
      self._schema_json = schema_json
      self._service_id = service_id
  
      # Construct the vocabulary for intents, slots, categorical slots,
      # non-categorical slots and categorical slot values.
      self._intents = ["NONE"] + sorted(
          i["name"] for i in schema_json["intents"]
      )
      self._intent_descriptions = {
          i["name"]: i["description"] for i in schema_json["intents"]
      }
      self._intent_descriptions["NONE"] = "none"
      self._slots = sorted(s["name"] for s in schema_json["slots"])
      self._slots_descriptions = {
          s["name"]: s["description"] for s in schema_json["slots"]
      }
      self._categorical_slots = sorted(
          s["name"]
          for s in schema_json["slots"]
          if s["is_categorical"] and s["name"] in self.state_slots
      )
      self._non_categorical_slots = sorted(
          s["name"]
          for s in schema_json["slots"]
          if not s["is_categorical"] and s["name"] in self.state_slots
      )
      slot_schemas = {s["name"]: s for s in schema_json["slots"]}
      categorical_slot_values = {}
      categorical_slot_value_ids = {}
      categorical_slot_ids = {}
      non_categorical_slot_ids = {}
      for slot_id, slot in enumerate(self._categorical_slots):
          slot_schema = slot_schemas[slot]
          values = sorted(slot_schema["possible_values"])
          categorical_slot_values[slot] = values
          value_ids = {value: idx for idx, value in enumerate(values)}
          categorical_slot_value_ids[slot] = value_ids
          categorical_slot_ids[slot] = slot_id
  
      for slot_id, slot in enumerate(self._non_categorical_slots):
          non_categorical_slot_ids[slot] = slot_id
  
      self._categorical_slot_values = categorical_slot_values
      self._categorical_slot_value_ids = categorical_slot_value_ids
  
      self._categorical_slot_ids = categorical_slot_ids
      self._non_categorical_slot_ids = non_categorical_slot_ids
  
imports: import json
  from typing import List, Optional, Union
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new ServiceSchema object from inherited base classes: object with example: obj = ServiceSchema(schema_json, service_id)