Skip to content

Commit

Permalink
Remove is_base_form from French lemmatizer (#5733)
Browse files Browse the repository at this point in the history
Remove English-specific is_base_form from French lemmatizer.
  • Loading branch information
adrianeboyd authored Jul 9, 2020
1 parent 3d83721 commit 923affd
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions spacy/lang/fr/lemmatizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ def __call__(self, string, univ_pos, morphology=None):
univ_pos = "sconj"
else:
return [self.lookup(string)]
# See Issue #435 for example of where this logic is requied.
if self.is_base_form(univ_pos, morphology):
return list(set([string.lower()]))
index_table = self.lookups.get_table("lemma_index", {})
exc_table = self.lookups.get_table("lemma_exc", {})
rules_table = self.lookups.get_table("lemma_rules", {})
Expand All @@ -59,43 +56,6 @@ def __call__(self, string, univ_pos, morphology=None):
)
return lemmas

def is_base_form(self, univ_pos, morphology=None):
"""
Check whether we're dealing with an uninflected paradigm, so we can
avoid lemmatization entirely.
"""
morphology = {} if morphology is None else morphology
others = [
key
for key in morphology
if key not in (POS, "Number", "POS", "VerbForm", "Tense")
]
if univ_pos == "noun" and morphology.get("Number") == "sing":
return True
elif univ_pos == "verb" and morphology.get("VerbForm") == "inf":
return True
# This maps 'VBP' to base form -- probably just need 'IS_BASE'
# morphology
elif univ_pos == "verb" and (
morphology.get("VerbForm") == "fin"
and morphology.get("Tense") == "pres"
and morphology.get("Number") is None
and not others
):
return True
elif univ_pos == "adj" and morphology.get("Degree") == "pos":
return True
elif VerbForm_inf in morphology:
return True
elif VerbForm_none in morphology:
return True
elif Number_sing in morphology:
return True
elif Degree_pos in morphology:
return True
else:
return False

def noun(self, string, morphology=None):
return self(string, "noun", morphology)

Expand Down

0 comments on commit 923affd

Please sign in to comment.