Skip to content

Commit

Permalink
continue to fix for the issue facebookresearch#101 .
Browse files Browse the repository at this point in the history
  • Loading branch information
dfenglei committed Mar 28, 2018
1 parent 60fcf0b commit a9f3385
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drqa/tokenizers/spacy_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, **kwargs):
model = kwargs.get('model', 'en')
self.annotators = copy.deepcopy(kwargs.get('annotators', set()))
nlp_kwargs = {'parser': False}
if ('lemma' not in self.annotators) and ('pos' not in self.annotators) and ('ner' not in self.annotators):
if not any([p in self.annotators for p in ['lemma', 'pos', 'ner']]):
nlp_kwargs['tagger'] = False
if 'ner' not in self.annotators:
nlp_kwargs['entity'] = False
Expand All @@ -35,7 +35,7 @@ def tokenize(self, text):
# We don't treat new lines as tokens.
clean_text = text.replace('\n', ' ')
tokens = self.nlp.tokenizer(clean_text)
if ('lemma' in self.annotators) or ('pos' in self.annotators) or('ner' in self.annotators) :
if any([p in self.annotators for p in ['lemma', 'pos', 'ner']]):
self.nlp.tagger(tokens)
if 'ner' in self.annotators:
self.nlp.entity(tokens)
Expand Down

0 comments on commit a9f3385

Please sign in to comment.