French poetry validator
Project description
plint -- a French poetry validator Copyright (C) 2011-2019 by Antoine Amarilli Repository URL: https://gitlab.com/a3nm/plint
== 0. Licence ==
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program (see file "COPYING"). If not, see http://www.gnu.org/licenses/.
bottle.py is a third-party file, its license is in file LICENSE_bottle.
test/boileau and test/andromaque are from Wikisource and test/baudelaire and test/mithridate are from Project Gutenberg. Both of them are in the public domain.
== 1. Features ==
plint is a tool to check French poetry. Specifically, it validates metric, rhymes and rhyme genres against an unexpressive template language. It features a command-line interface, an IRC wrapper (for use with irctk) and a web interface. It depends on haspirater https://gitlab.com/a3nm/haspirater and frhyme https://gitlab.com/a3nm/frhyme, and the web interface requires CherryPy.
The full documentation of plint's features is available in views/about.html.
== 2. Getting started ==
This section provides a quick summary of how to get started with setting up and using plint. If these instructions do not work for you, please let me know.
- Basic setup
Make sure that you have a working python3 installation and that you have unzip (Debian packages: python3, unzip).
- Clone the plint repository
If you haven't done so already:
git clone https://gitlab.com/a3nm/plint.git cd plint
- Retrieve the dependencies
In the directory where plint has been cloned, run:
git clone https://gitlab.com/a3nm/frhyme.git git clone https://gitlab.com/a3nm/haspirater.git
- Generate frhyme.json
Run:
cd frhyme lexique/lexique_retrieve.sh > lexique.txt ./make.sh 4 lexique.txt additions > frhyme.json cd ..
- Generate the occurrences file
Run:
./lexique_occurrences_retrieve.sh > data/occurrences
- Locales
For locale support, install gettext (Debian package: gettext) and run:
make
- Running plint
If you want to check a poem that consists of classical alexandrines with flat rhyme (like the file test/mithridate), write the contents of the poem to check into a file poem.txt. Then run:
./plint.py test/mithridate.tpl < poem.txt
Plint will display the errors (if any) and exit.
- Customizing the template
If you want to customize the template of the poem, you can look at examples on the online tool (https://plint.a3nm.net/fr/) or files ending in ".tpl" in the source repository. You can then write your template into a file called template.tpl and run:
./plint.py template.tpl < poem.txt
The file format for templates is tersely documented on https://plint.a3nm.net/en/about#template
== 3. Detailed usage ==
To use the program's command-line interface, run:
./plint.py TEMPLATE
where TEMPLATE is the template file, and provide the poem on stdin. Errors are reported on stderr.
To run the web interface on port 5000, run plint_web.py. CherryPy is required (but the code is easy to adapt), see http://bottlepy.org/docs/dev/tutorial.html#deployment Beware, if you use CherryPy under Debian, simply installing python-cherrypy3 might not work ("no module named cherrypy"). In this case, you need to install CherryPy by hand from source (sudo python3 setup.py install).
An undocumented IRC interface for use with irctk is available (plint_irc.py). The poem that it produces can be compiled to HTML automatically using something along the lines of:
while true do inotifywait poem_file # www/ should contain style.css poem2html/make_poem.sh poem_file > www/poem.html done
To run plint on some provided test files, you can use test.sh. However, because of known bugs, some errors will be reported on the test files. To run a very simple test suite, run ./versetest.py; they should all pass.
== 4. Training ==
The diaeresis pattern "diaeresis.json" is trained by calling
./train_diaeresis.sh > data/diaeresis.json
You can also train a specific pattern for Cyrano de Bergerac with:
./train_diaeresis.sh _full ../additions_cyrano > data/diaeresis_cyrano.json
This is currently undocumented. The plint folder should contain a copy of the haspirater code (possibly as a symlink) in "haspirater/".
== 5. Updating the localization ==
When the code is changed, to update the localization information to French, do:
cd plint pygettext *.py ../plint.py msgmerge -U res/messages_fr.po messages.pot poedit res/messages_fr.po cd .. make
== 6. Related work ==
- http://pentametron.com/
- http://virga.org/cvf/alexanql.php
- http://hal.archives-ouvertes.fr/docs/00/37/73/48/PDF/1.Rythme_et_rime_de_l_alexandrin_classique_-_V_Beaudouin_2000.pdf
- http://www.oulipo.net/docannexe/file/16251/MetreenregleRFLA-Beaudouin200405.pdf
- http://images.math.cnrs.fr/Je-demeurai-longtemps-errant-dans.html
- Beaudouin V. & Yvon F. (1996). "The Metrometer : a Tool for Analysing French Verse", Literary & Linguistic Computing, vol. 11, n°1, p. 23-32.
- http://corpus.revues.org/290
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 Distributions
Built Distribution
File details
Details for the file plint-0.1-py3-none-any.whl
.
File metadata
- Download URL: plint-0.1-py3-none-any.whl
- Upload date:
- Size: 432.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 772f7c6bbbdf70a33f003fd97d04b6519e0b9844308ada8633066244db726003 |
|
MD5 | db64daac78a74e373cfa8c8c03a46224 |
|
BLAKE2b-256 | 843f67d8fad46f27d0484429ff2a0fb0b89e8f0bb00020e26620ee7921b89b8e |