diff --git a/hyphenate/.github/workflows/ci.yml b/hyphenate/.github/workflows/ci.yml new file mode 100644 index 00000000..1c2f24b9 --- /dev/null +++ b/hyphenate/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: CI + +on: [push, pull_request] + +jobs: + run: + name: "Build using Racket '${{ matrix.racket-version }}' (${{ matrix.racket-variant }})" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + racket-version: ["6.6", "6.7", "6.8", "6.9", "6.10.1", "6.11", "6.12", "7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "7.7", "7.8", "7.9", "current"] + racket-variant: ["BC", "CS"] + # CS builds are only provided for versions 7.4 and up so avoid + # running the job for prior versions. + exclude: + - {racket-version: "6.6", racket-variant: "CS"} + - {racket-version: "6.7", racket-variant: "CS"} + - {racket-version: "6.8", racket-variant: "CS"} + - {racket-version: "6.9", racket-variant: "CS"} + - {racket-version: "6.10.1", racket-variant: "CS"} + - {racket-version: "6.11", racket-variant: "CS"} + - {racket-version: "6.12", racket-variant: "CS"} + - {racket-version: "7.0", racket-variant: "CS"} + - {racket-version: "7.1", racket-variant: "CS"} + - {racket-version: "7.2", racket-variant: "CS"} + - {racket-version: "7.3", racket-variant: "CS"} + + steps: + - name: Checkout + uses: actions/checkout@master + + - uses: Bogdanp/setup-racket@v0.11 + with: + distribution: 'full' + version: ${{ matrix.racket-version }} + variant: ${{ matrix.racket-variant }} + + - name: Install hyphenate and its dependencies + run: raco pkg install --auto --batch + + - name: Run the tests + run: xvfb-run raco test -j 4 -p hyphenate diff --git a/hyphenate/.gitignore b/hyphenate/.gitignore new file mode 100644 index 00000000..dc9a8e24 --- /dev/null +++ b/hyphenate/.gitignore @@ -0,0 +1,18 @@ +# for Racket +compiled/ + +# for Mac OS X +.DS_Store +.AppleDouble +.LSOverride +Icon + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes +hyphenate/scribblings/hyphenate.html +hyphenate/scribblings/*.css +hyphenate/scribblings/*.js diff --git a/hyphenate/LGPL.txt b/hyphenate/LGPL.txt new file mode 100644 index 00000000..6600f1c9 --- /dev/null +++ b/hyphenate/LGPL.txt @@ -0,0 +1,165 @@ +GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/hyphenate/LICENSE b/hyphenate/LICENSE new file mode 100644 index 00000000..cd131165 --- /dev/null +++ b/hyphenate/LICENSE @@ -0,0 +1,3 @@ +Hyphenate +© 2014-2016 Matthew Butterick +Licensed under the LGPL (see "LGPL.txt") diff --git a/hyphenate/README.md b/hyphenate/README.md new file mode 100644 index 00000000..10dcf6dd --- /dev/null +++ b/hyphenate/README.md @@ -0,0 +1,33 @@ +## hyphenate ![Build Status](https://github.com/mbutterick/hyphenate/workflows/CI/badge.svg) + + +Racket implementation of the Knuth–Liang hyphenation algorithm. + +Install from the command line like so: + + raco pkg install hyphenate + +Later, you an update like so: + + raco pkg update hyphenate + +Import in standard mode: + + (require hyphenate) + +Or in safe mode (adds contracts): + + (require (submod hyphenate safe)) + +And enjoy: + + (hyphenate "Hyphenation algorithm" #\-) + + > "Hy-phen-ation al-go-rithm" + +Full docs are installed with the package. You can also [read the docs here](http://pkg-build.racket-lang.org/doc/hyphenate). + + +## Project status + +Complete. Maintained but no further updates planned. Once upon a time, I had an ambition to support more languages. But I don’t personally need that, and no one is clamoring for it. diff --git a/hyphenate/hyphenate/fr.rkt b/hyphenate/hyphenate/fr.rkt new file mode 100644 index 00000000..6aa78a98 --- /dev/null +++ b/hyphenate/hyphenate/fr.rkt @@ -0,0 +1,2 @@ +#lang s-exp "private/bootstrap.rkt" +fr \ No newline at end of file diff --git a/hyphenate/hyphenate/fr/exceptions.rkt b/hyphenate/hyphenate/fr/exceptions.rkt new file mode 100644 index 00000000..63c33bde --- /dev/null +++ b/hyphenate/hyphenate/fr/exceptions.rkt @@ -0,0 +1 @@ +#lang hyphenate/private/exception-prep \ No newline at end of file diff --git a/hyphenate/hyphenate/fr/patterns.rkt b/hyphenate/hyphenate/fr/patterns.rkt new file mode 100755 index 00000000..db0d6dbb --- /dev/null +++ b/hyphenate/hyphenate/fr/patterns.rkt @@ -0,0 +1,2884 @@ +#lang hyphenate/private/pattern-prep + + +;French hyphenation patterns +;Based on v.3.0 of the OpenOffice.org French hyphenation patterns, released under the LGPL +;Downloaded from http://www.dicollecte.org/download/fr/hyph-fr-v3.0.zip +; +;Original license: +;___________________________________________________________________ +; +; French word hyphenation patterns +; Version 3.0 +; +; Language: French (fr). +; +; License: GNU LGPL. +; +; Origin: Based on the TeX hyphenation tables *hyph-fr.tex*, +; renamed (June 2008) from *frhyph.tex* (V2.12, 2002/12/11) +; for consistency with other files with hyphenation patterns +; in hyph-utf8 package. See http://tug.org/tex-hyphen for more details. +; The TeX hyphenation tables are released under the LaTeX Project +; Public License (LPPL) -- http://www.latex-project.org/lppl.txt +; +; License: OpenOffice.org adaptions of this package are licensed under the +; GNU Lesser General Public License (LGPL) +; version 2.1 or higher -- http://www.gnu.org/licenses/ +; +; Authors: +; 3.0 Marc Lodewijck +; 2.0 Paul Pichaureau +; 1.0 Blaise Drayer +; +; Log: +; 3.0 New revised and expanded version: +; + Conversion to UTF-8 Unicode encoding +; + Processing of hyphenated compounds +; + Correction of altered patterns +; 2.0 Fix for words with apostrophe +; 1.0 First conversion +; +; This dictionary is based on syllable matching patterns and therefore should +; be usable under other variations of French. +;___________________________________________________________________ + +2'2 +.a4 +'a4 +.â4 +'â4 +ab2h +a1bî +abî1me +abî2ment. +.a1b2r +'a1b2r +.ab1ré +'ab1ré +.ab3réa +'ab3réa +ab1se +ab3sent. +abs1ti +absti1ne +absti3nent. +ac1ce +ac3cent. +ac1q +acquies1ce +acquies4cent. +ad2h +aè1d2r +a1è2d1re +.ae3s4c2h +'ae3s4c2h +a1g2n +.a1g2n +'a1g2n +.ag1na +'ag1na +.a2g3nat +'a2g3nat +ag1no +a2g3nos +ai1me +ai2ment. +a1la +a2l1al1gi +al1co +1alcool +a1ma +amal1ga +amalga1me +amalga2ment. +â1me +â2ment. +.a1mi +'a1mi +.ami1no +'ami1no +.amino1a2c +'amino1a2c +.a1na +'a1na +.ana3s4t2r +'ana3s4t2r +a1ne +anes1t2h +anest1hé +1a2nesthé1si +a1ni +ani1me +ani2ment. +an1ti +.an1ti +'an1ti +.anti1a2 +'anti1a2 +.anti1e2 +'anti1e2 +.anti1é2 +'anti1é2 +.anti2en1ne +'anti2en1ne +anti1fe +antifer1me +antifer3ment. +.anti1s2 +'anti1s2 +a1po +.a1po +'a1po +.apo2s3ta +'apo2s3ta +apo2s3t2r +ap1pa +appa1re +appa3rent. +ar1c2h +arc1hi +archié1pi +archi1é2pis +.ar1de +.ar3dent. +.ar1ge +'ar1ge +.ar3gent. +'ar3gent. +ar1me +ar2ment. +ar1mi +armil5l +.ar1pe +'ar1pe +.ar3pent. +'ar3pent. +as1me +as2ment. +.as2ta +'as2ta +as1t2r +a2s3t1ro +au1me +au2ment. +a1vi +avil4l +1ba +.1ba +1bâ +.bai1se +.baise1ma +.bai2se3main +1be +1bé +1bè +1bê +4be. +2bent. +4bes. +1bi +.1bi +1bî +.bi1a2c +.bi1a2t +.bi1au +.bio1a2 +.bi2s1a2 +.bi1u2 +1b2l +b1le +4b4le. +2b2lent. +4b4les. +1bo +1bô +bou1me +bou2ment. +bou1ti +boutil3l +1b2r +b1re +4b4re. +2b2rent. +4b4res. +b1ru +bru1me +bru2ment. +1bu +1bû +1by +1ç +1ca +1câ +ca3ou3t2 +ca1pi +capil3l +ca1rê +carê1me +carê2ment. +c1ci +cci1de +cci3dent. +1ce +1cé +1cè +1cê +4ce. +2cent. +4ces. +1c2h +.1c2h4 +4ch. +2chb +c1he +.c1hè +4c4he. +2chent. +4c4hes. +che1vi +chevil4l +.chè1v2r +.chèv1re +.chèvre1fe +.chèvrefeuil2l +.chè2vre3feuil1le +2chg +c1hi +chien1de +chien3dent. +ch2l +ch1le +4ch4le. +4ch4les. +ch1lo +chlo1ra +chlo2r3a2c +chlo1ré +chlo2r3é2t +2chm +2chn +2chp +ch2r +ch1re +4ch4re. +4ch4res. +ch1ro +chro1me +chro2ment. +2chs +2cht +2chw +1ci +.1ci +1cî +cil3l +.ci1sa +.ci2s1alp +1c2k +4ck. +2ckb +c1ke +4c4ke. +2c2kent. +4c4kes. +2ckf +2ckg +2c1k3h +2ckp +2cks +2ckt +1c2l +c1la +cla1me +cla2ment. +c1le +4c4le. +2c2lent. +4c4les. +1co +.1co +1cô +co1acc +co1ac1q +co1a2d +co1ap +co1ar +coas1so +co1assoc +coas1su +co1assur +co1au +co1ax +1cœ +co1é2 +co1ef +co1en +co1ex +co1g2n +cog1ni +co2g3ni1ti +.com1me +.com3ment. +com1pé +compé1te +compé3tent. +.con4 +con1fi +confi1de +confi3dent. +con1ni +conni1ve +conni3vent. +.cons4 +con1ti +conti1ne +conti3nent. +contin1ge +contin3gent. +.con1t2r +.cont1re +.contre1ma +.contremaî1t2r +.cont1re3maît1re +.contre1s2c +co1nu +co2nurb +.co1o2 +.coo1li +.co2o3lie +cor1pu +corpu1le +corpu3lent. +1c2r +c1re +4c4re. +2c2rent. +4c4res. +1cu +.1cu +1cû +.cul4 +cur1re +cur3rent. +1cy +cy1ri +cyril3l +1d2'2 +1da +.1da +1dâ +.da1c2r +.dac1ry +.dacryo1a2 +da1me +da2ment. +d1d2h +1de +1dé +.1dé +1dè +1dê +4de. +.dé1a2 +dé1ca +déca1de +déca3dent. +.dé1io +2dent. +.dé1o2 +.dé2s +4des. +.dé1sa +.dé3s2a3c2r +.dés2a3m +.dé3s2as1t2r +.désa1te +.dé3s2a3tell +.dé3s2c +.dé1se +.dé2s1é2 +.dé3s2é3g2r +.désen1si +.dé3s2ensib +.dé3s2ert +.dé3s2exu +.dé2s1i2 +.dé3s2i3d +.dé3s2i3g2n +.dé3s2i3li +.dési1ne +.dé3s2i3nen +.dé3s2in1vo +.dé3s2i3r +.dé3s2ist +.dé1so +.1dé3s2o3dé +.dé2s1œ +.dé3s2o3l +.déso1pi +.dé3s2o3pil +.dé3s2orm +.dé3s2orp +.dé3s2ou1f2r +.dé3s2p +.dé3s2t +.dé1su +.dé2s1u2n +dé1t2r +dét1ri +détri1me +détri3ment. +d1ha +3d2hal +d1ho +3d2houd +1di +.1di +1dî +.di1a2cé +.dia1ci +.di1a2cid +.di1ald +.di1a2mi +dia1p2h +diaph2r +diaph1ra +diaphrag1me +diaphrag2ment. +.dia1to +.di1a2tom +.di1e2n +di1li +dili1ge +dili3gent. +dis1co +di2s3cop +.di2s3h +dis1si +dissi1de +dissi3dent. +dis1ti +distil3l +d1le +2d2lent. +1do +.1do +1dô +.do1le +.do3lent. +1d2r +d1re +4d4re. +2d2rent. +4d4res. +d1s2 +1du +1dû +1dy +.1dy +.dy2s3 +.dy2s1a2 +.dy2s1i2 +.dy2s1o2 +.dy2s1u2 +.e4 +'e4 +.é4 +'é4 +.è4 +'è4 +.ê4 +'ê4 +é1ce +é3cent. +é1ci +éci1me +éci2ment. +é1cu +écu1me +écu2ment. +é1de +é3dent. +éd2hi +é1d2r +éd1ri +1é2drie +édri1q +1é2drique +é1le +é1lé +1é2lec1t2r +élé1me +1é2lément +é1li +éli1me +éli2ment. +é1lo +élo1q +élo3quent. +è1me +è2ment. +é1mi +.é1mi +émil4l +.émi1ne +.émi3nent. +.e1n1a2 +'e1n1a2 +é1ne +1é2nerg +e1ni +é1ni +éni1te +éni3tent. +e2n1i2v2r +.e1n1o2 +'e1n1o2 +en1t2r +ent1re +entre1ge +entre3gent. +é1pi +épis1co +épi2s3cop +épi3s4co1pe +é1q +é3quent. +équi1po +équipo1te +équipo3tent. +équi1va +équiva1le +équiva4lent. +é1re +é3rent. +er1me +er2ment. +es1ce +es3cent. +e2s3c2h +es1co +e2s3cop +es1ti +esti1me +esti2ment. +.eu2r1a2 +'eu2r1a2 +eus1ta +eu1s2tat +ex1t2r +ext1ra1 +extra2c +extra2i +1fa +1fâ +fa1me +fa2ment. +1fe +1fé +1fè +1fê +4fe. +fé1cu +fécu1le +fécu3lent. +2fent. +4fes. +1fi +1fî +fi1c2h +fic1hu +fichu1me +fichu3ment. +fir1me +fir2ment. +1f2l +f1la +flam1me +flam2ment. +f1le +4f4le. +2f2lent. +4f4les. +1fo +1fô +1f2r +f1re +4f4re. +2f2rent. +4f4res. +f1ri +fri1ti +fritil3l +f1s2 +1fu +1fû +fu1me +fu2ment. +1fy +1ga +1gâ +1ge +.1ge +1gé +1gè +1gê +4ge. +.gem1me +.gem2ment. +2gent. +4ges. +1g2ha +1g2he +1g2hi +1g2ho +1g2hy +1gi +1gî +gil3l +1g2l +g1le +4g4le. +2g2lent. +4g4les. +1g2n +g1ne +4g4ne. +2g2nent. +4g4nes. +1go +1gô +1g2r +g1ra +gram1me +gram2ment. +gran1di +grandi1lo +grandilo1q +grandilo3quent. +g1re +4g4re. +2g2rent. +4g4res. +g1s2 +1gu +1gû +4gue. +2guent. +4gues. +1gy +1ha +1hâ +1he +1hé +1hè +1hê +4he. +hé1mi +hémi1é +hé1mo +hémo1p2t +4hes. +1hi +1hî +hil3l +1ho +1hô +1hu +1hû +hu1me +hu2ment. +1hy +hy1pe +hype4r1 +hype1ra2 +hype1re2 +hype1ré2 +hype1ri2 +hype1ro2 +hypers2 +hype1ru2 +hy1po +hypo1a2 +hypo1e2 +hypo1é2 +hypo1i2 +hypo1o2 +hypo1s2 +hypo1u2 +.i4 +'i4 +.î4 +'î4 +i1al1gi +iar1t2h +i1arth2r +i1b2r +ib1ri +ibril3l +iè1d2r +i1è2d1re +.i1g2n +'i1g2n +.i2g3né +'i2g3né +.i2g3ni +'i2g3ni +il2l +im1ma +imma1ne +imma3nent. +im1mi +immi1ne +immi3nent. +immis1ce +immis4cent. +im1po +impo1te +impo3tent. +im1pu +impu1de +impu3dent. +.i1n1a2 +'i1n1a2 +.ina1ni +'ina1ni +.in2a3nit +'in2a3nit +.inau1gu +'inau1gu +.in2augur +'in2augur +in1ci +inci1de +inci3dent. +in1di +indi1ge +indi3gent. +in1do +indo1le +indo3lent. +in1du +indul1ge +indul3gent. +.i1n1e2 +'i1n1e2 +.i1n1é2 +'i1n1é2 +.inef1fa +'inef1fa +.in2effab +'in2effab +.iné1lu +'iné1lu +.in2é3luc1ta +'in2é3luc1ta +.iné1na +'iné1na +.in2é3nar1ra +'in2é3nar1ra +.in2ept +'in2ept +.in2er +'in2er +.in2exo1ra +'in2exo1ra +in1fo +infor1ma +1informat +.i1n1i2 +'i1n1i2 +.ini1mi +'ini1mi +.in2i3mi1ti +'in2i3mi1ti +.in2i3q +'in2i3q +.in2i3t +'in2i3t +in1no +inno1ce +inno3cent. +.i1n1o2 +'i1n1o2 +.ino1cu +'ino1cu +.in2o3cul +'in2o3cul +.in2ond +'in2ond +in1so +inso1le +inso3lent. +.ins1ta +'ins1ta +.in1s2tab +'in1s2tab +ins1ti +instil3l +in1te +.in1te +'in1te +intel1li +intelli1ge +intelli3gent. +.inte4r3 +'inte4r3 +.inte1ra2 +'inte1ra2 +.inte1re2 +'inte1re2 +.inte1ré2 +'inte1ré2 +.inte1ri2 +'inte1ri2 +.inte1ro2 +'inte1ro2 +.inters2 +'inters2 +.inte1ru2 +'inte1ru2 +in1ti +inti1me +inti2ment. +.i1n1u2 +'i1n1u2 +.in2uit +'in2uit +.in2u3l +'in2u3l +io1a2ct +i1oxy +is1ce +is3cent. +i1s2c2h +i2s3c1hé +isc1hi +i2s3chia +i2s3chio +is1ta +i1s2tat +i1va +iva1le +iva3lent. +1j +ja1ce +ja3cent. +4je. +2jent. +4jes. +2jk +1ka +1kâ +1ke +1ké +1kè +1kê +4ke. +2kent. +4kes. +1k2h +.1k2h4 +4kh. +1ki +1kî +1ko +1kô +1k2r +1ku +1kû +1ky +1la +.1la +1là +1lâ +.la1te +.la3tent. +la1w2r +la2w3re +1le +1lé +1lè +1lê +4le. +2lent. +4les. +1li +1lî +lil3l +l1li +l3lion +l1lu +llu1me +llu2ment. +l1me +l2ment. +1lo +1lô +l1s2t +1lu +1lû +1ly +1ma +.1ma +1mâ +.ma2c3k +.ma1c2r +.mac1ro +.macro1s2c +.ma1g2n +.mag1ni +.magni1ci +.ma2g3nici1de +.magni1fi +.magnifi1ca +.ma2g3nificat +.mag1nu +.ma2g3num +.ma1la +.mala1d2r +.malad1re +.ma2l1a2dres +.ma2l1a2d1ro +.ma2l1ai1sé +.ma2l1ap +.ma2l1a2v +.ma1le +.ma2l1en +.ma1li +.ma2l1int +.ma1lo +.ma2l1oc +.ma2l1o2d +.ma2r1x +1me +1mé +.1mé +1mè +1mê +4me. +mé1co +mécon1te +mécon3tent. +.mé1go +.mé2g1oh +4mes. +.mé2sa +.mé3san +.mé1se +.mé2s1es +.mé2s1i +.mé1su +.mé2s1u2s +.mé1ta +.mé1ta1s2ta +1mi +.1mi +1mî +mil3l +.mil3l +mil1le +mil4let +.mil1li +.milli1am +mi1me +mi2ment. +mit1te +mit3tent. +m1né +m1nè +1m2né1mo +1m2nès +1m2né1si +1mo +.1mo +1mô +1mœ +mo1no +.mo1no +.mono1a2 +.mono1e2 +.mono1é2 +.mono1i2 +.mono1ï2dé +.mono1o2 +.mono1s2 +.mono1u2 +mono1va +monova1le +monova3lent. +mon1t2r +mont1ré +mon2t3réal +moye1nâ +moye2n1â2g +m1s2 +1mu +1mû +mu1ni +muni1fi +munifi1ce +munifi3cent. +1my +1na +1nâ +1ne +1né +1nè +1nê +4ne. +2nent. +4nes. +1ni +1nî +1no +.1no +1nô +1nœ +.no1no +.no2n1obs +n1sa +n3s2at. +n3s2ats. +1nu +1nû +nu1t2r +nut1ri +nutri1me +nutri3ment. +n1x +1ny +.o4 +'o4 +.ô4 +'ô4 +o1b2l +ob1lo +o2b3long +oc1te +1octet +o1d2l +oè1d2r +o1è2d1re +o1g2n +og1no +ogno1mo +o2g3nomo1ni +o2g3no1si +o1io1ni +om1bu +ombud2s3 +ô1me +ô2ment. +om1me +om2ment. +om1ni +omni1po +omnipo1te +omnipo3tent. +omni1s2 +.on1gu +'on1gu +.on3guent. +'on3guent. +o1pu +opu1le +opu3lent. +or1me +or2ment. +os1ta +o1s2tas +o1s2tat +os1té +o1s2té1ro +os1ti +o1s2tim +os1to +o1s2tom +os1t2r +ost1ra +o1s2trad +o1s2tra1tu +ost1ri +ostric1ti +o1s2triction +.oua1ou +'oua1ou +.o1vi +'o1vi +.ovi1s2c +'ovi1s2c +oxy1a2 +1pa +.1pa +1pâ +pa1lé +paléo1é2 +.pa1na +.pa2n1a2f +.pa2n1a2mé +.pa2n1a2ra +.pa1ni +.pa2n1is +.pa1no +.pa2n1o2p2h +.pa2n1opt +pa1pi +papil2l +papil3la +papil3le +papil3li +papil1lo +papil3lom +.pa1ra +.para1c2h +.pa2r1a2c1he +.pa2r1a2c1hè +.para1s2 +.pa1re +.pa3rent. +.pa1r2h +.pa2r3hé +.pa1te +.pa3tent. +1pe +.1pe +1pé +.1pé +1pè +1pê +4pe. +2pent. +.pen2ta +pé1nu +pé2nul +.pe4r +.pe1r1a2 +pé1ré +.pe1r1e2 +.pe1r1é2 +pé1r2é2q +pe1r3h +.pé1ri +.pe1r1i2 +.péri1os +.péri1s2 +.péri2s3s +.péri2s3ta +.péri1u2 +per1ma +perma1ne +perma3nent. +.pe1r1o2 +per1ti +perti1ne +perti3nent. +.pe1r1u2 +4pes. +1p2h +.1p2h4 +4ph. +.p1ha +.pha1la +.phalan3s2t +p1he +4p4he. +2phent. +4p4hes. +ph2l +ph1le +4ph4le. +4ph4les. +2phn +p1ho +pho1to +photo1s2 +ph2r +ph1re +4ph4re. +4ph4res. +2phs +2pht +ph1ta +3ph2ta1lé +ph1ti +3ph2tis +1pi +1pî +pi1ri +piril3l +1p2l +.1p2l +p1le +4p4le. +2p2lent. +4p4les. +p1lu +.p1lu +plu1me +plu2ment. +.plu1ri +.pluri1a +p1ne +1p2né +1p2neu +1po +.1po +1pô +poas1t2r +po1ast1re +po1ly +poly1a2 +poly1e2 +poly1é2 +poly1è2 +poly1i2 +poly1o2 +poly1s2 +poly1u2 +poly1va +polyva1le +polyva3lent. +.pon1te +.pon2tet +.pos2t3h +.pos1ti +.pos2t1in +.pos2t1o2 +.pos2t3r +.post1s2 +1p2r +.1p2r +p1re +p1ré +.p1ré +4p4re. +.pré1a2 +.pré2a3la +.pré2au +.pré1e2 +.pré1é2 +préé1mi +préémi1ne +préémi3nent. +.pré1i2 +2p2rent. +.pré1o2 +.pré1s2 +4p4res. +pré1se +pré3sent. +.pré1u2 +p1ri +pri1va +privat1do +privatdo1ce +privatdo3cent. +privatdo1ze +privatdo3zent. +p1ro +.p1ro +.pro1é2 +proé1mi +proémi1ne +proémi3nent. +.pro1g2n +.prog1na +.pro2g3na1t2h +.pro1s2cé +pros1ta +pro2s3tat +.prou3d2h +p1ru +pru1de +pru3dent. +p1sy +.p1sy +1p2sy1c2h +.1p2sy1c2h +.psyc1ho +.psycho1a2n +p1té +p1tè +1p2tér +1p2tèr +1pu +.1pu +1pû +.pud1d2l +pu1g2n +pug1na +pugna1b2l +pu2g3nab1le +pu2g3nac +pu1pi +pupil3l +pu1si +pusil3l +1py +1q +qua1me +qua2ment. +4que. +2quent. +4ques. +1ra +1râ +ra1di +radio1a2 +rai1me +rai3ment. +ra1me +ra2ment. +r1ci +rcil4l +1re +.1re +1ré +.1ré +1rè +1rê +4re. +.ré1a2 +.ré2a3le +.réa1li +.ré2a3lis +.ré2a3lit +.ré2aux +.ré1e2 +.ré1é2 +.ré2el +.ré2er +.ré2èr +ré1ge +ré3gent. +.ré1i2 +.ré2i3fi +re1le +re3lent. +re1li +reli1me +reli2ment. +ré1ma +réma1ne +réma3nent. +2rent. +.ré1o2 +re1pe +re3pent. +.re1s2 +4res. +.res1ca +.re2s3cap +.res1ci +.re2s3ci1si +.re2s3ci1so +.res1co +.re2s3cou +.res1c2r +.re2s3c1ri +.res1pe +.re2s3pect +.res1pi +.re2s3pir +.res1p2l +.resp1le +.re2s3plend +.res1po +.re2s3pons +.res1q +.re2s3quil +.re2s3s +.res1se +.res3sent. +.re2s3t +.res1ta +.re3s4tab +.re3s4tag +.re3s4tand +.re3s4tat +.res1té +.re3s4tén +.re3s4tér +.res1ti +.re3s4tim +.re3s4tip +.res1to +.re3s4toc +.re3s4top +.re3s4t2r +.rest1re +.re4s5trein +.rest1ri +.re4s5trict +.re4s5trin +.re3s4tu +.re3s4ty +ré1su +résur1ge +résur3gent. +ré1ti +réti1ce +réti3cent. +.ré1t2r +.rét1ro +.rétro1a2 +.réu2 +.ré2uss +1r2h +r1he +4r4he. +4r4hes. +2r3heur +r1hy +2r3hy1d2r +1ri +1rî +ri1me +ri2ment. +rin1ge +rin3gent. +r1mi +rmil4l +1ro +1rô +1ru +1rû +ru1le +ru3lent. +1ry +ry1t2h +ry2thm +ryth1me +ryth2ment. +1sa +.1sa +1sâ +.sar1me +.sar3ment. +s1ca +1s2ca1p2h +1s2c2h +.1s2c2h4 +4s4ch. +sc1he +4s4c4he. +4s4c4hes. +2s2chs +s1c2l +sc1lé +1s2clér +s1co +1s2cop +1se +.1se +1sé +1sè +1sê +4se. +se1mi +semil4l +2sent. +ser1ge +ser3gent. +.ser1me +.ser3ment. +ser1pe +ser3pent. +4ses. +ses1q +sesqui1a2 +.seu2le +1s2h +.1s2h4 +4sh. +s1he +4s4he. +2shent. +4s4hes. +2shm +s1ho +2s3hom +2shr +2shs +1si +1sî +s1la +sla1lo +slalo1me +slalo2ment. +1s2lav +s1lo +1s2lov +1so +.1so +1sô +1sœ +.sou1ve +.sou3vent. +s1pa +spa1ti +1s2patia +s1pe +1s2perm +s1p2h +sp1hé +sp1hè +1s2phér +1s2phèr +s1pi +1s2piel +spi1ro +1s2piros +s1po +1s2por +spo1ru +sporu1le +sporu4lent. +s1ta +.s1ta +.sta2g3n +stan1da +1s2tandard +s1te +s1té +1s2tein +sté1ré +stéréo1s2 +s1ti +.s1ti +1s2tigm +.stil3l +s1to +1s2to1c2k +sto1mo +1s2tomos +s1t2r +st1ro +1s2tro1p2h +st1ru +1s2truc1tu +s1ty +1s2ty1le +1su +.1su +1sû +.su2b1a2 +.su3b2alt +.su2b1é2 +.su3b2é3r +.su1bi +.su2b1in +su1b2l +.su1b2l +sub1li +.sub1li +subli1me +subli2ment. +.subli1mi +.su2b3limin +.su2b3lin +.su2b3lu +sub1s2 +.su1bu +.su2b1ur +suc1cu +succu1le +succu3lent. +su1me +su2ment. +su1pe +supe4r1 +supe1ro2 +supers2 +su1ra +.su2r1a2 +su3r2ah +.su3r2a3t +su1ré +.su2r1e2 +.su2r1é2 +.su3r2eau +.su3r2ell +suré1mi +surémi1ne +surémi3nent. +.su3r2et +.su2r3h +.su1ri +.su2r1i2m +.su2r1inf +.su2r1int +.su1ro +.su2r1of +.su2r1ox +1sy +.1sy +.syn1g2n +.syng1na +.syn2g3na1t2h +1ta +.1ta +1tà +1tâ +ta1c2h +tac1hy +tachy1a2 +.ta1le +.ta3lent. +ta1me +ta2ment. +tan1ge +tan3gent. +t1c2h +tc1hi +tchin3t2 +1te +1té +1tè +1tê +4te. +té1lé +télé1e2 +télé1i2 +télé1o2b +télé1o2p +télé1s2 +tem1pé +tempé1ra +tempéra1me +tempéra3ment. +2tent. +ter1ge +ter3gent. +4tes. +tes1ta +testa1me +testa3ment. +1t2h +.1t2h4 +4th. +t1he +4t4he. +ther1mo +thermo1s2 +4t4hes. +2t3heur +2thl +2thm +2thn +th2r +th1re +4th4re. +4th4res. +th1ri +thril3l +2ths +1ti +1tî +1to +1tô +to1me +to2ment. +tor1re +tor3rent. +1t2r +.1t2r +t1ra +tran2s1a2 +tran3s2act +tran3s2ats +tran2s3h +tran2s1o2 +tran2s3p +trans1pa +transpa1re +transpa3rent. +tran2s1u2 +t1re +4t4re. +2t2rent. +4t4res. +t1ri +.t1ri +.tri1a2c +.tri1a2n +.tri1a2t +tri1de +tri3dent. +.tri1o2n +t1ru +tru1cu +trucu1le +trucu3lent. +t1t2l +1tu +1tû +tu1me +tu2ment. +tung2s3 +tur1bu +turbu1le +turbu3lent. +1ty +.u4 +'u4 +.û4 +'û4 +u1ci +ucil4l +ue1vi +uevil4l +u1ni +uni1a2x +uni1o2v +u2s3t2r +u1vi +uvil4l +1va +1vâ +va1ci +vacil4l +va1ni +vanil2l +vanil1li +vanil3lin +vanil3lis +1ve +1vé +1vè +1vê +4ve. +vé1lo +vélo1s2ki +ve1ni +veni1me +veni2ment. +2vent. +ven1t2r +vent1ri +ventri1po +ventripo1te +ventripo3tent. +4ves. +1vi +1vî +vi1di +vidi1me +vidi2ment. +vil3l +1vo +1vô +vol1ta +vol2t1amp +1v2r +v1re +4v4re. +2v2rent. +4v4res. +1vu +1vû +1vy +1wa +wa2g3n +1we +4we. +2went. +4wes. +1wi +1wo +1w2r +1wu +2xent. +xil3l +.y4 +'y4 +y1al1gi +y1as1t2h +ys1to +y1s2tom +1za +1ze +1zé +1zè +4ze. +2zent. +4zes. +1zi +1zo +1zu +1zy +% +% Additional patterns start here: +% +2’2 +’a4 +4a- +.á4 +'á4 +’á4 +4á- +.à4 +'à4 +’à4 +4à- +’â4 +4â- +.å4 +'å4 +’å4 +4å- +.ä4 +'ä4 +’ä4 +4ä- +.ã4 +'ã4 +’ã4 +4ã- +-5a4 +-5á4 +-5à4 +-5â4 +-5å4 +-5ä4 +-5ã4 +abî2ment- +’a1b2r +-5a1b2r +’ab1ré +-5ab1ré +’ab3réa +-5ab3réa +ab3sent- +absti3nent- +ac3cent- +acquies4cent- +.æ4 +'æ4 +’æ4 +4æ- +-5æ4 +’ae3s4c2h +-5ae3s4c2h +’a1g2n +-5a1g2n +’ag1na +-5ag1na +’a2g3nat +-5a2g3nat +ai2ment- +amalga2ment- +â2ment- +’a1mi +-5a1mi +’ami1no +-5ami1no +’amino1a2c +-5amino1a2c +’a1na +-5a1na +’ana3s4t2r +-5ana3s4t2r +ani2ment- +’an1ti +-5an1ti +’anti1a2 +-5anti1a2 +’anti1e2 +’anti1é2 +-5anti1e2 +-5anti1é2 +’anti2en1ne +-5anti2en1ne +antifer3ment- +’anti1s2 +-5anti1s2 +’a1po +-5a1po +’apo2s3ta +-5apo2s3ta +appa3rent- +-5ar1de +-ar3dent- +.ar3dent- +-5ar3dent. +’ar1ge +-5ar1ge +-ar3gent- +.ar3gent- +'ar3gent- +’ar3gent- +’ar3gent. +-5ar3gent. +ar2ment- +’ar1pe +-5ar1pe +-ar3pent- +.ar3pent- +'ar3pent- +’ar3pent- +’ar3pent. +-5ar3pent. +as2ment- +’as2ta +-5as2ta +au2ment- +.b4 +'b4 +’b4 +4b- +-5b4 +-5bai1se +-5baise1ma +-5bai2se3main +4be- +2bent- +4bes- +-5bi1a2c +-5bi1a2t +-5bi1au +-5bio1a2 +-5bi2s1a2 +-5bi1u2 +4b4le- +2b2lent- +4b4les- +bou2ment- +4b4re- +2b2rent- +4b4res- +bru2ment- +.c4 +'c4 +’c4 +4c- +.ç4 +'ç4 +’ç4 +4ç- +-5c4 +-5ç4 +carê2ment- +cci3dent- +4ce- +2cent- +4ces- +4ch- +4c4he- +-5c1hè +2chent- +4c4hes- +-5chè1v2r +-5chèv1re +-5chèvre1fe +-5chèvrefeuil2l +-5chè2vre3feuil1le +chien3dent- +4ch4le- +4ch4les- +4ch4re- +4ch4res- +chro2ment- +-5ci1sa +-5ci2s1alp +4ck- +4c4ke- +2c2kent- +4c4kes- +cla2ment- +4c4le- +2c2lent- +4c4les- +-5com1me +-com3ment- +.com3ment- +-5com3ment. +compé3tent- +-5con4 +confi3dent- +conni3vent- +-5cons4 +conti3nent- +contin3gent- +-5con1t2r +-5cont1re +-5contre1ma +-5contremaî1t2r +-5cont1re3maît1re +-5contre1s2c +-5co1o2 +-5coo1li +-5co2o3lie +corpu3lent- +4c4re- +2c2rent- +4c4res- +-5cul4 +cur3rent- +1d2’2 +.d4 +'d4 +’d4 +4d- +.ð4 +'ð4 +’ð4 +4ð- +-5d4 +-5ð4 +-5da1c2r +-5dac1ry +-5dacryo1a2 +da2ment- +4de- +-5dé1a2 +déca3dent- +-5dé1io +2dent- +-5dé1o2 +4des- +-5dé2s +-5dé1sa +-5dé3s2a3c2r +-5dés2a3m +-5dé3s2as1t2r +-5désa1te +-5dé3s2a3tell +-5dé3s2c +-5dé1se +-5dé2s1é2 +-5dé3s2é3g2r +-5désen1si +-5dé3s2ensib +-5dé3s2ert +-5dé3s2exu +-5dé2s1i2 +-5dé3s2i3d +-5dé3s2i3g2n +-5dé3s2i3li +-5dési1ne +-5dé3s2i3nen +-5dé3s2in1vo +-5dé3s2i3r +-5dé3s2ist +-5dé1so +-5dé2s1œ +-5dé3s2o3l +-5déso1pi +-5dé3s2o3pil +-5dé3s2orm +-5dé3s2orp +-5dé3s2ou1f2r +-5dé3s2p +-5dé3s2t +-5dé1su +-5dé2s1u2n +détri3ment- +-5di1a2cé +-5dia1ci +-5di1a2cid +-5di1ald +-5di1a2mi +diaphrag2ment- +-5dia1to +-5di1a2tom +-5di1e2n +dili3gent- +-5di2s3h +dissi3dent- +2d2lent- +-5do1le +-do3lent- +.do3lent- +-5do3lent. +4d4re- +2d2rent- +4d4res- +-5dy2s3 +-5dy2s1a2 +-5dy2s1i2 +-5dy2s1o2 +-5dy2s1u2 +’e4 +4e- +’é4 +4é- +’è4 +4è- +’ê4 +4ê- +.ë4 +'ë4 +’ë4 +4ë- +-5e4 +-5é4 +-5è4 +-5ê4 +-5ë4 +é3cent- +éci2ment- +écu2ment- +é3dent- +éli2ment- +élo3quent- +è2ment- +-5é1mi +-5émi1ne +-émi3nent- +.émi3nent- +-5émi3nent. +’e1n1a2 +-5e1n1a2 +éni3tent- +’e1n1o2 +-5e1n1o2 +entre3gent- +é3quent- +équipo3tent- +équiva4lent- +é3rent- +er2ment- +es3cent- +esti2ment- +’eu2r1a2 +-5eu2r1a2 +.f4 +'f4 +’f4 +4f- +-5f4 +fa2ment- +4fe- +fécu3lent- +2fent- +4fes- +fichu3ment- +fir2ment- +flam2ment- +4f4le- +2f2lent- +4f4les- +4f4re- +2f2rent- +4f4res- +fu2ment- +.g4 +'g4 +’g4 +4g- +-5g4 +4ge- +-5gem1me +-gem2ment- +.gem2ment- +-5gem2ment. +2gent- +4ges- +4g4le- +2g2lent- +4g4les- +4g4ne- +2g2nent- +4g4nes- +gram2ment- +grandilo3quent- +4g4re- +2g2rent- +4g4res- +4gue- +2guent- +4gues- +.h4 +'h4 +’h4 +4h- +-5h4 +4he- +4hes- +hu2ment- +’i4 +4i- +.í4 +'í4 +’í4 +4í- +.ì4 +'ì4 +’ì4 +4ì- +’î4 +4î- +.ï4 +'ï4 +’ï4 +4ï- +-5i4 +-5í4 +-5ì4 +-5î4 +-5ï4 +’i1g2n +-5i1g2n +’i2g3né +-5i2g3né +’i2g3ni +-5i2g3ni +imma3nent- +immi3nent- +immis4cent- +impo3tent- +impu3dent- +’i1n1a2 +-5i1n1a2 +’ina1ni +-5ina1ni +’in2a3nit +-5in2a3nit +’inau1gu +-5inau1gu +’in2augur +-5in2augur +inci3dent- +indi3gent- +indo3lent- +indul3gent- +’i1n1e2 +’i1n1é2 +-5i1n1e2 +-5i1n1é2 +’inef1fa +-5inef1fa +’in2effab +-5in2effab +’iné1lu +-5iné1lu +’in2é3luc1ta +-5in2é3luc1ta +’iné1na +-5iné1na +’in2é3nar1ra +-5in2é3nar1ra +’in2ept +-5in2ept +’in2er +-5in2er +’in2exo1ra +-5in2exo1ra +’i1n1i2 +-5i1n1i2 +’ini1mi +-5ini1mi +’in2i3mi1ti +-5in2i3mi1ti +’in2i3q +-5in2i3q +’in2i3t +-5in2i3t +inno3cent- +’i1n1o2 +-5i1n1o2 +’ino1cu +-5ino1cu +’in2o3cul +-5in2o3cul +’in2ond +-5in2ond +inso3lent- +’ins1ta +-5ins1ta +’in1s2tab +-5in1s2tab +’in1te +-5in1te +intelli3gent- +’inte4r3 +-5inte4r3 +’inte1ra2 +-5inte1ra2 +’inte1re2 +’inte1ré2 +-5inte1re2 +-5inte1ré2 +’inte1ri2 +-5inte1ri2 +’inte1ro2 +-5inte1ro2 +’inters2 +-5inters2 +’inte1ru2 +-5inte1ru2 +inti2ment- +’i1n1u2 +-5i1n1u2 +’in2uit +-5in2uit +’in2u3l +-5in2u3l +is3cent- +iva3lent- +.j4 +'j4 +’j4 +4j- +-5j4 +ja3cent- +4je- +2jent- +4jes- +.k4 +'k4 +’k4 +4k- +-5k4 +4ke- +2kent- +4kes- +4kh- +.l4 +'l4 +’l4 +4l- +-5l4 +-5la1te +-la3tent- +.la3tent- +-5la3tent. +4le- +2lent- +4les- +llu2ment- +l2ment- +.m4 +'m4 +’m4 +4m- +-5m4 +-5ma2c3k +-5ma1c2r +-5mac1ro +-5macro1s2c +-5ma1g2n +-5mag1ni +-5magni1ci +-5ma2g3nici1de +-5magni1fi +-5magnifi1ca +-5ma2g3nificat +-5mag1nu +-5ma2g3num +-5ma1la +-5mala1d2r +-5malad1re +-5ma2l1a2dres +-5ma2l1a2d1ro +-5ma2l1ai1sé +-5ma2l1ap +-5ma2l1a2v +-5ma1le +-5ma2l1en +-5ma1li +-5ma2l1int +-5ma1lo +-5ma2l1oc +-5ma2l1o2d +-5ma2r1x +4me- +mécon3tent- +-5mé1go +-5mé2g1oh +4mes- +-5mé2sa +-5mé3san +-5mé1se +-5mé2s1es +-5mé2s1i +-5mé1su +-5mé2s1u2s +-5mé1ta +-5mé1ta1s2ta +-5mil3l +-5mil1li +-5milli1am +mi2ment- +mit3tent- +-5mo1no +-5mono1a2 +-5mono1e2 +-5mono1é2 +-5mono1i2 +-5mono1ï2dé +-5mono1o2 +-5mono1s2 +-5mono1u2 +monova3lent- +munifi3cent- +.n4 +'n4 +’n4 +4n- +.ñ4 +'ñ4 +’ñ4 +4ñ- +-5n4 +-5ñ4 +4ne- +2nent- +4nes- +-5no1no +-5no2n1obs +n3s2at- +n3s2ats- +nutri3ment- +’o4 +4o- +.ó4 +'ó4 +’ó4 +4ó- +.ò4 +'ò4 +’ò4 +4ò- +’ô4 +4ô- +.õ4 +'õ4 +’õ4 +4õ- +.ø4 +'ø4 +’ø4 +4ø- +-5o4 +-5ó4 +-5ò4 +-5ô4 +-5õ4 +-5ø4 +.œ4 +'œ4 +’œ4 +4œ- +-5œ4 +ô2ment- +om2ment- +omnipo3tent- +’on1gu +-5on1gu +-on3guent- +.on3guent- +'on3guent- +’on3guent- +’on3guent. +-5on3guent. +opu3lent- +or2ment- +’oua1ou +-5oua1ou +’o1vi +-5o1vi +’ovi1s2c +-5ovi1s2c +.p4 +'p4 +’p4 +4p- +-5p4 +-5pa1na +-5pa2n1a2f +-5pa2n1a2mé +-5pa2n1a2ra +-5pa1ni +-5pa2n1is +-5pa1no +-5pa2n1o2p2h +-5pa2n1opt +-5pa1ra +-5para1c2h +-5pa2r1a2c1he +-5pa2r1a2c1hè +-5para1s2 +-5pa1re +-pa3rent- +.pa3rent- +-5pa3rent. +-5pa1r2h +-5pa2r3hé +-5pa1te +-pa3tent- +.pa3tent- +-5pa3tent. +4pe- +2pent- +-5pen2ta +-5pe4r +-5pe1r1a2 +-5pe1r1e2 +-5pe1r1é2 +-5pé1ri +-5pe1r1i2 +-5péri1os +-5péri1s2 +-5péri2s3s +-5péri2s3ta +-5péri1u2 +perma3nent- +-5pe1r1o2 +perti3nent- +-5pe1r1u2 +4pes- +4ph- +-5p1ha +-5pha1la +-5phalan3s2t +4p4he- +2phent- +4p4hes- +4ph4le- +4ph4les- +4ph4re- +4ph4res- +4p4le- +2p2lent- +4p4les- +-5p1lu +plu2ment- +-5plu1ri +-5pluri1a +polyva3lent- +-5pon1te +-5pon2tet +-5pos2t3h +-5pos1ti +-5pos2t1in +-5pos2t1o2 +-5pos2t3r +-5post1s2 +4p4re- +-5p1ré +-5pré1a2 +-5pré2a3la +-5pré2au +-5pré1e2 +-5pré1é2 +préémi3nent- +-5pré1i2 +2p2rent- +-5pré1o2 +4p4res- +-5pré1s2 +pré3sent- +-5pré1u2 +privatdo3cent- +privatdo3zent- +-5p1ro +-5pro1é2 +proémi3nent- +-5pro1g2n +-5prog1na +-5pro2g3na1t2h +-5pro1s2cé +-5prou3d2h +pru3dent- +-5p1sy +-5psyc1ho +-5psycho1a2n +-5pud1d2l +.q4 +'q4 +’q4 +4q- +-5q4 +qua2ment- +4que- +2quent- +4ques- +.r4 +'r4 +’r4 +4r- +-5r4 +rai3ment- +ra2ment- +4re- +-5ré1a2 +-5ré2a3le +-5réa1li +-5ré2a3lis +-5ré2a3lit +-5ré2aux +-5ré1e2 +-5ré1é2 +-5ré2el +-5ré2er +-5ré2èr +ré3gent- +-5ré1i2 +-5ré2i3fi +re3lent- +reli2ment- +réma3nent- +2rent- +-5ré1o2 +re3pent- +4res- +-5re1s2 +-5res1ca +-5re2s3cap +-5res1ci +-5re2s3ci1si +-5re2s3ci1so +-5res1co +-5re2s3cou +-5res1c2r +-5re2s3c1ri +-5res1pe +-5re2s3pect +-5res1pi +-5re2s3pir +-5res1p2l +-5resp1le +-5re2s3plend +-5res1po +-5re2s3pons +-5res1q +-5re2s3quil +-5re2s3s +-5res1se +-res3sent- +.res3sent- +-5res3sent. +-5re2s3t +-5res1ta +-5re3s4tab +-5re3s4tag +-5re3s4tand +-5re3s4tat +-5res1té +-5re3s4tén +-5re3s4tér +-5res1ti +-5re3s4tim +-5re3s4tip +-5res1to +-5re3s4toc +-5re3s4top +-5re3s4t2r +-5rest1re +-5re4s5trein +-5rest1ri +-5re4s5trict +-5re4s5trin +-5re3s4tu +-5re3s4ty +résur3gent- +réti3cent- +-5ré1t2r +-5rét1ro +-5rétro1a2 +-5réu2 +-5ré2uss +4r4he- +4r4hes- +ri2ment- +rin3gent- +ru3lent- +ryth2ment- +.s4 +'s4 +’s4 +4s- +.š4 +'š4 +’š4 +4š- +-5s4 +-5š4 +-5sar1me +-sar3ment- +.sar3ment- +-5sar3ment. +4s4ch- +4s4c4he- +4s4c4hes- +4se- +2sent- +ser3gent- +-5ser1me +-ser3ment- +.ser3ment- +-5ser3ment. +ser3pent- +4ses- +-5seu2le +4sh- +4s4he- +2shent- +4s4hes- +slalo2ment- +-5sou1ve +-sou3vent- +.sou3vent- +-5sou3vent. +sporu4lent- +-5s1ta +-5sta2g3n +-5s1ti +-5stil3l +-5su2b1a2 +-5su3b2alt +-5su2b1é2 +-5su3b2é3r +-5su1bi +-5su2b1in +-5su1b2l +-5sub1li +subli2ment- +-5subli1mi +-5su2b3limin +-5su2b3lin +-5su2b3lu +-5su1bu +-5su2b1ur +succu3lent- +su2ment- +-5su2r1a2 +-5su3r2a3t +-5su2r1e2 +-5su2r1é2 +-5su3r2eau +-5su3r2ell +surémi3nent- +-5su3r2et +-5su2r3h +-5su1ri +-5su2r1i2m +-5su2r1inf +-5su2r1int +-5su1ro +-5su2r1of +-5su2r1ox +-5syn1g2n +-5syng1na +-5syn2g3na1t2h +.t4 +'t4 +’t4 +4t- +-5t4 +-5ta1le +-ta3lent- +.ta3lent- +-5ta3lent. +ta2ment- +tan3gent- +4te- +tempéra3ment- +2tent- +ter3gent- +4tes- +testa3ment- +4th- +.þ4 +'þ4 +’þ4 +4þ- +-5þ4 +4t4he- +4t4hes- +4th4re- +4th4res- +to2ment- +tor3rent- +transpa3rent- +4t4re- +2t2rent- +4t4res- +-5t1ri +-5tri1a2c +-5tri1a2n +-5tri1a2t +tri3dent- +-5tri1o2n +trucu3lent- +tu2ment- +turbu3lent- +’u4 +4u- +.ú4 +'ú4 +’ú4 +4ú- +.ù4 +'ù4 +’ù4 +4ù- +’û4 +4û- +.ü4 +'ü4 +’ü4 +4ü- +-5u4 +-5ú4 +-5ù4 +-5û4 +-5ü4 +.v4 +'v4 +’v4 +4v- +-5v4 +4ve- +veni2ment- +2vent- +ventripo3tent- +4ves- +vidi2ment- +4v4re- +2v2rent- +4v4res- +.w4 +'w4 +’w4 +4w- +-5w4 +4we- +2went- +4wes- +.x4 +'x4 +’x4 +4x- +-5x4 +2xent- +’y4 +4y- +.ý4 +'ý4 +’ý4 +4ý- +.ÿ4 +'ÿ4 +’ÿ4 +4ÿ- +-5y4 +-5ý4 +-5ÿ4 +.z4 +'z4 +’z4 +4z- +.ž4 +'ž4 +’ž4 +4ž- +-5z4 +-5ž4 +4ze- +2zent- +4zes- diff --git a/hyphenate/hyphenate/info.rkt b/hyphenate/hyphenate/info.rkt new file mode 100644 index 00000000..f67642ca --- /dev/null +++ b/hyphenate/hyphenate/info.rkt @@ -0,0 +1,4 @@ +#lang info +(define scribblings '(("scribblings/hyphenate.scrbl" ()))) +(define compile-omit-paths '("tests.rkt")) +(define post-install-collection "post-installer.rkt") \ No newline at end of file diff --git a/hyphenate/hyphenate/main.rkt b/hyphenate/hyphenate/main.rkt new file mode 100644 index 00000000..3d998d3e --- /dev/null +++ b/hyphenate/hyphenate/main.rkt @@ -0,0 +1,7 @@ +#lang racket +(require "us.rkt") +(provide (all-from-out "us.rkt")) + +(module+ safe + (require (submod "us.rkt" safe)) + (provide (all-from-out (submod "us.rkt" safe)))) \ No newline at end of file diff --git a/hyphenate/hyphenate/post-installer.rkt b/hyphenate/hyphenate/post-installer.rkt new file mode 100644 index 00000000..90fafc35 --- /dev/null +++ b/hyphenate/hyphenate/post-installer.rkt @@ -0,0 +1,8 @@ +#lang racket/base +(provide (all-defined-out)) + +(define (post-installer home-dir) + (for ([mod '(hyphenate/us hyphenate/fr)]) + (displayln (format "running post-installer in ~a" mod)) + (define proc (dynamic-require mod 'post-installer)) + (proc home-dir))) \ No newline at end of file diff --git a/hyphenate/hyphenate/private/bootstrap.rkt b/hyphenate/hyphenate/private/bootstrap.rkt new file mode 100644 index 00000000..d5994008 --- /dev/null +++ b/hyphenate/hyphenate/private/bootstrap.rkt @@ -0,0 +1,85 @@ +#lang racket/base +(require (for-syntax racket/base syntax/strip-context) + txexpr/base + sugar/define + racket/contract + racket/file + racket/fasl + (only-in xml xexpr/c) + (prefix-in core: hyphenate/private/core)) + +(provide (rename-out [mb #%module-begin]) #%top-interaction #%top #%datum #%app) + +;; An exception-word is a string of word characters or hyphens. +(define (exception-word? x) + (and (string? x) (regexp-match #px"^(\\p{L}|-)+$" x) #t)) +(define (exception-words? xs) + (and (list? xs) (andmap exception-word? xs))) + +(define hyphenate/c + ((xexpr?) ((or/c char? string?) + #:exceptions exception-words? + #:min-length (or/c integer? #f) + #:omit-word (string? . -> . any/c) + #:omit-string (string? . -> . any/c) + #:omit-txexpr (txexpr? . -> . any/c) + #:min-left-length (or/c (and/c integer? positive?) #f) + #:min-right-length (or/c (and/c integer? positive?) #f) + #:min-hyphens (and/c integer? positive?)) . ->* . xexpr/c)) + +(define (make-hyphenate-function patterns exceptions) + (make-keyword-procedure + ;; put caches here so they can persist across successive invocations of the function. + ;; but remain distinct between instantiations of this module (say, us vs fr) + ;; pass them as arguments to the core:hyphenate func + (let ([word-cache exceptions] ; preload exceptions + [pattern-cache patterns]) + (λ (kws kw-args . rest) + (keyword-apply core:hyphenate kws kw-args word-cache pattern-cache rest))))) + +(define (make-unhyphenate-function) + (make-keyword-procedure + (λ (kws kw-args . rest) + (keyword-apply core:unhyphenate kws kw-args rest)))) + +(define unhyphenate/c + ((xexpr/c) ((or/c char? string?) + #:omit-word (string? . -> . any/c) + #:omit-string (string? . -> . any/c) + #:omit-txexpr (txexpr? . -> . any/c)) . ->* . xexpr/c)) + +(define (load-from-cache-if-possible module-path cache-path id-sym) + (unless (and (file-exists? cache-path) + (> (file-or-directory-modify-seconds cache-path) + (file-or-directory-modify-seconds module-path))) + (with-output-to-file cache-path + (λ () (s-exp->fasl (dynamic-require module-path id-sym) (current-output-port))) + #:exists 'replace)) + (with-input-from-file cache-path + (λ () (fasl->s-exp (current-input-port))))) + +(define-syntax (mb stx) + (syntax-case stx () + [(_ DIR) + (let* ([base (let-values ([(base name _) (split-path (syntax-source stx))]) + base)] + [dir (build-path base (symbol->string (syntax->datum #'DIR)))]) + (with-syntax ([PATTERNS-PATH (build-path dir "patterns.rkt")] + [PATTERN-CACHE-PATH (build-path dir "compiled" "patterns-cache.rktd")] + [EXCEPTIONS-PATH (build-path dir "exceptions.rkt")] + [EXCEPTIONS-CACHE-PATH (build-path dir "compiled" "exceptions-cache.rktd")] + [PATTERNS-ID 'patterns] + [EXCEPTIONS-ID 'exceptions]) + #'(#%module-begin + (define PATTERNS-ID (load-from-cache-if-possible PATTERNS-PATH PATTERN-CACHE-PATH 'PATTERNS-ID)) + ;; a file-cached hash is immutable, so convert it + (define EXCEPTIONS-ID (make-hash (hash->list (load-from-cache-if-possible EXCEPTIONS-PATH EXCEPTIONS-CACHE-PATH 'EXCEPTIONS-ID)))) + (define+provide (post-installer home-dir) + (load-from-cache-if-possible PATTERNS-PATH PATTERN-CACHE-PATH 'PATTERNS-ID) + (load-from-cache-if-possible EXCEPTIONS-PATH EXCEPTIONS-CACHE-PATH 'EXCEPTIONS-ID)) + (define+provide+safe hyphenate + hyphenate/c + (make-hyphenate-function PATTERNS-ID EXCEPTIONS-ID)) + (define+provide+safe unhyphenate + unhyphenate/c + (make-unhyphenate-function)))))])) \ No newline at end of file diff --git a/hyphenate/hyphenate/private/core.rkt b/hyphenate/hyphenate/private/core.rkt new file mode 100644 index 00000000..85c14fda --- /dev/null +++ b/hyphenate/hyphenate/private/core.rkt @@ -0,0 +1,218 @@ +#lang racket/base +(require txexpr/base racket/string racket/list) +(provide hyphenate unhyphenate word->hyphenation-points exception-word->word+pattern string->hashpair) + +(module+ test + (require rackunit)) + + +;; module default values +(define default-min-length 5) +(define default-min-left-length 2) +(define default-min-right-length 2) +(define default-joiner #\u00AD) +(define default-min-hyphen-count 1) + + +(define (exception-word->word+pattern ew) + ;; an exception word indicates its breakpoints with added hyphens + (define word (string-replace ew "-" "")) + ;; pattern has same number of points as word letters. 1 marks hyphenation point; 0 no hyphenation + (define points + (cdr (map (λ (x) (if (equal? x "-") 1 0)) (regexp-split #px"\\p{L}" ew)))) + ;; use list here so we can `apply` in `add-exception-word` + (list word points)) + + +(module+ test + (check-equal? (exception-word->word+pattern "snôw-man") '("snôwman" (0 0 0 1 0 0 0))) + (check-equal? (exception-word->word+pattern "snôwman") '("snôwman" (0 0 0 0 0 0 0))) + (check-equal? (exception-word->word+pattern "sn-ôw-ma-n") '("snôwman" (0 1 0 1 0 1 0)))) + + +(define (add-exception-word word-cache word) + ;; `hash-set!` not `hash-ref!`, because we want an exception to override an existing value + (apply hash-set! word-cache (exception-word->word+pattern word))) + + +(define (remove-exception-word word-cache word) + (hash-remove! word-cache (string-replace word "-" ""))) + + +(define (string->natural i) + (let* ([result (string->number i)] + [result (and result (inexact->exact result))] + [result (and (exact-nonnegative-integer? result) result)]) + result)) + + +(module+ test + (check-equal? (string->natural "Foo") #f) + (check-equal? (string->natural "1.0") 1) + (check-equal? (string->natural "-3") #f)) + + +(define (string->hashpair pat) + (define-values (strs nums) + (for/lists (strs nums) + ;; using unicode-aware regexps to allow unicode hyphenation patterns + ;; a pattern is a list of subpatterns, each of which is a character possibly followed by a number. + ;; also, the first position may just have a number. + ([subpat (in-list (regexp-match* #px"^\\d?|(\\p{L}|\\p{P})\\d?" pat))]) + (define str (cond + [(regexp-match #px"(\\p{L}|\\p{P})?" subpat) => car] + [else ""])) + (define num (cond + [(regexp-match #px"\\d" subpat) => (compose1 string->natural car)] + [else 0])) + (values str num))) + (list (string-append* strs) nums)) + + +(module+ test + (check-equal? (string->hashpair "2'2") '("'" (2 2))) + (check-equal? (string->hashpair ".â4") '(".â" (0 0 4))) + (check-equal? (string->hashpair ".ý4") '(".ý" (0 0 4))) + (check-equal? (string->hashpair "'ý4") '("'ý" (0 0 4))) + (check-equal? (string->hashpair "’ý4") '("’ý" (0 0 4))) + (check-equal? (string->hashpair "4ý-") '("ý-" (4 0 0))) + (check-equal? (string->hashpair ".ach4") '(".ach" (0 0 0 0 4)))) + + +(define (calculate-max-pattern patterns) + ;; each pattern is a list of numbers + ;; all the patterns have the same length + ;; run max against parallel elements + (apply map (λ xs (apply max xs)) patterns)) + + +(module+ test + (require rackunit) + (check-equal? (calculate-max-pattern '((1 0 0))) '(1 0 0)) + (check-equal? (calculate-max-pattern '((1 0 0) (0 1 0))) '(1 1 0)) + (check-equal? (calculate-max-pattern '((1 0 0) (0 1 0) (0 0 1))) '(1 1 1)) + (check-equal? (calculate-max-pattern '((1 2 3) (2 3 1) (3 1 2))) '(3 3 3))) + + +(define (make-points word word-cache pattern-cache) + (hash-ref! word-cache word + (λ () + ;; dots are used to denote the beginning and end of the word when matching patterns + (define boundary-marker ".") + (define word-with-boundaries (format "~a~a~a" boundary-marker (string-downcase word) boundary-marker)) + (define word-length (string-length word-with-boundaries)) + (define default-zero-pattern (make-list (add1 word-length) 0)) + ;; walk through all the substrings and see if there's a matching pattern. + (define matching-patterns + (for*/list ([start (in-range word-length)] + [end (in-range start word-length)] + [substr (in-value (substring word-with-boundaries start (add1 end)))] + [partial-pattern (in-value (hash-ref pattern-cache (string->symbol substr) #f))] + #:when partial-pattern) + ;; pad out partial-pattern to full length + ;; (so we can compare patterns to find max value for each slot) + (define left-zeroes (make-list start 0)) + (define right-zeroes (make-list (- (add1 word-length) (length partial-pattern) start) 0)) + (append left-zeroes partial-pattern right-zeroes))) + (define max-pattern (calculate-max-pattern (cons default-zero-pattern matching-patterns))) + ;; for point list generated from a pattern, + ;; drop first two elements because they represent hyphenation weight + ;; before the starting "." and between "." and the first letter. + ;; drop last element because it represents hyphen after last "." + ;; after you drop these two, then each number corresponds to + ;; whether a hyphen goes after that letter. + (drop-right (drop max-pattern 2) 1)))) + + +;; Find hyphenation points in a word. This is not quite synonymous with syllables. +(define (word->hyphenation-points word + word-cache pattern-cache + [min-length #f] + [min-left-length #f] + [min-right-length #f]) + + (cond + [(< (string-length word) (or min-length default-min-length)) (list word)] + [else + ;; points is a list corresponding to the letters of the word. + ;; to create a no-hyphenation zone of length n, zero out the first n-1 points + ;; and the last n points (because the last value in points is always superfluous) + (define word-points + (let* ([points (make-points word word-cache pattern-cache)] + [left-zeroes (min (or min-left-length default-min-left-length) (length points))] + [right-zeroes (min (or min-right-length default-min-right-length) (length points))]) + (for/list ([(point idx) (in-indexed points)]) + (if (<= left-zeroes (add1 idx) (- (length points) right-zeroes)) + point + 0)))) + + ;; odd-valued points in the pattern denote hyphenation points + (define odd-point-indexes (for/list ([(wp idx) (in-indexed word-points)] + #:when (odd? wp)) + idx)) + + ;; the hyphenation goes after the indexed letter, so add1 to the raw points for slicing + (define breakpoints (append (list 0) (map add1 odd-point-indexes) (list (string-length word)))) + (for/list ([start (in-list breakpoints)] + [end (in-list (cdr breakpoints))]) ; shorter list controls exit of loop + (substring word start end))])) + + +;; joiner contract allows char or string; this coerces to string. +(define (joiner->string joiner) (format "~a" joiner)) + + +(define (apply-proc proc x [omit-string (λ (x) #f)] [omit-txexpr (λ (x) #f)] [joiner default-joiner]) + (let loop ([x x]) + (cond + [(and (string? x) (not (omit-string x))) + ;; handle intercapped words as capitalized pieces + (define letter-before-uc #px"(?<=\\p{Ll})(?=\\p{Lu}\\p{Ll})") ; match xXx but not xXX or XXX + (string-join (for/list ([x (in-list (string-split x letter-before-uc))]) + (proc x)) (joiner->string joiner))] + [(and (txexpr? x) (not (omit-txexpr x))) + (make-txexpr (get-tag x) (get-attrs x) (map loop (get-elements x)))] + [else x]))) + + +(define (hyphenate word-cache pattern-cache x [joiner default-joiner] + #:exceptions [extra-exceptions empty] + #:min-length [min-length default-min-length] + #:min-left-length [min-left-length default-min-left-length] + #:min-right-length [min-right-length default-min-right-length] + #:min-hyphens [min-hyphens-added default-min-hyphen-count] + #:omit-word [omit-word? (λ (x) #f)] + #:omit-string [omit-string? (λ (x) #f)] + #:omit-txexpr [omit-txexpr? (λ (x) #f)]) + + ;; todo?: connect this regexp pattern to the one used in word? predicate + (for-each (λ (ee) (add-exception-word word-cache ee)) extra-exceptions) + (define word-pattern #px"\\p{L}+") ;; more restrictive than exception-word + (define (replacer word . words) + (cond + [(omit-word? word) word] + [else (define hyphenation-points + (word->hyphenation-points word word-cache pattern-cache min-length min-left-length min-right-length)) + (cond + [(>= (sub1 (length hyphenation-points)) min-hyphens-added) + (string-join hyphenation-points (joiner->string joiner))] + [else word])])) + (define (insert-hyphens text) (regexp-replace* word-pattern text replacer)) + (begin0 + (apply-proc insert-hyphens x omit-string? omit-txexpr? joiner) + ;; deleting from the main cache is cheaper than having to do two cache lookups for every word + ;; (missing words will just be regenerated later) + (for-each (λ (ee) (remove-exception-word word-cache ee)) extra-exceptions))) + + +(define (unhyphenate x [joiner default-joiner] + #:omit-word [omit-word? (λ (x) #f)] + #:omit-string [omit-string? (λ (x) #f)] + #:omit-txexpr [omit-txexpr? (λ (x) #f)]) + (define word-pattern (pregexp (format "[\\w~a]+" joiner))) + (define (replacer word . words) + (if (not (omit-word? word)) + (string-replace word (joiner->string joiner) "") + word)) + (define (remove-hyphens text) (regexp-replace* word-pattern text replacer)) + (apply-proc remove-hyphens x omit-string? omit-txexpr?)) diff --git a/hyphenate/hyphenate/private/exception-prep.rkt b/hyphenate/hyphenate/private/exception-prep.rkt new file mode 100644 index 00000000..7c3e8fa7 --- /dev/null +++ b/hyphenate/hyphenate/private/exception-prep.rkt @@ -0,0 +1,21 @@ +#lang racket/base +(require racket/string racket/list hyphenate/private/core) +(provide (rename-out [emb #%module-begin]) #%app #%datum #%top-interaction) + +(define-syntax-rule (emb STRS) + (#%module-begin + (provide exceptions) + (define exceptions (for/hash ([str (in-list (list . STRS))]) + (define key+val (exception-word->word+pattern str)) + (values (first key+val) (second key+val)))) + (module+ main exceptions))) + +(module+ reader + (require racket/port) + (provide (rename-out [exception-prep-read-syntax read-syntax])) + + (define (exception-prep-read-syntax src in) + (with-syntax ([STRS (string-split (port->string in))]) + (syntax->datum + #'(module exception-prep hyphenate/private/exception-prep + STRS))))) \ No newline at end of file diff --git a/hyphenate/hyphenate/private/pattern-prep.rkt b/hyphenate/hyphenate/private/pattern-prep.rkt new file mode 100644 index 00000000..e79c200d --- /dev/null +++ b/hyphenate/hyphenate/private/pattern-prep.rkt @@ -0,0 +1,21 @@ +#lang racket/base +(require hyphenate/private/core racket/list racket/file) +(provide (rename-out [pmb #%module-begin]) #%app #%datum #%top-interaction) + +(define-syntax-rule (pmb STRS) + (#%module-begin + (provide patterns) + (define patterns (for/hasheq ([str (in-list (list . STRS))]) + (define key+val (string->hashpair str)) + (values (string->symbol (first key+val)) (second key+val)))) + (module+ main patterns))) + +(module+ reader + (provide read-syntax) + (define (read-syntax src in) + (with-syntax ([STRS (for/list ([line (in-lines in)] + #:when (and (positive? (string-length line)) ; omit empty + (not (regexp-match #rx"^;" line)))) ; omit comments + line)]) + (syntax->datum #'(module patterns hyphenate/private/pattern-prep + STRS))))) \ No newline at end of file diff --git a/hyphenate/hyphenate/scribblings/hyphenate.scrbl b/hyphenate/hyphenate/scribblings/hyphenate.scrbl new file mode 100644 index 00000000..e24f2db9 --- /dev/null +++ b/hyphenate/hyphenate/scribblings/hyphenate.scrbl @@ -0,0 +1,240 @@ +#lang scribble/manual + +@(require scribble/eval (for-label txexpr racket hyphenate xml)) + +@(define my-eval (make-base-eval)) +@(my-eval `(require txexpr hyphenate xml)) + + +@title{Hyphenate} + +@author[(author+email "Matthew Butterick" "mb@mbtype.com")] + + +@defmodule[#:multi (hyphenate (submod hyphenate safe))] + +A simple hyphenation engine that uses the Knuth–Liang hyphenation algorithm originally developed for TeX. I have added little to their work. Accordingly, I take little credit. + +@section{Installation} + +At the command line: +@verbatim{raco pkg install hyphenate} + +After that, you can update the package like so: +@verbatim{raco pkg update hyphenate} + +@section{Importing the module} + +The module can be invoked two ways: fast or safe. + +Fast mode is the default, which you get by importing the module in the usual way: @code{(require hyphenate)}. + +Safe mode enables the function contracts documented below. Use safe mode by importing the module as @code{(require (submod hyphenate safe))}. + +@section{Interface} + +@defproc[ +(hyphenate +[xexpr xexpr/c] +[joiner (or/c char? string?) (integer->char #x00AD)] +[#:exceptions exceptions (listof string?) empty] +[#:min-length length (or/c integer? false?) 5] +[#:min-left-length left-length (or/c (and/c integer? positive?) #f) 2] +[#:min-right-length right-length (or/c (and/c integer? positive?) #f) 2] +[#:min-hyphens min-hyphen-count (and/c integer? positive?) 1] +[#:omit-word word-test (string? . -> . any/c) (λ (x) #f)] +[#:omit-string string-test (string? . -> . any/c) (λ (x) #f)] +[#:omit-txexpr txexpr-test (txexpr? . -> . any/c) (λ (x) #f)]) +xexpr/c] +Hyphenate @racket[_xexpr] by calculating hyphenation points and inserting @racket[_joiner] at those points. By default, @racket[_joiner] is the soft hyphen (Unicode 00AD = decimal 173). Words shorter than @racket[#:min-length] @racket[_length] will not be hyphenated. To hyphenate words of any length, use @racket[#:min-length] @racket[#f]. + +@margin-note{The REPL displays a soft hyphen as @code{\u00AD}. But in ordinary use, you'll only see a soft hyphen when it appears at the end of a line or page as part of a hyphenated word. Otherwise it's not displayed. In most of the examples here, I use a standard hyphen for clarity (by adding @code{#\-} as an argument).} + +@examples[#:eval my-eval + (hyphenate "snowman polymorphism") + (hyphenate "snowman polymorphism" #\-) + (hyphenate "snowman polymorphism" #:min-length 13) + (hyphenate "snowman polymorphism" #:min-length #f) + ] + +The @racket[#:min-left-length] and @racket[#:min-right-length] keyword arguments set the minimum distance between a potential hyphen and the left or right ends of the word. The default is 2 characters. Larger values will reduce hyphens, but also prevent small words from breaking. These values will override a smaller @racket[#:min-length] value. + +@examples[#:eval my-eval + (hyphenate "snowman polymorphism" #\-) + (hyphenate "snowman polymorphism" #\- #:min-left-length #f) + (hyphenate "snowman polymorphism" #\- #:min-length 2 #:min-left-length 5) + (hyphenate "snowman polymorphism" #\- #:min-right-length 6) + (code:comment @#,t{Next words won't be hyphenated becase of large #:min-left-length}) + (hyphenate "snowman polymorphism" #\- #:min-length #f #:min-left-length 15) + ] + +Another way of controlling hyphen frequency is with the @racket[#:min-hyphens] keyword argument, which sets the minimum number of hyphens in a hyphenatable word. (It has no effect on non-hyphenatable words.) The default is 1 hyphen. Larger values will reduce hyphens, but also prevent small words from breaking. + +@examples[#:eval my-eval + (hyphenate "snowman polymorphism" #\-) + (hyphenate "snowman polymorphism" #\- #:min-hyphens 1) + (code:comment @#,t{next "snowman" won't be hyphenated becase it doesn't have 2 hyphens}) + (hyphenate "snowman polymorphism" #\- #:min-hyphens 2) + (code:comment @#,t{next "polymorphism" won't be hyphenated becase it doesn't have 3 hyphens}) + (hyphenate "snowman polymorphism" #\- #:min-hyphens 3) +] + +Because the hyphenation is based on an algorithm rather than a dictionary, it makes good guesses with unusual words: + +@examples[#:eval my-eval + (hyphenate "scraunched strengths" #\-) + (hyphenate "RacketCon" #\-) + (hyphenate "supercalifragilisticexpialidocious" #\-) + ] + +Using the @racket[#:exceptions] keyword, you can pass hyphenation exceptions as a list of words with hyphenation points marked with regular hyphens (@racket["-"]). If an exception word contains no hyphens, that word will never be hyphenated. + +@examples[#:eval my-eval + (hyphenate "polymorphism" #\-) + (hyphenate "polymorphism" #\- #:exceptions '("polymo-rphism")) + (hyphenate "polymorphism" #\- #:exceptions '("polymorphism")) + ] + +Knuth & Liang were sufficiently confident about their algorithm that they originally released it with only 14 exceptions: @italic{associate[s], declination, obligatory, philanthropic, present[s], project[s], reciprocity, recognizance, reformation, retribution}, and @italic{table}. Admirable bravado, but it's not hard to discover others that need adjustment. + +@examples[#:eval my-eval + (hyphenate "wrong: columns signage lawyers" #\-) + (hyphenate "right: columns signage lawyers" #\- + #:exceptions '("col-umns" "sign-age" "law-yers")) + ] + +The Knuth–Liang algorithm is designed to omit legitimate hyphenation points (i.e., generate false negatives) more often than it creates erroneous hyphenation points (i.e., false positives). This is good policy. Perfect hyphenation — that is, hyphenation that represents an exact linguistic syllabification of each word — is superfluous for typesetting. Hyphenation simply seeks to mark possible line-break and page-break locations for whatever layout engine is drawing the text. The ultimate goal is to permit more even text flow. Like horseshoes and hand grenades, close is good enough. And a word wrongly hyphenated is more likely to be noticed by a reader than a word inefficiently hyphenated. + +For this reason, certain words can't be hyphenated algorithmically, because the correct hyphenation depends on meaning, not merely on spelling. For instance: + +@examples[#:eval my-eval + (hyphenate "adder") + ] + +This is the right result. If you used @italic{adder} to mean the machine, it would be hyphenated @italic{add-er}; if you meant the snake, it would be @italic{ad-der}. Better to avoid hyphenation than to hyphenate incorrectly. + +You can send HTML-style X-expressions through @racket[hyphenate]. It will recursively hyphenate the text strings, while leaving the tags and attributes alone, as well as non-hyphenatable material (like character entities and CDATA). + +@examples[#:eval my-eval + (hyphenate '(p "strangely" (em "formatted" (strong "snowmen"))) #\-) + (hyphenate '(headline [[class "headline"]] "headline") #\-) + (hyphenate '(div "The (span epsilon) entity:" epsilon) #\-) + ] + +Don't send raw HTML or XML through @racket[hyphenate]. It can't distinguish tags and attributes from textual content, so everything will be hyphenated, thus goofing up your file. But you can easily convert your HTML or XML to an X-expression, hyphenate it, and then convert back. + +@examples[#:eval my-eval + (define html "Hello") + (hyphenate html #\-) + (xexpr->string (hyphenate (string->xexpr html) #\-)) + ] + +If you're working with HTML, be careful not to include any @code{