in src/classes/answer.py [0:0]
def _select_answer_type(self):
"""Assigns this Answer a category/type. This type is used by substitution functions to
ensure the resulting substitution is coherent, or type-preserving.
NB: This function can be edited by the user if they have their own NER model, or another
set of answer types / substitutions they wish to analyze.
"""
answer_type = None
if self.ner_label == "PERSON":
answer_type = "PERSON"
elif self.ner_label == "DATE" or (
self.ner_label == "CARDINAL" and "year" in self.wikidata_types
):
answer_type = "DATE"
elif self.ner_label in ["CARDINAL", "QUANTITY"]:
answer_type = "NUMERIC"
elif self.ner_label in ["GPE", "LOC"]:
answer_type = "LOCATION"
elif self.ner_label == "ORG":
answer_type = "ORGANIZATION"
return answer_type