spacy-to-naf is a spaCy wrapper that converts text or
NAF input to NAF.
The converter minimally extracts a tokenized text layer, and can additionally extract terms, deps, entities and
chunks layers.
Installation
To install spacy-to-naf:
pip install spacy-to-naf
Download a spaCy model, eg. 'en-core-web-sm':
python -m spacy download en-core-web-sm
Usage
Specify the spaCy model and the NAF layers to create (the text layer is always created).
from spacy_to_naf.converter import Converter
converter = Converter('en-core-web-sm', add_terms=True, add_deps=True, add_entities=True, add_chunks=True)
The input may be a naf or text directory or a text string.
Text input
To convert text to a file 'example.naf' in the current directory:
text = "The cat sat on the mat. Felix was his name."
naf = converter.convert(text, 'example.naf', '.')
The converter additionally returns a NafParser object for further processing.
Processing files
To process text files from a 'text_in' to 'naf_out' directory:
converter.convert_text_files('text_in', 'naf_out')
Note that input text files are expected to end in '.txt'.
To process NAF files from 'naf_in' to 'naf_out':
converter.convert_naf_files('naf_in', 'naf_out')
Output files carry the same name as the input file, extension excepted.
Metadata
Release files for spacy-to-naf 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spacy-to-naf-0.2.0.tar.gz | 8.6 kB | Without provenance | Details for spacy-to-naf-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spacy_to_naf-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for spacy_to_naf-0.2.0-py3-none-any.whl |
Total release size: 17.5 kB
Release files / spacy-to-naf-0.2.0.tar.gz
| Download URL | spacy-to-naf-0.2.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96fe6100a2bfb2177bb5b1f345411315f256851c04cb4b90cf03f1b0f06b1225
|
|
BLAKE2b-256 checksum How to use checksums |
5762e1ed71623f7ff422ce2fdf21a313e1cbc31223a4cfa530639b7304d67dad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.0
|
Release files / spacy_to_naf-0.2.0-py3-none-any.whl
| Download URL | spacy_to_naf-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bc054fa48ad797f22ac6a4b1e8f444a60a33cf7f51ed175a8fd7ad02964f0ca
|
|
BLAKE2b-256 checksum How to use checksums |
cdd052cbc299900de98235a518f150d048df9a86b15dfcd6a6862b41741a809d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.0
|
Security for spacy-to-naf 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.