Update tokenization_openai.py

This commit is contained in:
Guillem García Subies 2019-08-20 14:10:19 +02:00 committed by GitHub
parent bb04446285
commit 562b998366
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,6 +92,7 @@ class OpenAIGPTTokenizer(PreTrainedTokenizer):
from spacy.lang.en import English
_nlp = English()
self.nlp = nlp.Defaults.create_tokenizer(_nlp)
self.fix_text = ftfy.fix_text
except ImportError:
logger.warning("ftfy or spacy is not installed using BERT BasicTokenizer instead of SpaCy & ftfy.")
self.nlp = BasicTokenizer(do_lower_case=True)