Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/app/spacy_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down