Instructions to use magepol/en_tech with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- spaCy
How to use magepol/en_tech with spaCy:
!pip install https://huggingface.co/magepol/en_tech/resolve/main/en_tech-any-py3-none-any.whl # Using spacy.load(). import spacy nlp = spacy.load("en_tech") # Importing as module. import en_tech nlp = en_tech.load() - Notebooks
- Google Colab
- Kaggle
Download custom_functions.py from magepol/en_tech: direct link, hf CLI and curl.
- Browser
- Download file 914 Bytes
-
https://huggingface.co/magepol/en_tech/resolve/main/custom_functions.py
- Command line
-
hf download hf://magepol/en_tech/custom_functions.py
-
curl -L -o custom_functions.py https://huggingface.co/magepol/en_tech/resolve/main/custom_functions.py
914 Bytes
| import spacy | |
| from spacy.tokenizer import Tokenizer | |
| def create_custom_tokenizer(): | |
| def create_tokenizer(nlp): | |
| infixes = nlp.Defaults.infixes + [ | |
| r"/", | |
| r"-", | |
| r",", | |
| r":", | |
| r"\+", | |
| ] | |
| prefixes = nlp.Defaults.prefixes + [ | |
| r"-", | |
| r"\(", | |
| ] | |
| suffixes = nlp.Defaults.suffixes + [ | |
| r"\)", | |
| r"-", | |
| ] | |
| prefix_regex = spacy.util.compile_prefix_regex(prefixes) | |
| infix_regex = spacy.util.compile_infix_regex(infixes) | |
| suffix_regex = spacy.util.compile_suffix_regex(suffixes) | |
| return Tokenizer( | |
| nlp.vocab, | |
| infix_finditer=infix_regex.finditer, | |
| prefix_search=prefix_regex.search, | |
| suffix_search=suffix_regex.search, | |
| ) | |
| return create_tokenizer | |