Skip to content

XreCompiler

eaxelson edited this page Nov 16, 2017 · 11 revisions

class XreCompiler

A regular expression compiler.

The easiest way to create transducers from regular expressions is probably the function hfst.regex.


__init__ (self)

Construct compiler for OpenFst format (the default) transducers.


__init__ (self, impl)

Create compiler for impl format transducers.


define_xre (self, name, xre)

Add a definition macro. Compiler will replace arcs labeled name with a transducer defined by regular expression xre in later phases of compilation (if set_expand_definitions(True) has been called).


define_transducer (self, name, transducer)

Add a definition macro. Compiler will replace arcs labeled name with a transducer transducer in later phases of compilation (if set_expand_definitions(True) has been called).


define_list (self, name, symbol_list)

todo


define_function (self, name, arguments, xre)

todo


undefine (self, name)

todo


compile (self, xre)

Compile a transducer defined by xre. May return a pointer to empty transducer on non-fatal error. A None pointer is returned on fatal error, if abort is not called. Return: An HfstTransducer pointer.


is_definition (self, name)

Whether name is a definition.


is_function_definition (self, name)

Whether name is a function definition.


set_verbosity (self, v)

Set the verbosity of the compiler.

  • v: True or False

setOutputToConsole (self, v)

(Windows-specific) Whether output is printed to console instead of standard output.

  • v True or False

getOutputToConsole (self, )

(Windows-specific) Whether output is printed to console instead of standard output.


set_expand_definitions (self, v)

Whether definitions are expanded.

  • v True or False
Clone this wiki locally