/plint

poeme linter

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

plint -- a French poetry validator
Repository URL: https://gitlab.com/a3nm/plint
Online version: https://plint.a3nm.net/
Python package name: plint

== 0. Author and licence ==

plint is copyright (C) 2011-2019 by Antoine Amarilli

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/>.

The file "plint/data/occurrences" is a derivative work of the French lexical
database Lexique <http://www.lexique.org/>, version 3.83, by Boris New
<http://psycho-usmb.fr/boris.new/> and Christophe Pallier
<http://www.pallier.org/>. Hence, this file is under the same license as
Lexique, namely, the license CC BY SA 4.0 (according to the file
README-Lexique.txt in the downloadable archive of Lexique). The GNP GPL licence
does *not* apply to this file "plint/data/occurrences".

The files in plint/test_data are public domain works used to test and train
plint. Their sources are given in the file "SOURCES".

Many thanks to Julien Romero for contributing to the code and for maintaining
the PyPI package for plint and its dependencies.

== 1. Features ==

plint is a tool to check French poetry. Specifically, it validates metric,
rhymes and rhyme genres against an unexpressive template language. It has a
command-line interface.
It depends on haspirater <https://gitlab.com/a3nm/haspirater> and frhyme
<https://gitlab.com/a3nm/frhyme>.

There is also a Web interface for plint in
<https://gitlab.com/a3nm/plint_website>, available online on
https://plint.a3nm.net/. The full documentation of plint's features is available
in views/about.html of that repository, or on https://plint.a3nm.net/en/about.
There is also a repository of bonus content for plint in
https://a3nm.net/git/plint_extra.

== 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.

Plint has been packaged for Python and can now be installed by running 
"pip3 install plint". These instructions explain how to install it manually.

0. Basic setup

Make sure that you have a working python3 installation and that you have unzip
(Debian packages: python3, unzip).

1. Clone the plint repository

If you haven't done so already:

  git clone https://gitlab.com/a3nm/plint.git
  cd plint

2. 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

3. Locales

For locale support, install gettext (Debian package: gettext) and run:

  make

4. 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:

  python3 -m plint plint/test_data/mithridate.tpl < poem.txt

Plint will display the errors (if any) and exit.

5. 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:

  python3 -m plint 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:

  python3 -m plint TEMPLATE

where TEMPLATE is the template file, and provide the poem on stdin. Errors are
reported on stderr.

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 first cloning
haspirater in the main repository folder:

  git clone https://gitlab.com/a3nm/haspirater

and then calling:

  ./train_diaeresis/train_diaeresis.sh > plint/data/diaeresis.json

You can also train a specific pattern for _Cyrano de Bergerac_ with:

  ./train_diaeresis/train_diaeresis.sh _full ./train_diaeresis/additions_cyrano > plint/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. Occurrences file ==

This is how the file plint/data/occurrences is generated

Run:

  ./prepare_occurrences/lexique_occurrences_retrieve.sh > plint/data/occurrences


== 6. Updating the localization ==

When the code is changed, to update the localization information to French, do:

  cd plint
  pygettext *.py 
  msgmerge -U res/messages_fr.po messages.pot
  poedit res/messages_fr.po
  cd ..
  make

== 7. 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