A lattice.
More...
#include <stdbool.h>
#include <stddef.h>
#include <tetengo/lattice/input.h>
#include <tetengo/lattice/node.h>
#include <tetengo/lattice/vocabulary.h>
Go to the source code of this file.
A lattice.
Copyright (C) 2019-2023 kaoru https://www.tetengo.org/
◆ tetengo_lattice_lattice_create()
tetengo_lattice_lattice_t * tetengo_lattice_lattice_create |
( |
const tetengo_lattice_vocabulary_t * |
p_vocabulary | ) |
|
Creates a lattice.
- Parameters
-
p_vocabulary | A pointer to a vocabulary. |
- Returns
- A pointer to a lattice. Or NULL when p_vocabulary is NULL.
◆ tetengo_lattice_lattice_destroy()
void tetengo_lattice_lattice_destroy |
( |
const tetengo_lattice_lattice_t * |
p_lattice | ) |
|
Destroys a lattice.
- Parameters
-
p_lattice | A pointer to a lattice. |
◆ tetengo_lattice_lattice_nodesAt()
size_t tetengo_lattice_lattice_nodesAt |
( |
const tetengo_lattice_lattice_t * |
p_lattice, |
|
|
size_t |
step, |
|
|
tetengo_lattice_node_t * |
p_nodes |
|
) |
| |
Returns the nodes at the specified step.
- Parameters
-
p_lattice | A pointer to a lattice. |
step | A step. |
p_nodes | The storage for output nodes. Can be NULL. |
- Returns
- A node count. Or 0 when p_lattice is NULL or step is too large.
◆ tetengo_lattice_lattice_pushBack()
bool tetengo_lattice_lattice_pushBack |
( |
tetengo_lattice_lattice_t * |
p_lattice, |
|
|
tetengo_lattice_input_t * |
p_input |
|
) |
| |
Pushes back an input.
The ownership of the input pointed by p_input is transferred into the lattice. There is no need to destroy the input after calling this function.
- Parameters
-
p_lattice | A pointer to a lattice. |
p_input | A pointer to an input. |
- Return values
-
true | When the input is pushed back. |
false | Otherwise. |
◆ tetengo_lattice_lattice_settle()
size_t tetengo_lattice_lattice_settle |
( |
tetengo_lattice_lattice_t * |
p_lattice, |
|
|
tetengo_lattice_node_t * |
p_eos_node, |
|
|
int * |
p_preceding_edge_costs |
|
) |
| |
Settles this lattice.
You can modify the lattice after settlement. Modification of the lattice after settlement invalidate the EOS node.
- Parameters
-
p_lattice | A pointer to a lattice. |
p_eos_node | The storage for an output EOS node. Can be NULL. |
p_preceding_edge_costs | The storage for preceding edge costs of the EOS. Can be NULL. |
- Returns
- The preceding edge cost count.
◆ tetengo_lattice_lattice_stepCount()
size_t tetengo_lattice_lattice_stepCount |
( |
const tetengo_lattice_lattice_t * |
p_lattice | ) |
|
Returns the step count.
- Parameters
-
p_lattice | A pointer to a lattice. |
- Returns
- The step count. Or 0 when p_lattice is NULL.