SlpTK Library 0.6.0
<bidirectionaltrie.h>
LexicalEntry bidirectionalTrieAccess | ( | const BidirectionalTrie * | bd_trie, | |
const LexicalEntryIndex | index | |||
) |
Return the lexical entry associated to a given key
NULL
if the specified key is not used[in] | bd_trie | The related bidirectional lexical tree |
[in] | index | The key value |
TreeMemPos bidirectionalTrieAdd | ( | BidirectionalTrie * | 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 bidirectionalTrieCharIsChild | ( | const BidirectionalTrie * | 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
BidirectionalTrie * bidirectionalTrieCreate | ( | 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 |
LexicalCharacter bidirectionalTrieDecodeNode | ( | const BidirectionalTrie * | 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 bidirectionalTrieDecodeNodeStack | ( | const BidirectionalTrie * | 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 bidirectionalTrieDump | ( | const BidirectionalTrie * | 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 bidirectionalTrieExport | ( | const BidirectionalTrie * | 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 |
filename
+ ".map"
) that contains on each line the keys of the stored lexical entries;filename
) that contains on each line the values of the corresponding lexical entries. void bidirectionalTrieFree | ( | BidirectionalTrie * | 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 |
size_t bidirectionalTrieGetCurrentGraphyLength | ( | const BidirectionalTrie * | 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 |
UniqId bidirectionalTrieGetCurrentGraphyUniqId | ( | const BidirectionalTrie * | lexical_memory | ) |
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 bidirectionalTrieGetDataType | ( | const BidirectionalTrie * | 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 bidirectionalTrieGetFirstChild | ( | const BidirectionalTrie * | 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 bidirectionalTrieGetFirstSibling | ( | const BidirectionalTrie * | 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 bidirectionalTrieGetGraphyFromUniqId | ( | const BidirectionalTrie * | 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 bidirectionalTrieGetNextAvailableCharacter | ( | BidirectionalTrie * | 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 bidirectionalTrieGetNextChild | ( | const BidirectionalTrie * | 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 bidirectionalTrieGetNextEntry | ( | BidirectionalTrie * | 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 bidirectionalTrieGetSize | ( | const BidirectionalTrie * | 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 bidirectionalTrieGoCharacterBackward | ( | BidirectionalTrie * | 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 bidirectionalTrieGoCharacterForward | ( | BidirectionalTrie * | 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 bidirectionalTrieGoToFirstEntry | ( | BidirectionalTrie * | 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 bidirectionalTrieGoToRoot | ( | BidirectionalTrie * | 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 bidirectionalTrieImplementAssociativeMemory | ( | LexicalAssocMem * | lam | ) |
Implement a lexical associative memory instance with a bidirectional trie data structure
[out] | lam | The lexical associative memory instance to implement |
int bidirectionalTrieImport | ( | BidirectionalTrie * | 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.
[out] | lexical_memory | The lexical memory where to import |
[in] | filename | The name of the input file |
TreeMemPos bidirectionalTrieInsert | ( | BidirectionalTrie * | trie, | |
const LexicalEntry | entry, | |||
const LexicalEntryIndex | 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 bidirectionalTrieIsAtEndOfGraphy | ( | const BidirectionalTrie * | lexical_memory | ) |
Tell if the current position corresponds to a stored entry.
[in] | lexical_memory | The lexical memory to explore |
int bidirectionalTrieLoad | ( | BidirectionalTrie * | 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.
[out] | lexical_memory | The lexical memory where to load |
[in] | filename | The name of the output file |
gboolean bidirectionalTrieNodeIsFinal | ( | const BidirectionalTrie * | 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 bidirectionalTrieSave | ( | const BidirectionalTrie * | 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 |
filename
+ ".map"
) that stores the contents of the BidirectionalTrie::inversion_code_array field;filename
) that stores the BidirectionalTrie::trie field using the trieSave function. LexicalSearch bidirectionalTrieSearchFirst | ( | const BidirectionalTrie * | 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 |
gboolean bidirectionalTrieSearchNext | ( | 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.void bidirectionalTrieUniqIdToLexicalSearch | ( | const BidirectionalTrie * | 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 |