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

A lattice. More...

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

Go to the source code of this file.

Functions

tetengo_lattice_lattice_t * tetengo_lattice_lattice_create (const tetengo_lattice_vocabulary_t *p_vocabulary)
 Creates a lattice.
 
void tetengo_lattice_lattice_destroy (const tetengo_lattice_lattice_t *p_lattice)
 Destroys a lattice.
 
size_t tetengo_lattice_lattice_stepCount (const tetengo_lattice_lattice_t *p_lattice)
 Returns the step count.
 
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.
 
bool tetengo_lattice_lattice_pushBack (tetengo_lattice_lattice_t *p_lattice, tetengo_lattice_input_t *p_input)
 Pushes back an input.
 
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.
 

Detailed Description

A lattice.

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

Function Documentation

◆ tetengo_lattice_lattice_create()

tetengo_lattice_lattice_t * tetengo_lattice_lattice_create ( const tetengo_lattice_vocabulary_t *  p_vocabulary)

Creates a lattice.

Parameters
p_vocabularyA 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_latticeA 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_latticeA pointer to a lattice.
stepA step.
p_nodesThe 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_latticeA pointer to a lattice.
p_inputA pointer to an input.
Return values
trueWhen the input is pushed back.
falseOtherwise.

◆ 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_latticeA pointer to a lattice.
p_eos_nodeThe storage for an output EOS node. Can be NULL.
p_preceding_edge_costsThe 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_latticeA pointer to a lattice.
Returns
The step count. Or 0 when p_lattice is NULL.