class_docstr: Reads LUIS training data.
class_docstr_tok: ["Reads","LUIS","training","data","."]
docstr: Loads training data stored in the LUIS.ai data format.
docstr_tok: ["Loads","training","data","stored","in","the","LUIS.ai","data","format","."]
code: def read_from_json(
      self, js: Dict[Text, Any], **kwargs: Any
  ) -> "TrainingData":
      """Loads training data stored in the LUIS.ai data format."""
      training_examples = []
  
      max_tested_luis_schema_version = 7
      major_version = int(js["luis_schema_version"].split(".")[0])
      if major_version > max_tested_luis_schema_version:
          rasa.shared.utils.io.raise_warning(
              f"Your luis data schema version {js['luis_schema_version']} "
              f"is higher than 7.x.x. "
              f"Training may not be performed correctly. "
          )
  
      for s in js["utterances"]:
          text = s.get("text")
          intent = s.get("intent")
          entities = []
          for e in s.get("entities") or []:
              start, end = e["startPos"], e["endPos"] + 1
              val = text[start:end]
  
              entities.append(
                  {
                      ENTITY_ATTRIBUTE_TYPE: e.get("entity"),
                      ENTITY_ATTRIBUTE_VALUE: val,
                      ENTITY_ATTRIBUTE_START: start,
                      ENTITY_ATTRIBUTE_END: end,
                      ENTITY_ATTRIBUTE_ROLE: e.get(
                          "role", NO_ENTITY_TAG
                      ),
                  }
              )
  
          data = {ENTITIES: entities}
          if intent:
              data[INTENT] = intent
          data[TEXT] = text
  
          training_examples.append(Message(data=data))
  
      return TrainingData(
          training_examples,
          regex_features=self._extract_regex_features(js),
      )
  
file_path: rasa/rasa/shared/nlu/training_data/formats/luis.py
imports: import logging
  from typing import Any, Dict, List, Text
  from rasa.shared.nlu.constants import TEXT, INTENT, ENTITIES, ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_ROLE, ENTITY_ATTRIBUTE_VALUE, ENTITY_ATTRIBUTE_START, ENTITY_ATTRIBUTE_END, NO_ENTITY_TAG
  from rasa.shared.nlu.training_data.formats.readerwriter import JsonTrainingDataReader
  import rasa.shared.utils.io
  from rasa.shared.nlu.training_data.training_data import TrainingData
  from rasa.shared.nlu.training_data.message import Message
label_desc: Use image node_id 2 for calling the LuisReader obj's underlying member method code with example usage: obj.read_from_json(js) and returns: TrainingData