Skip to main content

Spacy-to-FoliA

https://travis-ci.com/proycon/foliapy.svg?branch=master http://applejack.science.ru.nl/lamabadge.php/spacy2folia

Convert Spacy output to FoLiA XML Documents. Also supports FoLiA input.

Installation

$ pip install spacy2folia

You also need to install the spacy models you want like:

python -m spacy download en_core_web_sm

Usage Example

Using the command line tool on an input file named test.txt:

$ spacy2folia --model en_core_web_sm test.txt

This results in a document test.folia.xml in the current working directory.

You can also invoke the command line tool on one or more FoLiA documents as input:

$ spacy2folia --model en_core_web_sm document.folia.xml

The output file will be written to the currrent working directory (so it may overwirte the input if it’s in the same directory!)

Usage from Python:

import spacy
from spacy2folia import spacy2folia

text = "Input text goes here"

nlp = spacy.load("en_core_web_sm")
doc = nlp(text)
foliadoc = spacy2folia.convert(doc, "example", paragraphs=True)
foliadoc.save("/tmp/output.folia.xml")

Usage from Python with FoLiA input:

import spacy
import folia.main as folia
from spacy2folia import spacy2folia

foliadoc = folia.Document(file="/tmp/input.folia.xml")
nlp = spacy.load("en_core_web_sm")
spacy2folia.convert_folia(foliadoc, nlp)
foliadoc.save("/tmp/output.folia.xml")

Metadata

Release files for Spacy2FoLiA 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Spacy2FoLiA 0.3.4
File Size Uploaded
Spacy2FoLiA-0.3.4.tar.gz 5.6 kB Details

Release files / Spacy2FoLiA-0.3.4.tar.gz

Download URL Spacy2FoLiA-0.3.4.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ef983c93f5809677cd2a46602e4440ccf4cf3a270a35bed1c18d3d0280d8e275
BLAKE2b-256 checksum
How to use checksums
b3331039e2309a400283602fb95d65045f4f9c0bf6e821ebfd45eacf40277dcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.3.4 This release

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page