LexicalAccessTable - Lexical access table module
[Lexical tools level]

Definition of the data structure and functions interface that lexical access table must provide. More...

Data Structures

struct  LexicalSearch
 Lexical search result. More...
struct  LexicalAccessTableFunctions
 Lexical access table functions. More...
struct  LexicalAccessTable
 Lexical access table (LAT). More...

Defines

#define NO_LEXICALENTRY   ((LexicalEntry) NULL)
 LexicalEntry value that that signifies the absence of value.
#define NO_CHARACTER   0
 LexicalCharacter value that that signifies the absence of character.

Typedefs

typedef guint32 LexicalEntryIndex
 Lexical entry index.
typedef guint32 UniqId
 Unique identifier.
typedef void * LexicalEntry
 Lexical entry.
typedef unsigned long LexicalCharacter
 Lexical character.
typedef void * LexicalMemoryHandler
 Lexical memory pointer.
typedef unsigned long InsertionResult
 Lexical memory insertion result.

Enumerations

enum  LexicalMemoryType { TREE, AUTOMATON, TRANSDUCER }
 Lexical memory type. More...
enum  LexicalDataType { CHARACTER = 0, UNSIGNED_LONG }
 Lexical data type. More...

Functions

void lexicalEntryToString (LexicalEntry entry, const LexicalDataType type, GString *output)
void lexicalEntryFree (LexicalEntry entry, const LexicalDataType type)
LexicalEntry lexicalEntryFromString (const char *string, const LexicalDataType type)
void LATCreate (LexicalAccessTable *data, const LexicalDataType type)
int LATExport (const LexicalAccessTable *data, const char *filename)
void LATFree (LexicalAccessTable *data)
int LATImport (LexicalAccessTable *data, const char *filename)
int LATLoad (LexicalAccessTable *data, const char *filename)
int LATSave (const LexicalAccessTable *data, const char *filename)
int LATDump (const LexicalAccessTable *data, int(*print)(const char *,...))
InsertionResult LATInsert (LexicalAccessTable *data, const LexicalEntry entry)
size_t LATGetSize (const LexicalAccessTable *data)
void LATUniqIdToLexicalSearch (const LexicalAccessTable *lat, const UniqId uid, LexicalSearch *output)
LexicalSearch LATSearchFirst (const LexicalAccessTable *data, const LexicalEntry entry)
gboolean LATSearchNext (const LexicalAccessTable *data, LexicalSearch *search)
LexicalCharacter LATGetNextAvailableCharacter (LexicalAccessTable *data)
void LATGoToRoot (LexicalAccessTable *data)
void LATGoCharacterForward (LexicalAccessTable *data)
gboolean LATIsAtEndOfGraphy (const LexicalAccessTable *data)
LexicalDataType LATGetDataType (const LexicalAccessTable *data)
void LATGoCharacterBackward (LexicalAccessTable *data)
size_t LATGetCurrentGraphyLength (const LexicalAccessTable *data)
UniqId LATGetCurrentGraphyUniqId (const LexicalAccessTable *data)
void LATGoToFirstEntry (LexicalAccessTable *lexical_memory)
LexicalEntry LATGetNextEntry (LexicalAccessTable *lexical_memory)

Detailed Description

Definition of the data structure and functions interface that lexical access table must provide.

SlpTK Library 0.6.0

Required header
<lexicalaccesstable.h>
Author:
Antonin Merçay (creation on 08.12.2004)
Date:
2 March 2005
Version:
0.6.0

Typedef Documentation

typedef unsigned long InsertionResult

Lexical memory insertion result.

Value returned by an insertion operation in a lexical memory

See also:
LATInsert LAMInsert

typedef unsigned long LexicalCharacter

Lexical character.

Lexical character (whichever its type)

See also:
LexicalDataType

typedef void* LexicalEntry

Lexical entry.

Entry of a lexical memory (whichever its type)

