File words.lua

Functions

decomposeWord (trie, word) Decompose a word into its constituent patterns.
decomposeWord2 (trie, word) Decompose a word into its constituent patterns (alternative implementation).
showDecomposedWord (word, values) Output statistics on patterns matching a specific word.


Functions

decomposeWord (trie, word)
Decompose a word into its constituent patterns. The word is padded with "." and converted to lower-case before matching it to the trie.

Parameters:

  • trie: The trie to be used for decomposition.
  • word: Word to decompose.

Return value:

    A table whose values are the asssociated values of identified patterns. There's an entry for every single match of a pattern.
decomposeWord2 (trie, word)
Decompose a word into its constituent patterns (alternative implementation). Considers all characters in a string only once. It manages a queue of active tries into which the same character is fed into in parallel. This one is a bit faster than decomposeWord(); upto twice as fast, at the expense of memory, if the line 'queue[qmin] = nil' is omitted.

Parameters:

  • trie:
  • word:

See also:

showDecomposedWord (word, values)
Output statistics on patterns matching a specific word. The output is of the form word, total number of patterns matching the word (taking multiple matches of a pattern into account), the hyphenation patterns matching the word. Patterns matching multiple times are appended by a colon followed by the number of matches of the patterns. All output is placed on one line per word.

Parameters:

  • word: String containing the word in question.
  • values: A list of values associated with a pattern as provided by decomposeWord() or decomposeWord2().

See also:

Valid XHTML 1.0!