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

polynomial.trie

Generate a "trie" automaton (a prefix tree) from a finite series, given as a polynomial of words.

Postconditions:

  • Result.is_deterministic()

  • Result = p.trie.shortest(N) for a large enough N.

Properties:

  • The support of result is isomorphic to the support of determinized standard automaton built from the polynomials seen as a rational expression, however weights are not placed at the same locations.

See also:

Examples

import vcsn

Boolean weights (finite language)

language = '\e+a+b+abc+abcd+abdc' b = vcsn.context('lal_char, b') B = vcsn.context('law_char, b') B.polynomial(language).trie()
Image in a Jupyter notebook
b.expression(language).standard().determinize().strip()
Image in a Jupyter notebook

Weighted polynomials of words (finite series)

series = '<2>\e + <3>a + <4>b + <5>abc + <6>abcd + <7>abdc' q = vcsn.context('lal_char, z') Q = vcsn.context('law_char, z') Q.polynomial(series).trie()
Image in a Jupyter notebook
q.expression(series).standard().determinize().strip()
Image in a Jupyter notebook