Metadata-Version: 2.1
Name: frhyme
Version: 0.2
Summary: Guess the last phonemes of a French word
Home-page: https://gitlab.com/a3nm/frhyme
Author: Antoine Amarilli
Author-email: a3nm@a3nm.net
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown

frhyme -- a toolkit to guess the last phonemes of a French word
Copyright (C) 2011-2019 by Antoine Amarilli
Repository URL: https://gitlab.com/a3nm/frhyme

== 0. Licence ==

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

== 1. Features ==

frhyme is a tool to guess what the last phonemes of a French word are.
It is trained on a list of words with associated pronunciation, and will
infer a few likely possibilities for unseen words using known words with
the longest common prefix, using a trie for internal representation.

== 2. Usage ==

To avoid licensing headaches, and because the data file is quite big, no
pronunciation data is included, you have to generate it yourself. See section 3.

Once you have pronunciation data ready in frhyme.json, you can either run
frhyme.py [NBEST], giving one word per line in stdin and getting the NBEST top
pronunciations on stdout (default is 5), or you can import it in a Python file
and call frhyme.lookup(word, NBEST) which returns the NBEST top pronunciations
(default is 5).

The pronunciations returned are annotated with a confidence score (the number of
occurrences in the training data). They should be sensible up to the longest
prefix occurring in the training data, but may be prefixed by garbage.

== 3. Training ==

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

The data used by frhyme.py is loaded at runtime from the fryme.json file which
should be trained from a pronunciation database. The recommended way to do so is
to use a tweaked Lexique <http://lexique.org> along with a provided bugfix file,
as follows:

  cd scripts
  lexique/lexique_retrieve.sh > lexique.txt
  ./make.sh NPHON lexique.txt additions > ../frhyme/frhyme.json
  cd ..

where NPHON is the number of trailing phonemes to keep (suggested value: 4).
Beware, this may take up several hundred megabytes of RAM. The resulting file
should be accurate on the French words of Lexique, and will return
pronunciations in a variant of X-SAMPA which ensures that each phoneme is mapped
to exactly one ASCII character: the substitutions are "A~" => "#", "O~" => "$",
"E~" => ")", "9~" => "(".



