import vcsn
vcsn.B.trie('''foo
bar
baz''')

%%file words
hello
world
hell
word

vcsn.B.trie(filename='words')

"""
Explanation: context.trie(data="", format="default", filename="")
Generate a "trie" automaton (a prefix tree) from a finite series, given as a file of (weighted) words.
Arguments:
- data: a string containing the list of words
- format:
  - "default": same as "monomials"
  - "monomials": each line contains a weighted word in the monomials syntax: &lt;2&gt;foo
  - "words": each line contains a single word: foo.  In this case &lt;2&gt;foo is read as a five-letter word.
Postconditions:
- Result.is_deterministic()
See also:
- context.cotrie
- polynomial.cotrie
- polynomial.trie
Examples
Words (finite language)
End of explanation
"""


vcsn.Q.trie('''
one
<2>two
<3>three
<13>thirteen
<30>thirty
<51>thirsty''')

"""
Explanation: Weighted words (finite series)
End of explanation
"""


vcsn.context('lat<law_char, law_char>, q').trie('''
<1>one|un
<2>two|deux
<3>three|trois
<4>four|quatre
<14>forteen|quatorze
<40>forty|quarante''')

"""
Explanation: Tuples of words
End of explanation
"""


