TWiki
>
GRM Web
>
PyniniPathsDoc
(revision 2) (raw view)
Edit
Attach
---+ Path iteration This describes classes for iterating over paths in an FST. ---++ =fst::PathIterator= This template class provides a basic iterator over paths. It is constructed from a =const Fst<Arc> &= and an optional argument that specifies whether or not the FST should be checked for acyclicity during construction. The =ILabels()= and =OLabels()= methods return vectors of input and output labels (respectively) of the current path, and the =Weight()= method returns the weight of the current path. This iterator: * is advanced using the =Next()= method, * is exhausted once the =Done()= returns =true=, * is reset using the =Reset()= method, and * signals an error using the =Error()= method. The acyclity check should only be disabled when the caller can ensure finite iteration (e.g., by knowing the FST is acyclic, or limiting the number of iterated paths). ---++ =fst::StringPaths= This template class is a thin wrapper around =fst::PathIterator= which adds =IString()= and =OString()= methods returning input and output strings. These methods use the same string printing methods as =fst::PrintString= and the printing mode is controlled by the enum =fst::StringTokenType= (see [[PyniniStringDoc][here]] for more information). At construction time, users specify printing modes and/or symbol tables for the input and output sides of the FST, whether or not epsilon labels should be ignored when printing the string, and whether or not the FST should be checked for acyclity. This iterator: * is advanced using the =Next()= method, * is exhausted once the =Done()= returns =true=, * is reset using the =Reset()= method, and * signals an error using the =Error()= method. The acyclity check should only be disabled when the caller can ensure finite iteration (e.g., by knowing the FST is acyclic, or limiting the number of iterated paths). ---++ =pynini.StringPaths= Pynini wraps =fst::script::StringPathsClass= with the Python class =StringPaths=. As in C++, this object can be constructed directly from an FST argument, or it can be constructed using the =paths()= method of an (acyclic) =pynini.Fst= instance. Both construction methods take token types for both input- and output sides; for the =SYMBOL= token type, simply provide a =pynini.SymbolTable= argument. This class provides the normal iterator methods (=next()=, =done()=, =reset()=, and =error()=).
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r5
<
r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r2 - 2017-07-27
-
KyleGorman
GRM
Log In
or
Register
GRM Web
Create New Topic
Index
Search
Changes
Notifications
Statistics
Preferences
Webs
Contrib
FST
Forum
GRM
Kernel
Main
Sandbox
TWiki
Main
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback