Browse Source

delete get_tokenizer in fastNLP/io/utils.py

tags/v0.4.10
Yige Xu 5 years ago
parent
commit
86ba31b4cf
1 changed files with 0 additions and 12 deletions
  1. +0
    -12
      fastNLP/io/utils.py

+ 0
- 12
fastNLP/io/utils.py View File

@@ -76,15 +76,3 @@ def check_loader_paths(paths: Union[str, Dict[str, str]]) -> Dict[str, str]:
raise ValueError("Empty paths is not allowed.") raise ValueError("Empty paths is not allowed.")
else: else:
raise TypeError(f"paths only supports str and dict. not {type(paths)}.") raise TypeError(f"paths only supports str and dict. not {type(paths)}.")


def get_tokenizer():
try:
import spacy
spacy.prefer_gpu()
en = spacy.load('en')
logger.info('use spacy tokenizer')
return lambda x: [w.text for w in en.tokenizer(x)]
except Exception as e:
logger.error('use raw tokenizer')
return lambda x: x.split()

Loading…
Cancel
Save