See also:
LexicalDataType

typedef guint32 LexicalEntryIndex

Lexical entry index.

Numerical index of a specified Lexical memory entry

typedef void* LexicalMemoryHandler

Lexical memory pointer.

Pointer on a lexical memory data structure, whichever is it a Trie, BidirectionalTrie, LexicalAutomaton or LexicalTransducer

See also:
LexicalAccessTable LexicalAssocMem

typedef guint32 UniqId

Unique identifier.

Unique identifier of a specified Lexical memory entry, not to be confused with the LexicalEntryIndex where you can have several lexical entry indexes that maps to one entry.


Enumeration Type Documentation

enum LexicalDataType

Lexical data type.

Specify the character type of a lexical memory entry

Enumerator:
CHARACTER  char size (byte) character
UNSIGNED_LONG  unsigned long size character

enum LexicalMemoryType

Lexical memory type.

Specify the type of data structure used to implement a lexical memory

Enumerator:
TREE  Tree-based lexical memory
AUTOMATON  Automaton-based lexical memory
TRANSDUCER  Transducer-based lexical memory


Function Documentation

void LATCreate ( LexicalAccessTable lexical_memory,
const LexicalDataType  type 
)

Allocate the memory and implement a new lexical memory (constructor)

Parameters:
[out] lexical_memory The lexical memory to create
[in] type The type of the lexical memory to create
See also:
LexicalAccessTableFunctions::free()

LATFree()

int LATDump ( const LexicalAccessTable lexical_memory,
int(*)(const char *,...)  print 
)

Dump the content of a lexical memory.

Dump the content of a lexical memory using a given print function. The function returns a not null error code if operation fails.

Parameters:
[in] lexical_memory The lexical memory to dump
[in] print The print function to use
Returns:
An error code

int LATExport ( const LexicalAccessTable lexical_memory,
const char *  filename 
)

Export the content of a lexical memory.

Save the content of a lexical memory in a textual (human readable) file. The function returns a not null error code if operation fails.

Parameters:
[in] lexical_memory The lexical memory to export
[in] filename The name of the output file
Returns:
An error code
See also:
import()

See also:
LATImport()

void LATFree ( LexicalAccessTable lexical_memory  ) 

Free and destroy a lexical memory (destructor).

Destroy and free the memory allocated to a lexical memory

Parameters:
[in] lexical_memory The lexical memory to free
See also:
create()

See also:
LATCreate()

size_t LATGetCurrentGraphyLength ( const LexicalAccessTable lexical_memory  ) 

Return the length of the current word.

Return the length of the word associated to the current exploring position

Remarks:
The value returned is increment at every valid goCharacterForward call, decremented at every valid goCharacterBackward call, and reset to 0 at every goToRoot call.
Parameters:
[in] lexical_memory The lexical memory to explore
Returns:
The length of the word corresponding to the current exploring position

UniqId LATGetCurrentGraphyUniqId ( const LexicalAccessTable lexical_memory  ) 

Return the unique identifier associated to the current position.

Return the identifier of the word corresponding to the current exploring position.

Remarks:
A call to this function makes sense only if the current position corresponds to the end of a stored word. The user must check this condition by using the isAtEndOfGraphy function. If the parsed word is not stored by the lexical memory, this function returns 0.
Parameters:
[in] lexical_memory The lexical memory to explore
Returns:
The identifier from currently explored word
See also:
isAtEndOfGraphy()

See also:
LATIsAtEndOfGraphy()

LexicalDataType LATGetDataType ( const LexicalAccessTable lexical_memory  ) 

Tell the kind of lexical memory.

Return the data type of the entries stored in the lexical memory

Parameters:
[in] lexical_memory The lexical memory to identify
Returns:
The type of the stored entries
See also:
create()

See also:
LATCreate()

LexicalCharacter LATGetNextAvailableCharacter ( LexicalAccessTable lexical_memory  ) 

Return the next character available at the current position.

Iteratively return all the lexical characters available from the current exploring position. This function can be called until its returns NO_CHARACTER, signifying that all possible characters have been returned. At this point, a further call to getNextAvailableCharacter goes back to the first lexical character available.

Parameters:
[in] lexical_memory The lexical memory to explore
See also:
goCharacterForward() getCurrentGraphyLength() goToRoot()

See also:
LATGoCharacterForward() LATGetCurrentGraphyLength() LATGoToRoot()

LexicalEntry LATGetNextEntry ( LexicalAccessTable lexical_memory  ) 

Return the next graphy stored in a lexical memory.

Iteratively return all the graphies stored in a lexical memory. This function can be called until its returns NULL, signifying that all stored graphies have been returned.

Parameters:
[in] lexical_memory The lexical memory to make an inventory of
Returns:
The graphy of the next word stored
See also:
goToFirstEntry()

See also:
LATGoToFirstEntry()

size_t LATGetSize ( const LexicalAccessTable lexical_memory  ) 

Return the size of a lexical memory.

Return the number of entries stored in a lexical memory

Parameters:
[in] lexical_memory The lexical memory
Returns:
The number of entries stored

void LATGoCharacterBackward ( LexicalAccessTable lexical_memory  ) 

Step one lexical character backward the current position.

Step backward the current exploring position from one lexical character. The exploring informations of the position before the call are lost so that when one goes back to that position, available characters inventory start again from the beginning.

Remarks:
This function has no effect if the current position is the root of the lexical memory
Parameters:
[in] lexical_memory The lexical memory to explore
See also:
goCharacterForward() goToRoot()

See also:
LATGoCharacterForward() LATGoToRoot()

void LATGoCharacterForward ( LexicalAccessTable lexical_memory  ) 

Step one lexical character forward the current position.

Step forward the current exploring position from one lexical character, that is the value returned by the last call of getNextAvailableCharacter from the current exploring position. Each time this function is called, the current state is saved so that when one go back to a given exploring position using goCharacterBackward, the available characters inventory with getNextAvailableCharacter carries on as if the current position had not been left.

Remarks:
This function has no effect if getNextAvailableCharacter has not been called at least one time or no character is available from the current exploring position
Parameters:
[in] lexical_memory The lexical memory to explore
See also:
isAtEndOfGraphy() goToRoot()

See also:
LATIsAtEndOfGraphy() LATGoToRoot()

void LATGoToFirstEntry ( LexicalAccessTable lexical_memory  ) 

Go back to the first graphy stored in a lexical memory.

This function can be called anytime to order to start again the lexical memory inventory (with getNextEntry) from the beginning.

Parameters:
[in] lexical_memory The lexical memory to make an inventory of

void LATGoToRoot ( LexicalAccessTable lexical_memory  ) 

Set the current position to the root of the lexical memory.

Assign the current exploring position to the root of the lexical memory, i.e. before the first lexical character.

Parameters:
[in] lexical_memory The lexical memory to explore
See also:
goCharacterForward() goCharacterBackward()

See also:
LATGoCharacterForward() LATGoCharacterBackward()

int LATImport ( LexicalAccessTable lexical_memory,
const char *  filename 
)

Import the content of a lexical memory.

Load a lexical memory with the content of a textual (human readable) file. The function returns a not null error code if operation fails.

Parameters:
[out] lexical_memory The lexical memory where to import
[in] filename The name of the input file
Returns:
An error code
See also:
export()

See also:
LATExport()

InsertionResult LATInsert ( LexicalAccessTable lexical_memory,
const LexicalEntry  entry 
)

Insert a new entry in a lexical memory.

Insert a new lexical entry (graphy) into lexical memory. The function returns an insertion result whose nature may vary from one implementation to another.

Parameters:
[in] lexical_memory The lexical memory
[in] entry The graphy of the entry to insert
Returns:
The insertion result
See also:
getSize()

See also:
LATGetSize()

gboolean LATIsAtEndOfGraphy ( const LexicalAccessTable lexical_memory  ) 

Tell if the current position corresponds to a stored entry.

Remarks:
The fact that the current position coincide with the end of a stored word doesn't imply that one can't carry on the exploration deeper (with goCharacterForward)
Parameters:
[in] lexical_memory The lexical memory to explore
Returns:
The current exploring position corresponds to the end of stoted word yes or not
See also:
getCurrentGraphyUniqId()

See also:
LATGetCurrentGraphyUniqId()

int LATLoad ( LexicalAccessTable lexical_memory,
const char *  filename 
)

Load a lexical memory from a file.

Load a lexical memory from a binary (machine readable) save file. The function returns a not null error code if operation fails.

Parameters:
[out] lexical_memory The lexical memory where to load
[in] filename The name of the output file
Returns:
An error code
See also:
save()

See also:
LATSave()

int LATSave ( const LexicalAccessTable lexical_memory,
const char *  filename 
)

Save a lexical memory in a file.

Save the content of a lexical memory in a binary (machine readable) file. The function returns a not null error code if operation fails.

Remarks:
The binary file format is dependant of the lexical memory implementation and of the used platform
Parameters:
[in] lexical_memory The lexical memory to save
[in] filename The name of the output file
Returns:
An error code
See also:
load()

See also:
LATLoad()

LexicalSearch LATSearchFirst ( const LexicalAccessTable lexical_memory,
const LexicalEntry  entry 
)

Search the first occurence of a graphy in a lexical memory.

Search the information related to the first entry corresponding to a given graphy. The LexicalSearch::found field informs if such graphy has been found or not. If yes, other corresponding entries can be iteratively recovered using searchNext.

Parameters:
[in] lexical_memory The lexical memory where to search
[in] entry The graphy to search
Returns:
The search result

gboolean LATSearchNext ( const LexicalAccessTable lexical_memory,
LexicalSearch search 
)

Search the next occurence of a graphy in a lexical memory.

Carry on a search process initiate by searchFirst. This function can be iteratively called until its returns FALSE, signifying that all relevant entries have been returned.

Parameters:
[in] search The search result to update
Returns:
A new entry has been found yes or not

Parameters:
[in] lexical_memory The lexical memory where search applies

void LATUniqIdToLexicalSearch ( const LexicalAccessTable lexical_memory,
const UniqId  uid,
LexicalSearch output 
)

Converts a UniqId to a LexicalSearch.

Converts an entry uniq identifier to the first corresponding LexicalSearch information. Notice however that the fields "found_length" and "specific.code" of the corresponding LexicalSearch are undefined in this context (and should thus not be used after).

Parameters:
[in] lexical_memory The corresponding lexical memory
[in] uid The UniqId to be converted
[in] output The LexicalSearch value to be updated
See also:
searchFirst()

void lexicalEntryFree ( LexicalEntry  entry,
const LexicalDataType  type 
)

Free the memory allocated to a lexical entry (destructor)

Parameters:
[in] entry The lexical entry to free
[in] type The lexical entry datatype

LexicalEntry lexicalEntryFromString ( const char *  string,
const LexicalDataType  type 
)

Create a new lexical entry of a given type from a textual representation

Parameters:
[in] string The textual representation of the lexical entry to generate
[in] type The type of the lexical entry to generate
Returns:
The resulting lexical entry
See also:
lexicalEntryToString()

void lexicalEntryToString ( LexicalEntry  entry,
const LexicalDataType  type,
GString *  output 
)

Provide a textual representation of a lexical entry

Parameters:
[in] entry The lexical entry
[in] type The lexical entry datatype
[out] output The textual representation of the lexical entry
See also:
lexicalEntryFromString()


Generated on Thu Mar 22 17:46:31 2007 for SlpTk by  doxygen 1.4.7