PLEASE NOTE: THIS IS AN OLD VERSION. The current version is linked from The Complete Lojban Language.

11. The lujvo-making algorithm

The following is the current algorithm for generating Lojban lujvo given a known tanru and a complete list of gismu and their assigned rafsi. The algorithm was designed by Bob LeChevalier and Dr. James Cooke Brown for computer program implementation. It was modified in 1989 with the assistance of Nora LeChevalier, who detected a flaw in the original ``tosmabru test''.

Given a tanru that is to be made into a lujvo:

1)
Choose a 3-letter or 4-letter rafsi for each of the gismu and cmavo in the tanru except the last.
2)
Choose a 3-letter (CVV-form or CCV-form) or 5-letter rafsi for the final gismu in the tanru.
3)
Join the resulting string of rafsi, initially without hyphens.
4)
Add hyphen letters where necessary. It is illegal to add a hyphen at a place that is not required by this algorithm. Right-to-left tests are recommended, for reasons discussed below.
4a)
If there are more than two words in the tanru, put an ``r''-hyphen (or an ``n''-hyphen) after the first rafsi if it is CVV-form. If there are exactly two words, then put an ``r''-hyphen (or an ``n''-hyphen) between the two rafsi if the first rafsi is CVV-form, unless the second rafsi is CCV-form (for example, ``saicli'' requires no hyphen). Use an ``r''-hyphen unless the letter after the hyphen is ``r'', in which case use an ``n''-hyphen. Never use an ``n''-hyphen unless it is required.
4b)
Put a ``y''-hyphen between the consonants of any impermissible consonant pair. This will always appear between rafsi.
4c)
Put a ``y''-hyphen after any 4-letter rafsi form.
5)
Test all forms with one or more initial CVC-form rafsi --- with the pattern ``CVC ... CVC + X'' --- for ``tosmabru failure''. X must either be a CVCCV long rafsi that happens to have a permissible initial pair as the consonant cluster, or is something which has caused a ``y''-hyphen to be installed between the previous CVC and itself by one of the above rules. The test is as follows:
5a)
Examine all the C/C consonant pairs that join the CVC rafsi, and also the pair between the last CVC and the X portion, ignoring any ``y''-hyphen before the X. These consonant pairs are called ``joints''.
5b)
If all of those joints are permissible initials, then the trial word will break up into a cmavo and a shorter brivla. If not, the word will not break up, and no further hyphens are needed.
5c)
Install a ``y''-hyphen at the first such joint.

Note that the ``tosmabru test'' implies that the algorithm will be more efficient if rafsi junctures are tested for required hyphens from right to left, instead of from left to right; when the test is required, it cannot be completed until hyphenation to the right has been determined.