HFST - Helsinki Finite-State Transducer Technology API  version 3.7.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
hfst::rules Namespace Reference

A namespace for functions that create two-level, replace, restriction and coercion rule transducers. More...

Functions

HfstTransducer coercion (HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
 A transducer that requires that one of the mappings defined by mapping must occur in each context in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet. More...
 
HfstTransducer deep_coercion (HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
 A transducer that specifies that a string from the output language of the transducer mapping always has to be mapped to one of its input strings (according to transducer mappings) if it appears in any of the contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet. More...
 
HfstTransducer deep_restriction (HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
 A transducer that specifies that a string from the output language of the transducer mapping may only be mapped to one of its input strings (according to transducer mappings) if it appears in any of the contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet. More...
 
HfstTransducer deep_restriction_and_coercion (HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
 A transducer that is equivalent to the intersection of deep_restriction and deep_coercion. More...
 
HfstTransducer left_replace_down (HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 Inversion of the replace_up and the result needs to be composed on the upper side of the input language. However, matching is done on the output side of mapping. More...
 
HfstTransducer left_replace_down_karttunen (HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 Inversion of the replace_up and the result needs to be composed on the upper side of the input language. However, matching is done on the output side of mapping. More...
 
HfstTransducer left_replace_left (HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 Inversion of the replace_up and the result needs to be composed on the upper side of the input language. However, left context matching is done on the input side of mapping and right context on the output side of mapping. More...
 
HfstTransducer left_replace_right (HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 Inversion of the replace_up and the result needs to be composed on the upper side of the input language. However, left context matching is done on the output side of mapping and right context on the input side of mapping. More...
 
HfstTransducer left_replace_up (HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 Inversion of the replace_up and the result needs to be composed on the upper side of the input language. More...
 
HfstTransducer left_replace_up (HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 Inversion of the replace_up and the result needs to be composed on the upper side of the input language. More...
 
HfstTransducer replace_down (HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 The same as replace_up, but matching is done on the output side of mapping. More...
 
HfstTransducer replace_down (HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 The same as replace_down(HfstTransducerPair&, HfstTransducer&, bool, StringPairSet&) but mapping is performed in every context. More...
 
HfstTransducer replace_left (HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 The same as replace_up, but left context matching is done on the input side of mapping and right context on the output side of mapping. More...
 
HfstTransducer replace_right (HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 The same as replace_up, but left context matching is done on the output side of mapping and right context on the input side of mapping. More...
 
HfstTransducer replace_up (HfstTransducerPair &context, HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 A transducer that performs an upward mapping mapping in the context context when the alphabet is alphabet. optional defines whether the mapping is optional. More...
 
HfstTransducer replace_up (HfstTransducer &mapping, bool optional, StringPairSet &alphabet)
 The same as replace_up but mapping is performed in every context. More...
 
HfstTransducer restriction (HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
 A transducer that allows any (substring) mapping defined by mapping only if it occurs in any of the contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet. More...
 
HfstTransducer restriction_and_coercion (HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
 A transducer that is equivalent to the intersection of restriction and coercion and requires that the mappings defined by mapping occur always and only in the given contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet. More...
 
HfstTransducer surface_coercion (HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
 A transducer that specifies that a string from the input language of the transducer mapping always has to the mapped to one of its output strings according to transducer mapping if it appears in any of the contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet. More...
 
HfstTransducer surface_restriction (HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
 A transducer that specifies that a string from the input language of the transducer mapping may only be mapped to one of its output strings (according to transducer mapping) if it appears in any of the contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet. More...
 
HfstTransducer surface_restriction_and_coercion (HfstTransducerPairVector &contexts, HfstTransducer &mapping, StringPairSet &alphabet)
 A transducer that is equivalent to the intersection of surface_restriction and surface_coercion. More...
 
HfstTransducer two_level_if (HfstTransducerPair &context, StringPairSet &mappings, StringPairSet &alphabet)
 A transducer that obligatorily performs the mappings defined by mappings in the context context when the alphabet is alphabet. More...
 
HfstTransducer two_level_if_and_only_if (HfstTransducerPair &context, StringPairSet &mappings, StringPairSet &alphabet)
 A transducer that always performs the mappings defined by mappings in the context context and only in that context, when the alphabet is alphabet. More...
 
HfstTransducer two_level_only_if (HfstTransducerPair &context, StringPairSet &mappings, StringPairSet &alphabet)
 A transducer that allows the mappings defined by mappings only in the context context, when the alphabet is alphabet. More...
 

Detailed Description

A namespace for functions that create two-level, replace, restriction and coercion rule transducers.

Function Documentation

HfstTransducer coercion ( HfstTransducerPairVector &  contexts,
HfstTransducer &  mapping,
StringPairSet &  alphabet 
)

A transducer that requires that one of the mappings defined by mapping must occur in each context in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet.

See Also
SFST manual.
HfstTransducer deep_coercion ( HfstTransducerPairVector &  contexts,
HfstTransducer &  mapping,
StringPairSet &  alphabet 
)

A transducer that specifies that a string from the output language of the transducer mapping always has to be mapped to one of its input strings (according to transducer mappings) if it appears in any of the contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet.

See Also
SFST manual.
HfstTransducer deep_restriction ( HfstTransducerPairVector &  contexts,
HfstTransducer &  mapping,
StringPairSet &  alphabet 
)

A transducer that specifies that a string from the output language of the transducer mapping may only be mapped to one of its input strings (according to transducer mappings) if it appears in any of the contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet.

See Also
SFST manual.
HfstTransducer deep_restriction_and_coercion ( HfstTransducerPairVector &  contexts,
HfstTransducer &  mapping,
StringPairSet &  alphabet 
)

A transducer that is equivalent to the intersection of deep_restriction and deep_coercion.

See Also
deep_restriction deep_coercion SFST manual.
HfstTransducer left_replace_down ( HfstTransducerPair &  context,
HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

Inversion of the replace_up and the result needs to be composed on the upper side of the input language. However, matching is done on the output side of mapping.

See Also
replace_up
HfstTransducer left_replace_down_karttunen ( HfstTransducerPair &  context,
HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

Inversion of the replace_up and the result needs to be composed on the upper side of the input language. However, matching is done on the output side of mapping.

See Also
replace_up
HfstTransducer left_replace_left ( HfstTransducerPair &  context,
HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

Inversion of the replace_up and the result needs to be composed on the upper side of the input language. However, left context matching is done on the input side of mapping and right context on the output side of mapping.

See Also
replace_up
HfstTransducer left_replace_right ( HfstTransducerPair &  context,
HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

Inversion of the replace_up and the result needs to be composed on the upper side of the input language. However, left context matching is done on the output side of mapping and right context on the input side of mapping.

See Also
replace_up
HfstTransducer left_replace_up ( HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

Inversion of the replace_up and the result needs to be composed on the upper side of the input language.

B <- A is the inversion of A -> B.

Mapping is performed in every context.

See Also
replace_up
HfstTransducer left_replace_up ( HfstTransducerPair &  context,
HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

Inversion of the replace_up and the result needs to be composed on the upper side of the input language.

B <- A is the inversion of A -> B.

See Also
replace_up
HfstTransducer replace_down ( HfstTransducerPair &  context,
HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

The same as replace_up, but matching is done on the output side of mapping.

See Also
replace_up SFST manual.
HfstTransducer replace_down ( HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

The same as replace_down(HfstTransducerPair&, HfstTransducer&, bool, StringPairSet&) but mapping is performed in every context.

See Also
replace_up
HfstTransducer replace_left ( HfstTransducerPair &  context,
HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

The same as replace_up, but left context matching is done on the input side of mapping and right context on the output side of mapping.

See Also
replace_up SFST manual.
HfstTransducer replace_right ( HfstTransducerPair &  context,
HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

The same as replace_up, but left context matching is done on the output side of mapping and right context on the input side of mapping.

See Also
replace_up SFST manual.
HfstTransducer replace_up ( HfstTransducerPair &  context,
HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

A transducer that performs an upward mapping mapping in the context context when the alphabet is alphabet. optional defines whether the mapping is optional.

Parameters
contextA pair of transducers where the first transducer defines the left context and the second transducer the right context. Both transducers must be automata, i.e. map strings onto themselves.
mappingThe mapping that the resulting transducer will perform in the context given in context.
optionalWhether the mapping is optional.
alphabetThe set of symbol pairs that defines the alphabet (see the explanation below).

Each substring s of the input string which is in the input language of the transducer mapping and whose left context is matched by the expression [.* l] (where l is the first element of context) and whose right context is matched by [r .*] (where r is the second element in the context) is mapped to the respective surface strings defined by transducer mapping. Any other character is mapped to the characters specified in alphabet. The left and right contexts must be automata (i.e. transducers which map strings onto themselves).

For example, a transducer yielded by the following arguments

context = pair( [c], [c] )
mappings = [ a:b a:b ]
alphabet = set(a, b, c)

would map the string "caacac" to "cbbcac".

Note that the alphabet must contain the characters a and b, but not the pair a:b (unless this replacement is to be allowed everywhere in the context).

Note that replace operations (unlike the two-level rules) have to be combined by composition rather than intersection.

Exceptions
ContextTransducersAreNotAutomataException
See Also
SFST manual
HfstTransducer replace_up ( HfstTransducer &  mapping,
bool  optional,
StringPairSet &  alphabet 
)

The same as replace_up but mapping is performed in every context.

See Also
replace_up
HfstTransducer restriction ( HfstTransducerPairVector &  contexts,
HfstTransducer &  mapping,
StringPairSet &  alphabet 
)

A transducer that allows any (substring) mapping defined by mapping only if it occurs in any of the contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet.

Exceptions
EmptySetOfContextsException
See Also
SFST manual.
HfstTransducer restriction_and_coercion ( HfstTransducerPairVector &  contexts,
HfstTransducer &  mapping,
StringPairSet &  alphabet 
)

A transducer that is equivalent to the intersection of restriction and coercion and requires that the mappings defined by mapping occur always and only in the given contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet.

See Also
restriction(HfstTransducerPairVector&, HfstTransducer&, StringPairSet&) coercion SFST manual
HfstTransducer surface_coercion ( HfstTransducerPairVector &  contexts,
HfstTransducer &  mapping,
StringPairSet &  alphabet 
)

A transducer that specifies that a string from the input language of the transducer mapping always has to the mapped to one of its output strings according to transducer mapping if it appears in any of the contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet.

See Also
SFST manual.
HfstTransducer surface_restriction ( HfstTransducerPairVector &  contexts,
HfstTransducer &  mapping,
StringPairSet &  alphabet 
)

A transducer that specifies that a string from the input language of the transducer mapping may only be mapped to one of its output strings (according to transducer mapping) if it appears in any of the contexts in contexts. Symbols outside of the matching substrings are mapped to any symbol allowed by alphabet.

See Also
SFST manual.
HfstTransducer surface_restriction_and_coercion ( HfstTransducerPairVector &  contexts,
HfstTransducer &  mapping,
StringPairSet &  alphabet 
)

A transducer that is equivalent to the intersection of surface_restriction and surface_coercion.

See Also
surface_restriction surface_coercion SFST manual.
HfstTransducer two_level_if ( HfstTransducerPair &  context,
StringPairSet &  mappings,
StringPairSet &  alphabet 
)

A transducer that obligatorily performs the mappings defined by mappings in the context context when the alphabet is alphabet.

Parameters
contextA pair of transducers where the first transducer defines the left context and the second transducer the right context.
mappingsA set of mappings that the resulting transducer will perform in the context given in context.
alphabetThe set of symbol pairs that defines the alphabet (see the example).

For example, a transducer yielded by the following arguments

context = pair( [c|d], [e] )
mappings = set(a:b)
alphabet = set(a, a:b, b, c, d, e, ...)

obligatorily maps the symbol a to b if c or d precedes and e follows. (Elsewhere, the mapping of a to b is optional) This expression is identical to ![.* [c|d] [a:. & !a:b] [e] .*] Note that the alphabet must contain the pair a:b here.

See Also
SFST manual
HfstTransducer two_level_if_and_only_if ( HfstTransducerPair &  context,
StringPairSet &  mappings,
StringPairSet &  alphabet 
)

A transducer that always performs the mappings defined by mappings in the context context and only in that context, when the alphabet is alphabet.

If called with the same arguments as in the example of two_level_if, the transducer maps symbol a to b only and only if c or d precedes and e follows. The mapping of a to b is obligatory in this context and cannot occur in any other context. The expression is equivalent to ![.* [c|d] [a:. & !a:b] [e] .*] & ![ [ ![.* [c|d]] a:b .* ] | [ .* a:b ![[e] .*] ] ]

See Also
two_level_if
HfstTransducer two_level_only_if ( HfstTransducerPair &  context,
StringPairSet &  mappings,
StringPairSet &  alphabet 
)

A transducer that allows the mappings defined by mappings only in the context context, when the alphabet is alphabet.

If called with the same arguments as in the example of two_level_if, the transducer allows the mapping of symbol a to b only if c or d precedes and e follows. The mapping of a to b is optional in this context but cannot occur in any other context. The expression is equivalent to ![ [ ![.* [c|d]] a:b .* ] | [ .* a:b ![[e] .*] ] ]

See Also
two_level_if