How to use the nlu.test.EntityEvaluationResult function in nlu

To help you get started, we’ve selected a few nlu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RasaHQ / rasa / ner-evaluation / evaluation / evaluate_flair.py View on Github external
predicted_entities = []
        for s in spans:
            predicted_entities.append(
                {
                    "value": s.text,
                    "start": s.start_pos,
                    "end": s.end_pos,
                    "entity": s.tag,
                    "extractor": "flair",
                    "confidence": s.score,
                }
            )

        entity_results.append(
            EntityEvaluationResult(
                ex.get("entities", []), predicted_entities, result.get("tokens", [])
            )
        )

    if entity_results:
        extractors = ["flair"]
        return evaluate_entities(entity_results, set(extractors), None)["flair"]

    return {}