tetengo 1.8.1
A multipurpose library set
Loading...
Searching...
No Matches
vocabulary.h File Reference

A vocabulary. More...

#include <stdbool.h>
#include <stddef.h>
#include <tetengo/lattice/connection.h>
#include <tetengo/lattice/entry.h>
#include <tetengo/lattice/input.h>
#include <tetengo/lattice/node.h>
+ Include dependency graph for vocabulary.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tetengo_lattice_customVocabularyDefinition_tag
 A custom vocabulary definition. More...
 

Typedefs

typedef struct tetengo_lattice_customVocabularyDefinition_tag tetengo_lattice_customVocabularyDefinition_t
 A custom vocabulary definition.
 

Functions

tetengo_lattice_vocabulary_t * tetengo_lattice_vocabulary_createUnorderedMapVocabulary (const tetengo_lattice_keyEntriesPair_t *p_entries, size_t entry_count, const tetengo_lattice_entriesConnectionCostPair_t *p_connections, size_t connection_count, size_t(*p_entry_hash)(const tetengo_lattice_entryView_t *), int(*p_entry_equal_to)(const tetengo_lattice_entryView_t *, const tetengo_lattice_entryView_t *))
 Creates an unordered map vocabulary.
 
tetengo_lattice_vocabulary_t * tetengo_lattice_vocabulary_createCustomVocabulary (const tetengo_lattice_customVocabularyDefinition_t *p_definition)
 Creates a custom vocabulary.
 
void tetengo_lattice_vocabulary_destroy (const tetengo_lattice_vocabulary_t *p_vocabulary)
 Destroys a vocabulary.
 
size_t tetengo_lattice_vocabulary_findEntries (const tetengo_lattice_vocabulary_t *p_vocabulary, const tetengo_lattice_input_t *p_key, tetengo_lattice_entryView_t *p_entries)
 Finds entries.
 
bool tetengo_lattice_vocabulary_findConnection (const tetengo_lattice_vocabulary_t *p_vocabulary, const tetengo_lattice_node_t *p_from, const tetengo_lattice_entryView_t *p_to, tetengo_lattice_connection_t *p_connection)
 Finds a connection between entries.
 

Detailed Description

A vocabulary.

Copyright (C) 2019-2023 kaoru https://www.tetengo.org/

Function Documentation

◆ tetengo_lattice_vocabulary_createCustomVocabulary()

tetengo_lattice_vocabulary_t * tetengo_lattice_vocabulary_createCustomVocabulary ( const tetengo_lattice_customVocabularyDefinition_t p_definition)

Creates a custom vocabulary.

Parameters
p_definitionA pointer to a definition.
Returns
A pointer to a custom vocabulary. Or NULL when p_definition NULL

◆ tetengo_lattice_vocabulary_createUnorderedMapVocabulary()

tetengo_lattice_vocabulary_t * tetengo_lattice_vocabulary_createUnorderedMapVocabulary ( const tetengo_lattice_keyEntriesPair_t p_entries,
size_t  entry_count,
const tetengo_lattice_entriesConnectionCostPair_t p_connections,
size_t  connection_count,
size_t(*)(const tetengo_lattice_entryView_t *)  p_entry_hash,
int(*)(const tetengo_lattice_entryView_t *, const tetengo_lattice_entryView_t *)  p_entry_equal_to 
)

Creates an unordered map vocabulary.

Parameters
p_entriesA pointer to entries.
entry_countAn entry count.
p_connectionsA pointer to connections.
connection_countA connection count.
p_entry_hashA pointer to a hash function for an entry.
p_entry_equal_toA pointer to an eqaul_to function for an entry.
Returns
A pointer to an unordered map vocabulary. Or NULL when p_entries and/or p_connections are NULL, and entry_count and/or connection_count are greater than 0.

◆ tetengo_lattice_vocabulary_destroy()

void tetengo_lattice_vocabulary_destroy ( const tetengo_lattice_vocabulary_t *  p_vocabulary)

Destroys a vocabulary.

Parameters
p_vocabularyA pointer to a vocabulary.

◆ tetengo_lattice_vocabulary_findConnection()

bool tetengo_lattice_vocabulary_findConnection ( const tetengo_lattice_vocabulary_t *  p_vocabulary,
const tetengo_lattice_node_t p_from,
const tetengo_lattice_entryView_t p_to,
tetengo_lattice_connection_t p_connection 
)

Finds a connection between entries.

Parameters
p_vocabularyA pointer to a vocabulary.
p_fromA pointer to an origin node.
p_toA pointer to a destination entry.
p_connectionThe storage for an output connection.
Return values
trueWhen an output connection is stored.
falseOtherwise.

◆ tetengo_lattice_vocabulary_findEntries()

size_t tetengo_lattice_vocabulary_findEntries ( const tetengo_lattice_vocabulary_t *  p_vocabulary,
const tetengo_lattice_input_t *  p_key,
tetengo_lattice_entryView_t p_entries 
)

Finds entries.

Parameters
p_vocabularyA pointer to a vocabulary.
p_keyA pointer to a key.
p_entriesThe storage for output entries. Can be NULL.
Returns
An entry count.