file
)¶Generate a "trie" automaton (a prefix tree) from a finite series, given as a file of (weighted) words.
Postconditions:
Result.is_deterministic()
See also:
import vcsn
%%file words
hello
world
hell
word
vcsn.B.trie('words')
%%file numbers
one
<2>two
<3>three
<4>four
<1/2>half
vcsn.Q.trie('numbers')
%%file translator
<1>one|un
<2>two|deux
<3>three|trois
<4>four|quatre
<14>forteen|quatorze
<40>forty|quarante
vcsn.context('lat<law_char, law_char>, q').trie('translator')