Pyrrha is a simple Python Flask WebApp to fasten the post-correction of lemmatized and morpho-syntactic tagged corpora.
This web application and its maintenance is done by Julien Pilla (@MrGecko) and Thibault Clérice (@ponteineptique). As software is research please cite the software if you use it using the following informations:
@software{thibault_clerice_2019_3524771,
author = {Clérice, Thibault and Janès, Juliette and Pilla, Julien and Camps, Jean-Baptiste and Pinche, Ariane and Gille-Levenson, Matthias and Jolivet, Vincent},
title = {Pyrrha, A language independant post correction app for POS and lemmatization},
month = nov,
year = 2024,
publisher = {Zenodo},
version = {4.0.0},
doi = {10.5281/zenodo.2325427},
url = {https://doi.org/10.5281/zenodo.2325427}
}You can find a set of projects and papers that used us in the examples.bib file.
From the root directory, run:
pybabel compile -d translations
Start by cloning the repository, and moving inside the created folder
git clone https://github.com/hipster-philology/pyrrha.git
cd pyrrha/Create a virtual environment, source it, and run:
pip install -r requirements.txt
python manage.py --config dev db-createpython manage.py --config dev run- Run the application
- Click register and register. Remember to note the user email you register with.
- Stop the application
- Run
python manage.py edit-user [EMAIL] --confirm-mail --role Administratoror simplypython manage.py edit-user [EMAIL] --confirm-mailif you don't want administrator role. Replace[EMAIL]with the mail you used. If you are simply running it for yourself, we would definitely recommend to use the Administrator role though. - Run the application, login and enjoy !
From the root directory, run:
python manage.py translate compile
If you changed the template or variables
python manage.py translate update
# Change the translation and then do
python manage.py translate compileIf you want to add a language
python manage.py translate init fr
python manage.py translate update
python manage.py translate compileAll commands are run via manage.py. Pass --config <name> to select the
environment — dev (default), prod, or test.
python manage.py --config <env> <command> [options]
| Command | Description |
|---|---|
db-create |
Create the database (if it doesn't exist) and apply all Alembic migrations. Run this once on a fresh install. |
db-recreate |
Drop and recreate the database. Destroys all data — do not use in production. |
db-fixtures |
Load demo corpora (Wauchier, Floovant) for local testing. |
Pyrrha uses Alembic (via Flask-Migrate) for schema versioning. All db-migrate / db-upgrade commands below wrap Alembic.
| Command | Description |
|---|---|
db-migrate -m "message" |
Auto-generate a new migration from model changes. Review the generated file in migrations/versions/ before applying. |
db-upgrade [--revision head] |
Apply all pending migrations (default: up to head). |
db-downgrade [--revision -1] |
Revert migrations (default: one step back). |
db-current |
Show the currently applied revision. |
db-history |
List all migrations and their status. |
db-stamp <revision> |
Mark the database as being at revision without running any SQL. Use head when onboarding an existing database that was created before Alembic was introduced — this tells Alembic "the schema is already current". |
Typical development workflow for a schema change:
# 1. Edit the model in app/models/
# 2. Generate the migration
python manage.py --config dev db-migrate -m "Add gloss column to word_token"
# 3. Review migrations/versions/<hash>_add_gloss_column_to_word_token.py
# 4. Apply it
python manage.py --config dev db-upgradeOnboarding an existing production database:
# Run once after upgrading to a version that introduced Alembic
python manage.py --config prod db-stamp head
# From now on, use db-upgrade for all future schema changes
python manage.py --config prod db-upgradepython manage.py --config prod db-dump /backups/pyrrha_$(date +%Y%m%d).dumpFor PostgreSQL, this calls pg_dump --format=custom and writes a binary dump
that can be restored with pg_restore. For SQLite, it copies the database file.
| Command | Description |
|---|---|
corpus-list |
List all corpora with their IDs. |
corpus-from-file NAME --corpus FILE [--lemma FILE] [--POS FILE] [--morph FILE] [--left N] [--right N] |
Create a corpus from a TSV token file plus optional allowed-value lists. |
corpus-from-dir NAME <dir> |
Create a corpus from a directory containing tokens.csv, allowed_lemma.txt, allowed_pos.txt, allowed_morph.csv. |
corpus-dump <ID> --path <dir> |
Export a corpus (tokens + allowed values) to a directory. Use corpus-list to find the ID. |
# Confirm email and grant Administrator role
python manage.py edit-user someone@example.com --confirm-mail --role Administrator
# Confirm email only
python manage.py edit-user someone@example.com --confirm-mail- See Contribute.md
- Thibault Clérice
- Juliette Janès
- Lungsang-bod
- Jean-Baptiste Camps
- Ariane Pinche
- Vincent Jolivet
- ngawangtrinley
- FrFerry
- saisiddhant12
- jhrdt
- AdityaJ7
This app is wished to be simple and local at the moment (No User system). But to keep in the abilities to extend and use other systems, we based some of our decisions on https://github.com/hack4impact/flask-base/ and the general structure is following theirs.
