INNER CODE UNIT · Python

_create_examples_from_doc

dragondrop-cloud/cloud-concierge · nlpengine/main.py:104

def _create_examples_from_doc(
    nlp: spacy.Language, current_cat: str, doc: str, categories: List[str]
) -> List[Example]:
    """
    Create a list of Spacy examples from the doc string.
    """
    doc_examples = []

    example_text_list = _doc_to_example_text_list(doc)

    gold_dict = _create_gold_dict(current_cat=current_cat, categories=categories)

    for example_text in example_text_list:
        doc = nlp(example_text)
        current_example = Example.from_dict(doc, gold_dict)
        doc_examples.append(current_example)

    if len(example_text_list) >= 5:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…