Skip to content

Commit

Permalink
Use metadata constants from shared.nlu.constants
Browse files Browse the repository at this point in the history
  • Loading branch information
chdorner committed Jan 22, 2021
1 parent c19dc43 commit 2cb06dd
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions rasa/shared/nlu/training_data/formats/rasa_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
DOCS_URL_TRAINING_DATA,
LATEST_TRAINING_DATA_FORMAT_VERSION,
)
from rasa.shared.nlu.constants import METADATA_INTENT, METADATA_EXAMPLE
from rasa.shared.nlu.training_data.formats.readerwriter import (
TrainingDataReader,
TrainingDataWriter,
Expand All @@ -37,8 +38,6 @@
KEY_LOOKUP = "lookup"
KEY_LOOKUP_EXAMPLES = "examples"
KEY_METADATA = "metadata"
KEY_METADATA_INTENT = "intent"
KEY_METADATA_EXAMPLE = "example"

MULTILINE_TRAINING_EXAMPLE_LEADING_SYMBOL = "-"

Expand Down Expand Up @@ -516,11 +515,11 @@ def _convert_training_examples(
if isinstance(example, dict) and KEY_METADATA in example:
metadata = example[KEY_METADATA]

if KEY_METADATA_EXAMPLE in metadata:
converted[KEY_METADATA] = metadata[KEY_METADATA_EXAMPLE]
if METADATA_EXAMPLE in metadata:
converted[KEY_METADATA] = metadata[METADATA_EXAMPLE]

if intent_metadata is None and KEY_METADATA_INTENT in metadata:
intent_metadata = metadata[KEY_METADATA_INTENT]
if intent_metadata is None and METADATA_INTENT in metadata:
intent_metadata = metadata[METADATA_INTENT]

result.append(converted)

Expand Down

0 comments on commit 2cb06dd

Please sign in to comment.