arbrelex
module).
More...Data Structures | |
struct | Trie |
Lexical tree data structure. More... | |
Typedefs | |
typedef unsigned long | TrieLeaf |
Lexical tree terminal node. | |
Functions | |
void | trieExtendedDump (const Trie *trie, int(*print)(const char *,...), gboolean show_index, gboolean inversion_code) |
Trie * | trieCreate (const LexicalDataType type) |
void | trieFree (Trie *lexical_memory) |
int | trieExport (Trie *lexical_memory, const char *filename) |
int | trieSave (Trie *lexical_memory, const char *filename) |
int | trieLoad (Trie *lexical_memory, const char *filename) |
gboolean | trieSearchNext (LexicalSearch *search) |
gboolean | trieNodeIsFinal (const Trie *trie, TreeMemPos node_mempos) |
TreeMemPos | trieGetFirstChildLeaf (const Trie *trie, const TreeMemPos node_mempos) |
TreeMemPos | trieGetFirstSibling (const Trie *trie, const TreeMemPos node_mempos) |
void | trieDump (const Trie *lexical_memory, int(*print)(const char *,...)) |
TreeMemPos | trieAdd (Trie *lexical_memory, const LexicalEntry entry) |
TreeMemPos | trieInsert (Trie *trie, const LexicalEntry entry, const TrieLeaf key) |
int | trieImport (Trie *lexical_memory, const char *filename) |
size_t | trieGetSize (const Trie *lexical_memory) |
void | trieUniqIdToLexicalSearch (const Trie *lexical_memory, const UniqId uid, LexicalSearch *output) |
LexicalSearch | trieSearchFirst (const Trie *lexical_memory, const LexicalEntry entry) |
LexicalCharacter | trieDecodeNode (const Trie *trie, const TreeMemPos node_mempos) |
LexicalEntry | trieGetGraphyFromUniqId (const Trie *lexical_memory, const UniqId identifier) |
gboolean | trieGetNextChild (const Trie *trie, TreeMemPos parent_node_mempos, TreeMemPos *child_node_mempos, LexicalCharacter *character) |
gboolean | trieCharIsChild (const Trie *trie, TreeMemPos actual_node_mempos, const LexicalCharacter character, TreeMemPos *next_node_mempos) |
void | trieGoToRoot (Trie *lexical_memory) |
void | trieGoCharacterForward (Trie *lexical_memory) |
void | trieGoCharacterBackward (Trie *lexical_memory) |
LexicalCharacter | trieGetNextAvailableCharacter (Trie *lexical_memory) |
gboolean | trieIsAtEndOfGraphy (const Trie *lexical_memory) |
size_t | trieGetCurrentGraphyLength (const Trie *lexical_memory) |
UniqId | trieGetCurrentGraphyUniqId (const Trie *lexical_memory) |
void | trieGoToFirstEntry (Trie *lexical_memory) |
LexicalEntry | trieGetNextEntry (Trie *lexical_memory) |
LexicalEntry | trieDecodeNodeStack (const Trie *trie, const LongStack *node_mempos_stack) |
LexicalDataType | trieGetDataType (const Trie *lexical_memory) |
void | trieImplementAccessTable (LexicalAccessTable *lat) |
arbrelex
module).
SlpTK Library 0.6.0
<trie.h>
Antonin Merçay (revision on 28.11.2004)
typedef unsigned long TrieLeaf |
Lexical tree terminal node.
Associate a cardinal information (for example an index) to a lexical entry
TreeMemPos trieAdd | ( | Trie * | 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.
[in] | lexical_memory | The lexical memory |
[in] | entry | The graphy of the entry to insert |
gboolean trieCharIsChild | ( | const Trie * | trie, | |
TreeMemPos | actual_node_mempos, | |||
const LexicalCharacter | character, | |||
TreeMemPos * | next_node_mempos | |||
) |
Check if a lexical character is child of a trie node. If it's the case, the next_node_mempos
parameter is set to the found node.
[in] | trie | The lexical tree |
[in] | actual_node_mempos | The parent node memory address |
[in] | character | The lexical character to check |
[out] | next_node_mempos | The potential child node memory address |
TRUE
) or not (FALSE
)C_Est_Fils
& Ulong_Est_Fils
Trie * trieCreate | ( | const LexicalDataType | type | ) |
Lexical memory constructor.
Allocate the memory and initialize a new lexical memory implementation.
[in] | type | The data type entries to store in the memory |
Init_Arbre_Lexico
LexicalCharacter trieDecodeNode | ( | const Trie * | trie, | |
const TreeMemPos | node_mempos | |||
) |
Decode the lexical character coded (with overflow bit) into a lexical tree node
[in] | trie | The lexical tree |
[in] | node_mempos | The memory address of the node to decode |
Decode_Char
LexicalEntry trieDecodeNodeStack | ( | const Trie * | trie, | |
const LongStack * | node_mempos_stack | |||
) |
Return the lexical entry whose characters correspond to a given sequence of lexical tree nodes
[in] | trie | The lexical tree |
[in] | node_mempos_stack | The stack that contains the node memory address to decode |
Convert_Lexico_Pile_Int
& Convert_Lexico_Ulong_Pile_Int
void trieDump | ( | const Trie * | lexical_memory, | |
int(*)(const char *,...) | ||||
) |
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.
[in] | lexical_memory | The lexical memory to dump |
[in] | The print function to use |
int trieExport | ( | Trie * | 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.
[in] | lexical_memory | The lexical memory to export |
[in] | filename | The name of the output file |
Exporte_Arbre_Lexico
void trieExtendedDump | ( | const Trie * | trie, | |
int(*)(const char *,...) | print, | |||
gboolean | show_index, | |||
gboolean | inversion_code | |||
) |
Dump the contents of a lexical tree
[in] | trie | The lexical tree to dump |
[in] | The printing function | |
[in] | show_index | Specify if index are also dumped |
[in] | inversion_code | Specify if inversion codes are also dumped |
Liste_Lexico
void trieFree | ( | Trie * | lexical_memory | ) |
Free and destroy a lexical memory (destructor).
Destroy and free the memory allocated to a lexical memory
[in] | lexical_memory | The lexical memory to free |
Libere_Arbre_Lexico
size_t trieGetCurrentGraphyLength | ( | const Trie * | lexical_memory | ) |
Return the length of the current word.
Return the length of the word associated to the current exploring position
0
at every goToRoot call.[in] | lexical_memory | The lexical memory to explore |
Return the unique identifier associated to the current position.
Return the identifier of the word corresponding to the current exploring position.
0
.[in] | lexical_memory | The lexical memory to explore |
LexicalDataType trieGetDataType | ( | const Trie * | lexical_memory | ) |
Tell the kind of lexical memory.
Return the data type of the entries stored in the lexical memory
[in] | lexical_memory | The lexical memory to identify |
TreeMemPos trieGetFirstChildLeaf | ( | const Trie * | trie, | |
const TreeMemPos | node_mempos | |||
) |
Check if the lexical tree node is parent of at least one leaf. Return the node memory address of the first leaf found
[in] | trie | The lexical tree |
[in] | node_mempos | The parent node memory address |
0
if not found)Pere_Feuille
TreeMemPos trieGetFirstSibling | ( | const Trie * | trie, | |
const TreeMemPos | node_mempos | |||
) |
Check if the lexical tree node is sibling of at least one leaf. Return the node memory address of the first leaf found
[in] | trie | The lexical tree |
[in] | node_mempos | The sibling node memory address |
0
if not found)Frere_Feuille
LexicalEntry trieGetGraphyFromUniqId | ( | const Trie * | lexical_memory, | |
const UniqId | identifier | |||
) |
Return the graphy corresponding to its unique identifier.
Return the lexical entry given by its unique corresponding identifier.
[in] | lexical_memory | The lexical memory |
[in] | identifier | The entry identifier |
LexicalCharacter trieGetNextAvailableCharacter | ( | Trie * | 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.
[in] | lexical_memory | The lexical memory to explore |
gboolean trieGetNextChild | ( | const Trie * | trie, | |
TreeMemPos | parent_node_mempos, | |||
TreeMemPos * | child_node_mempos, | |||
LexicalCharacter * | character | |||
) |
Search the next child of a given lexical tree node and decode the corresponding lexical character if such node is found. This function considers the current value of the child_node_mempos
to determine the next child that is then assigned to this same parameter.
child_node_mempos
parameter that points on a null value[in] | trie | The lexical tree |
[in] | parent_node_mempos | The potential parent node memory address |
[out] | child_node_mempos | The current/next child node memory address |
[out] | character | The lexical character corresponding to the child node |
TRUE
) or not (FALSE
)Cherche_Fils
& Get_Fils
LexicalEntry trieGetNextEntry | ( | Trie * | 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.
[in] | lexical_memory | The lexical memory to make an inventory of |
size_t trieGetSize | ( | const Trie * | lexical_memory | ) |
Return the size of a lexical memory.
Return the number of entries stored in a lexical memory
[in] | lexical_memory | The lexical memory |
void trieGoCharacterBackward | ( | Trie * | 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.
[in] | lexical_memory | The lexical memory to explore |
void trieGoCharacterForward | ( | Trie * | 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.
[in] | lexical_memory | The lexical memory to explore |
void trieGoToFirstEntry | ( | Trie * | 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.
[in] | lexical_memory | The lexical memory to make an inventory of |
void trieGoToRoot | ( | Trie * | 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.
[in] | lexical_memory | The lexical memory to explore |
void trieImplementAccessTable | ( | LexicalAccessTable * | lat | ) |
Implement a lexical access table instance with a lexical tree data structure
[out] | lat | The lexical access table instance to implement |
int trieImport | ( | Trie * | lexical_memory, | |
const char * | filename | |||
) |
Load a lexical tree from a list of sequences stored in a textual file
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.
[out] | lexical_memory | The lexical memory where to import |
[in] | filename | The name of the input file |
Importe_Arbre_Lexico
TreeMemPos trieInsert | ( | Trie * | trie, | |
const LexicalEntry | entry, | |||
const TrieLeaf | key | |||
) |
Insert a lexical entry and its associated key into the lexical tree
[in] | trie | The lexical tree |
[in] | entry | The lexical entry to insert |
[in] | key | The key associated to the lexical entry |
Insere_Lexico
& Insere_Lexico_Ulong
gboolean trieIsAtEndOfGraphy | ( | const Trie * | lexical_memory | ) |
Tell if the current position corresponds to a stored entry.
[in] | lexical_memory | The lexical memory to explore |
int trieLoad | ( | Trie * | lexical_memory, | |
const char * | filename | |||
) |
Load the lexical tree from a binary file
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.
[out] | lexical_memory | The lexical memory where to load |
[in] | filename | The name of the output file |
Read_Arbre_Lexico
gboolean trieNodeIsFinal | ( | const Trie * | trie, | |
TreeMemPos | node_mempos | |||
) |
Specify if a lexical tree node is the parent of leafs only, that is the node corresponds to the last character of the explored lexical entry
[in] | trie | The lexical tree |
[in] | node_mempos | The node memory address |
TRUE
) or not (FALSE
)Fin_Arbre
int trieSave | ( | Trie * | 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.
[in] | lexical_memory | The lexical memory to save |
[in] | filename | The name of the output file |
Write_Arbre_Lexico
LexicalSearch trieSearchFirst | ( | const Trie * | 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.
[in] | lexical_memory | The lexical memory where to search |
[in] | entry | The graphy to search |
GetFirst_Valeur_Lexico
, GetFirst_Valeur_Lexico_Ulong
, Recherche_Lexico
& Recherche_Lexico_Ulong
gboolean trieSearchNext | ( | 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.
[in] | search | The search result to update |
inversion_code
field is set to the last matching node.GetNext_Valeur_Lexico
void trieUniqIdToLexicalSearch | ( | const Trie * | 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).
[in] | lexical_memory | The corresponding lexical memory |
[in] | uid | The UniqId to be converted |
[in] | output | The LexicalSearch value to be updated |