{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# _automaton_.subword\n",
"\n",
"An automaton that accepts all the suffixes of the subwords accepted by the previous automaton. This is the \"Magnus transform\".\n",
"\n",
"Algorithm:\n",
" Every proper transition yields a spontaneous transition with equal source, destination and weight.\n",
"\n",
"Preconditions:\n",
"- None\n",
"\n",
"Postconditions:\n",
"- the labelset is nullable (even if the input one was not).\n",
"\n",
"See also:\n",
"- [_automaton_.factor](automaton.factor.ipynb)\n",
"- [_automaton_.prefix](automaton.prefix.ipynb)\n",
"- [_automaton_.suffix](automaton.suffix.ipynb)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Examples"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import vcsn"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n",
"\n",
"\n"
],
"text/plain": [
"mutable_automaton>, q>>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%automaton -s a\n",
"context = \"lan_char, q\"\n",
"$ -> 0 <2>\n",
"0 -> 1 <3>a\n",
"1 -> 1 <4>b\n",
"1 -> 2 <5>\\e\n",
"2 -> 3 <6>c\n",
"3 -> 4 <7>d\n",
"3 -> 5 <8>e\n",
"4 -> $ <9>\n",
"6 -> 0 <10>A"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n",
"\n",
"\n"
],
"text/plain": [
"mutable_automaton>, q>>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.subword()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}