mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 01:04:34 +03:00
Fix lemmatizer
This commit is contained in:
parent
8805966460
commit
34651c8ddf
|
@ -48,6 +48,11 @@ class Lemmatizer(object):
|
||||||
avoid lemmatization entirely.
|
avoid lemmatization entirely.
|
||||||
"""
|
"""
|
||||||
morphology = {} if morphology is None else morphology
|
morphology = {} if morphology is None else morphology
|
||||||
|
morphology = dict(morphology)
|
||||||
|
for key, value in list(morphology.items()):
|
||||||
|
if value is True:
|
||||||
|
feat, value = key.split('_')
|
||||||
|
morphology[feat] = value
|
||||||
others = [
|
others = [
|
||||||
key
|
key
|
||||||
for key in morphology
|
for key in morphology
|
||||||
|
@ -68,13 +73,13 @@ class Lemmatizer(object):
|
||||||
return True
|
return True
|
||||||
elif univ_pos == "adj" and morphology.get("Degree") == "pos":
|
elif univ_pos == "adj" and morphology.get("Degree") == "pos":
|
||||||
return True
|
return True
|
||||||
elif VerbForm_inf in morphology or 'VerbForm_inf' in morphology:
|
elif morphology.get('VerbForm') == 'inf':
|
||||||
return True
|
return True
|
||||||
elif VerbForm_none in morphology or 'VerbForm_none' in morphology:
|
elif morphology.get('VerbForm') == 'none':
|
||||||
return True
|
return True
|
||||||
elif Number_sing in morphology or 'Number_sing' in morphology:
|
elif morphology.get('VerbForm') == 'inf':
|
||||||
return True
|
return True
|
||||||
elif Degree_pos in morphology or 'Degree_pos' in morphology:
|
elif morphology.get('Degree') == 'pos':
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user