spaCy pipeline for crfsuite entity extraction
Project description
spacy_crfsuite: crfsuite entity extraction for spaCy.
spacy_crfsuite
is an entity extraction pipeline for spaCy based .
Install
Python
pip install spacy_crfsuite
Usage
Spacy usage
import os
import spacy
from spacy_crfsuite import CRFEntityExtractorFactory
# load spacy language model
nlp = spacy.blank('en')
# Will look for ``crf.pkl`` in current working dir
pipe = CRFEntityExtractorFactory(nlp, model_dir=os.getcwd())
nlp.add_pipe(pipe)
# Use CRF to extract entities
doc = nlp("given we launched L&M a couple of years ago")
for ent in doc.ents:
print(ent.text, "--", ent.label_)
Train a model
python -m spacy_crfsuite.trainer train <TRAIN> --model-dir <MODEL_DIR> --model-name <MODEL_NAME>
Evaluate a model
python -m spacy_crfsuite.trainer eval <DEV> --model-dir <MODEL_DIR> --model-name <MODEL_NAME>
Gold annotations example (markdown)
## Header
- what is my balance <!-- no entity -->
- how much do I have on my [savings](source_account) <!-- entity "source_account" has value "savings" -->
- how much do I have on my [savings account](source_account:savings) <!-- synonyms, method 1-->
- Could I pay in [yen](currency)? <!-- entity matched by lookup table -->
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spacy_crfsuite-0.1.1.tar.gz
(13.6 kB
view hashes)
Built Distribution
Close
Hashes for spacy_crfsuite-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6be20ebe4388e901324eaf9d10557fd7d4b7a84455b00434124d03b4235c7bb0 |
|
MD5 | 08c5a2e7a2272fad7bade924046ace5a |
|
BLAKE2b-256 | fa1f19c073883ac4b7a40ceb0833622368d5d6b64b50c11590e1e9539bee22fe |