Yesterday I studied how Papyrix splits words up further into chunks which should get hyphenated. So with all that extra complexity swept away how does the core logic here, the Liang Hyphenation Algorithm, work?
1st up a helper validates it has a subword, populates initial byte+offset arrays, iterates over the codepoints validating them & populating those arrays reencoding into UTF-8, validates the lengths, appends a final entry, fills a 3rd array with -1s, & builds a 4th inverse array.
1/?
Following that Papyrix's implementation of Liang Hyphenation carefully populates (via another helper) the initial state of a state machine propagating any errors, zeroes out a scores array, iterates over the characters, & iterates over (via yet another helper) the scores to reencode valid ones into possible linebreak indices. Taking into account configured minimum prefix/suffix lengths.
For each char it iterates over all subsequent chars following that state machine.
2/4?