File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,7 @@ def _prepare_cache_filepath(filepath):
268268 raise RuntimeError ("The cache_file_path must be a file, not a directory." )
269269 cache_dir = os .path .dirname (_cache_filepath )
270270 if not os .path .exists (cache_dir ):
271- os .makedirs (cache_dir )
271+ os .makedirs (cache_dir , exist_ok = True )
272272
273273
274274def cache_results (_cache_fp , _refresh = False , _verbose = 1 ):
Original file line number Diff line number Diff line change 1212from ...core .const import Const
1313from ...core .vocabulary import Vocabulary
1414from ...core ._logger import logger
15+ from pkg_resources import parse_version
1516
1617
1718def iob2 (tags : List [str ]) -> List [str ]:
@@ -82,7 +83,10 @@ def get_tokenizer(tokenize_method: str, lang='en'):
8283 spacy .prefer_gpu ()
8384 if lang != 'en' :
8485 raise RuntimeError ("Spacy only supports en right right." )
85- en = spacy .load (lang )
86+ if parse_version (spacy .__version__ ) >= parse_version ('3.0' ):
87+ en = spacy .load ('en_core_web_sm' )
88+ else :
89+ en = spacy .load (lang )
8690 tokenizer = lambda x : [w .text for w in en .tokenizer (x )]
8791 elif tokenize_method in tokenizer_dict :
8892 tokenizer = tokenizer_dict [tokenize_method ]
You can’t perform that action at this time.
0 commit comments