From 59ef064202e177281a72c0fd10f1bfe016de2dd7 Mon Sep 17 00:00:00 2001 From: Sergey Teplyakov Date: Thu, 12 Nov 2020 18:21:18 +0300 Subject: [PATCH] Add annotations to return values --- {{cookiecutter.project_slug}}/app/spacy_extractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/app/spacy_extractor.py b/{{cookiecutter.project_slug}}/app/spacy_extractor.py index 4da3b9d..81e0f23 100644 --- a/{{cookiecutter.project_slug}}/app/spacy_extractor.py +++ b/{{cookiecutter.project_slug}}/app/spacy_extractor.py @@ -26,14 +26,14 @@ def __init__( self.input_id_col = input_id_col self.input_text_col = input_text_col - def _name_to_id(self, text: str): + def _name_to_id(self, text: str) -> str: """Utility function to do a messy normalization of an entity name text (str): text to create "id" from """ return "-".join([s.lower() for s in text.split()]) - def extract_entities(self, records: List[Dict[str, str]]): + def extract_entities(self, records: List[Dict[str, str]]) -> List[dict]: """Apply the pre-trained model to a batch of records records (list): The list of "document" dictionaries each with an