Metadata-Version: 2.4
Name: pie_extended
Version: 2.0.1
Summary: Extension for nlp-pie package
Author: Thibault Clérice
License-Expression: MIT
Project-URL: Homepage, https://github.com/hipster-philology/pie-extended
Project-URL: Documentation, https://hipster-philology.github.io/pie-extended/
Project-URL: Source, https://github.com/hipster-philology/pie-extended
Project-URL: Issues, https://github.com/hipster-philology/pie-extended/issues
Project-URL: Changelog, https://github.com/hipster-philology/pie-extended/blob/main/CHANGES.md
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PaPie>=1.0.0
Requires-Dist: colorama>=0.4.4
Requires-Dist: click>=7.0
Requires-Dist: requests>=2.25
Requires-Dist: unidecode>=1.1.1
Requires-Dist: regex
Requires-Dist: numpy
Provides-Extra: grecy
Requires-Dist: spacy>=3.7; extra == "grecy"
Requires-Dist: spacy-transformers; extra == "grecy"
Requires-Dist: grecy; extra == "grecy"
Provides-Extra: soter
Requires-Dist: transformers; extra == "soter"
Requires-Dist: spacy>=3.7; extra == "soter"
Requires-Dist: grecy; extra == "soter"
Provides-Extra: docs
Requires-Dist: sphinx>=7.2; extra == "docs"
Requires-Dist: furo; extra == "docs"
Requires-Dist: myst-parser>=3.0; extra == "docs"
Requires-Dist: sphinx-copybutton; extra == "docs"
Requires-Dist: sphinx-click>=5.1; extra == "docs"
Dynamic: license-file

# Pie Extended

[![Tests](https://github.com/hipster-philology/pie-extended/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/hipster-philology/pie-extended/actions/workflows/test.yml)
[![Documentation](https://github.com/hipster-philology/pie-extended/actions/workflows/docs.yml/badge.svg?branch=main)](https://hipster-philology.github.io/pie-extended/)
[![PyPI](https://img.shields.io/pypi/v/pie-extended?style=flat-square)](https://pypi.org/project/pie-extended/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3883589.svg)](https://doi.org/10.5281/zenodo.3883589)

Extension for [Pie](https://github.com/emanjavacas/pie) (its models run with [PaPie 1.0](https://github.com/DEFI-COLaF/pie-thunder)) to
include taggers with their models and pre/postprocessors: normalization, tokenization, disambiguation, output
formatting. The person who gets a model tags a text in one command and gets the output its authors intended.

**Documentation: <https://hipster-philology.github.io/pie-extended/>**

## Quick start

Python 3.12 or later is needed.

```bash
pip install pie-extended --extra-index-url https://download.pytorch.org/whl/cpu   # the extra index: no GPU needed
pie-extended list                                  # the available models
pie-extended download lasla                        # the model, from Hugging Face (it is also downloaded when first used)
pie-extended tag lasla your_file.txt --tasks lemma,pos
pie-extended tag biblissima-textes/papie-latin#morph your_file.txt --disable-tasks morph   # a model of Hugging Face, by its name
```

The output is written next to the file (`your_file-pie.txt`): a TSV with one line per token.

```text
token       lemma  pos     SpaceAfter
Arma        arma   NOMcom  _
uirumque    uir    NOMcom  No
{uirumque}  que    CON     _
cano        cano   ADJqua  No
```

From Python:

```python
from pie_extended.cli.utils import get_tagger, get_pipeline

tagger = get_tagger("lasla", tasks=["lemma", "pos"])
iterator, processor = get_pipeline("lasla", tagger)
print(tagger.tag_str("Arma uirumque cano", iterator=iterator, processor=processor))
```

## Models

Latin, Ancient Greek, Old, Middle and Early Modern French, Middle Dutch, Occitan, Old Castilian (placeholder)
and Eastern, Western and Classical Armenian. Some of them run through spaCy ([GreCy](https://github.com/jmyerston/greCy)), and some combine engines: the lemma of
Ancient Greek from [Sôtêr](https://huggingface.co/Zual/soter-mini), the part of speech from a spaCy pipeline.
The documentation lists them, with what is specific to each.

If you trained models and want some help sharing them with Pie Extended, open an issue :)

## Documentation

| | |
|---|---|
| [Presentation](https://hipster-philology.github.io/pie-extended/) | What Pie Extended does |
| [Install](https://hipster-philology.github.io/pie-extended/install.html) | The package and the models |
| [Tagger usage](https://hipster-philology.github.io/pie-extended/tagger.html) | Tag files from a terminal |
| [API usage](https://hipster-philology.github.io/pie-extended/api-usage.html) | Tag from Python, build a pipeline |
| [Implement things](https://hipster-philology.github.io/pie-extended/extending.html) | Add a model, write a tokenizer or processors, learn a segmenter, add an engine, test them |
| [Migrate to 2.0](https://hipster-philology.github.io/pie-extended/migration.html) | From 1.x: what changes in the Python API, with the code before and after |
| [Backends](https://hipster-philology.github.io/pie-extended/backends.html) | PaPie 1.0, spaCy and composite backends: change the pipeline of a model, add a spaCy model |
| [API](https://hipster-philology.github.io/pie-extended/api/index.html) | Reference of the classes and functions |
| [Citation](https://hipster-philology.github.io/pie-extended/citation.html) | How to cite the software and the models |

To build it yourself: `pip install -e ".[docs]"`, then `make docs` (the result is in `docs/_build/html`).

## Cite as

```bibtex
@software{thibault_clerice_2020_3883590,
  author       = {Clérice, Thibault},
  title        = {Pie Extended, an extension for Pie with pre-processing and post-processing},
  month        = jun,
  year         = 2020,
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.3883589},
  url          = {https://doi.org/10.5281/zenodo.3883589}
}
```

Please also cite the models you use: see [Citation](https://hipster-philology.github.io/pie-extended/citation.html).
