Skip to content

transducer: convenience option for process words iteratively (and showing output) #18118

Closed
@dkrenn

Description

@dkrenn

This ticket introduces a new option so that iter_processs gives the output of a transducer (when processing a word) step by step. If the transducer branches (non-deterministic transducer), an exception is raised.

This is in contrast to the existing implementation, where the full output (including information on all branches of the process) is given back in each step during iteration.

An example:

sage: inverter = Transducer({'A': [('A', 0, 1), ('A', 1, 0)]},
....:     initial_states=['A'], final_states=['A'])
sage: it = inverter.iter_process(
....:     words.FibonacciWord(), iterator_type='simple')
sage: from itertools import islice
sage: [o for o in islice(it, 0, 5)]  # only output the first 5 letters
[1, 0, 1, 1, 0]

CC: @cheuberg @sagetrac-skropf

Component: finite state machines

Keywords: sd66

Author: Daniel Krenn

Branch/Commit: 9a88fc1

Reviewer: Clemens Heuberger

Issue created by migration from https://trac.sagemath.org/ticket/18118

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions