Gfsm::Automaton::Indexed - libgfsm finite-state automata, indexed |
Gfsm::Automaton::Indexed - libgfsm finite-state automata, indexed
use Gfsm;
##------------------------------------------------------------ ## Constructors, etc.
$xfsm = Gfsm::Automaton::Indexed->new(); $xfsm = Gfsm::Automaton::Indexed->new($is_transducer,$srtype,$n_states,$n_arcs);
$xfsm2 = $xfsm->clone(); # copy constructor $xfsm2->assign($xfsm1); # assigns $fsm1 to $fsm2
$xfsm->clear(); # clear automaton structure
##-------------------------------------------------------------- ## Import & Export
$fsm = $xfsm->to_automaton(); # convert Gfsm::Automaton::Indexed -> Gfsm::Automaton $xfsm = $fsm->to_indexed(); # convert Gfsm::Automaton -> Gfsm::Automaton::Indexed
##------------------------------------------------------------ ## Accessors/Manipulators: Properties
$bool = $xfsm->is_transducer(); # get 'is_transducer' flag $bool = $xfsm->is_transducer($bool); # ... or set it
$bool = $xfsm->is_weighted(?$bool); # get/set 'is_weighted' flag $mode = $xfsm->sort_mode(?$mode); # get/set sort-mode flag (dangerous) $bool = $xfsm->is_deterministic(?$bool); # get/set 'is_deterministic' flag (dangerous) $srtype = $xfsm->semiring_type(?$srtype); # get/set semiring type
$n = $xfsm->n_states(); # get number of states $n = $xfsm->n_arcs(); # get number of arcs
$id = $xfsm->root(?$id); # get/set id of initial state $bool = $xfsm->has_state($id); # check whether a state exists
##------------------------------------------------------------ ## Accessors/Manipulators: States
$id = $xfsm->add_state(); # add a new state $id = $xfsm->ensure_state($id); # ensure that a state exists
$xfsm->remove_state($id); # remove a state from an FSM (currently does nothing)
$bool = $xfsm->is_final($id,?$bool); # get/set final-flag for state $id
$deg = $xfsm->out_degree($id); # get number of outgoing arcs for state $id
$w = $xfsm->final_weight($id,?$w); # get/set final weight for state $id
##------------------------------------------------------------ ## Accessors/Manipulators: Arcs
$fsm->arcsort($fsm,$mode); # sort automaton arcs
##-- TODO: arc range iterator access!
##-------------------------------------------------------------- ## I/O
$bool = $xfsm->load($filename_or_handle); # load binary file $bool = $xfsm->save($filename_or_handle); # save binary file
$bool = $xfsm->load_string($buffer); # load from in-memory buffer $string $bool = $xfsm->save_string($buffer); # save to in-memory buffer $string
$bool = $xfsm->viewps(%options); # for debugging (uses to_automaton())
Not yet written.
Probably many.
Gfsm(3perl)
,
Gfsm::Automaton(3perl),
gfsmutils(1)
.
Bryan Jurish <moocow@cpan.org>
Copyright (C) 2005-2008 by Bryan Jurish
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
Gfsm::Automaton::Indexed - libgfsm finite-state automata, indexed |