Instructions to use Sefaria/en_torah_ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- spaCy
How to use Sefaria/en_torah_ner with spaCy:
!pip install https://huggingface.co/Sefaria/en_torah_ner/resolve/main/en_torah_ner-any-py3-none-any.whl # Using spacy.load(). import spacy nlp = spacy.load("en_torah_ner") # Importing as module. import en_torah_ner nlp = en_torah_ner.load() - Notebooks
- Google Colab
- Kaggle
Download spacy_function_registry.py from Sefaria/en_torah_ner: direct link, hf CLI and curl.
- Browser
- Download file 896 Bytes
-
https://huggingface.co/Sefaria/en_torah_ner/resolve/main/spacy_function_registry.py
- Command line
-
hf download hf://Sefaria/en_torah_ner/spacy_function_registry.py
-
curl -L -o spacy_function_registry.py https://huggingface.co/Sefaria/en_torah_ner/resolve/main/spacy_function_registry.py
896 Bytes
| import spacy, re | |
| from spacy.tokenizer import Tokenizer | |
| """ | |
| python -m spacy package general_en packages -c /Users/nss/sefaria/project/sefaria/spacy_function_registry.py -b wheel,sdist -n torah_ner -v 1.0.0 | |
| """ | |
| def inner_punct_tokenizer_factory(): | |
| def inner_punct_tokenizer(nlp): | |
| # infix_re = spacy.util.compile_infix_regex(nlp.Defaults.infixes) | |
| infix_re = re.compile(r'''[.,?!:;…‘’`“”"'~–\-/()<>]''') | |
| prefix_re = spacy.util.compile_prefix_regex(nlp.Defaults.prefixes) | |
| suffix_re = spacy.util.compile_suffix_regex(nlp.Defaults.suffixes) | |
| return Tokenizer(nlp.vocab, prefix_search=prefix_re.search, | |
| suffix_search=suffix_re.search, | |
| infix_finditer=infix_re.finditer, | |
| token_match=None) | |
| return inner_punct_tokenizer |