Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 45898
Kernel: Python 3

context.cotrie(data="", format="default", filename="")

Generate a "cotrie" automaton 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: <2>foo

    • "words": each line contains a single word: foo. In this case <2>foo is read as a five-letter word.

Postconditions:

  • Result.is_codeterministic()

See also:

Examples

Words (finite language)

import vcsn vcsn.B.cotrie('''foo bar fubar''')
Image in a Jupyter notebook
%%file words hello world hell word
Overwriting words
vcsn.B.cotrie('words')
Image in a Jupyter notebook

Weighted words (finite series)

vcsn.Q.cotrie('''one <20>twenty <30>thirty <40>fourty <50>fifty''')
Image in a Jupyter notebook

Tuples of words

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