intent_name = stem[7:]
if not intent_name:
raise IntentFormatError("Intent name must not be empty")
dataset = cls(intent_name)
with filepath.open(encoding="utf-8") as f:
lines = iter(l.strip() for l in f if l.strip())
dataset.add_utterances(lines)
return dataset
def add_utterances(self, samples_iter):
for sample in samples_iter:
utterance = IntentUtterance.parse(sample)
After Change
raise IntentFormatError("Intent name must not be empty")
with filepath.open(encoding="utf-8") as f:
lines = iter(l.strip() for l in f if l.strip())
utterances = [IntentUtterance.parse(sample) for sample in lines]
return cls(intent_name, utterances)
def _complete_slot_name_mapping(self):
for utterance in self.utterances:
for chunk in utterance.slot_chunks: