HFST: Transducer Key API

This document deals with the datatypes related to input and output labels in transducers. This is most important layer since e.g. HfstAPITransducerLayerOLD uses it.

Datatypes

NOTE. In the tables below, the hfst-lexc and hfst-twolc columns refer to what is or will be needed in hfst-lexc and hfst-twolc, repectively. Y stands for yes, N stands for no.

Name of the type Comment hfst-lexc hfst-twolc
Key An unsigned number for the input (or output) label of a transition between states. Y Y
KeyPair A pair of keys representing a transition in a transducer. Y Y
KeySet A set of keys aka an alphabet of keys. Y Y
KeyPairSet A set of key pairs aka an alphabet of key pairs. Y Y
KeyIterator Iterator over the keys in a KeySet. N  
KeyPairIterator Iterator over the set of key pairs in a KeyPairSet. N  

A few implementation notes:

  1. The interpretation of Keys with special uses may be specified using attributes of the transducers and interpreted by the application.
  2. The implementation can assign a Key to each KeyPair that is in use during the current session.

?: KeyPair as datatype vs. keypair in functions? That is: compound keypair or two words key pair?

Functions

Keys

Type Constant Comment hfst-lexc hfst-twolc
constant Key Epsilon The key number for epsilon is 0. The associated symbol name may be specified by the user. Y Y

KeyPairs

Type Function Comment hfst-lexc hfst-twolc
KeyPair* define_keypair (Key s1, Key s2) Define an key pair with input key s1 and output key s2. Y  
Key get_input_key (KeyPair *s) Get the input key of KeyPair s.    
Key get_output_key (KeyPair *s) Get the output key of KeyPair s.    

Sets and Iterators

Alphabets of Keys and KeyPairs

Type Function Comment hfst-lexc hfst-twolc
KeySet* create_empty_key_set () Define an empty set of keys. Y Y
KeySet* insert_key (Key s, KeySet *Si) Insert s into the set of keys Si and return the updated set. Y Y
bool has_key (Key s, KeySet *Si) Whether key s is a member of the set of keys Si.   Y
KeyPairSet* create_empty_keypair_set () Define an empty set of pairs. Y Y
KeyPairSet* insert_keypair (KeyPair *p, KeyPairSet *Pi) Insert p into the set of key pairs Pi and return the updated set. Y Y
bool has_keypair (KeyPair *p, KeyPairSet *Pi) Whether key pair p is a member of the set of key pairs Pi.   Y

Key and KeyPair Iterators

Type Function Comment hfst-lexc hfst-twolc
KeyIterator begin_sigma_key (KeySet *Si) Beginning of the key iterator si. N  
KeyIterator end_sigma_key (KeySet *Si) End of the iterator for the key set si. N  
size_t size_sigma_key (KeySet *Si) Size of the iterator for the key set si. N  
Key get_sigma_key (KeyIterator si) Get the key represented by the key iterator si. N  
KeyPairIterator begin_pi_key (KeyPairSet *Pi) Beginning of the key pair iterator pi. N  
KeyPairIterator end_pi_key (KeyPairSet *Pi) End of the key pair iterator pi. N  
size_t size_pi_key (KeyPairSet *Pi) Size of the key pair iterator pi. N  
KeyPair* get_pi_keypair (KeyPairIterator pi) Get the key pair represented by the key pair iterator pi. N  

-- KristerLinden - 01 Oct 2008 -- AnssiYliJyra - 16 Oct 2008

Topic revision: r7 - 2009-09-30 - ErikAxelson
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback