MeCab
Public Member Functions | Static Public Member Functions | List of all members
MeCab::Lattice Class Referenceabstract

Lattice class. More...

#include <mecab.h>

Public Member Functions

virtual void clear ()=0
 Clear all internal lattice data. More...
 
virtual bool is_available () const =0
 Return true if result object is available. More...
 
virtual Nodebos_node () const =0
 Return bos (begin of sentence) node. More...
 
virtual Nodeeos_node () const =0
 Return eos (end of sentence) node. More...
 
virtual Node ** begin_nodes () const =0
 This method is used internally. More...
 
virtual Node ** end_nodes () const =0
 This method is used internally. More...
 
virtual Nodeend_nodes (size_t pos) const =0
 Return node linked list ending at |pos|. More...
 
virtual Nodebegin_nodes (size_t pos) const =0
 Return node linked list starting at |pos|. More...
 
virtual const char * sentence () const =0
 Return sentence. More...
 
virtual void set_sentence (const char *sentence)=0
 Set sentence. More...
 
virtual void set_sentence (const char *sentence, size_t len)=0
 Set sentence. More...
 
virtual size_t size () const =0
 Return sentence size. More...
 
virtual void set_Z (double Z)=0
 Set normalization factor of CRF. More...
 
virtual double Z () const =0
 return normalization factor of CRF. More...
 
virtual void set_theta (float theta)=0
 Set temparature parameter theta. More...
 
virtual float theta () const =0
 Return temparature parameter theta. More...
 
virtual bool next ()=0
 Obtain next-best result. More...
 
virtual int request_type () const =0
 Return the current request type. More...
 
virtual bool has_request_type (int request_type) const =0
 Return true if the object has a specified request type. More...
 
virtual void set_request_type (int request_type)=0
 Set request type. More...
 
virtual void add_request_type (int request_type)=0
 Add request type. More...
 
virtual void remove_request_type (int request_type)=0
 Remove request type. More...
 
virtual Allocator< Node, Path > * allocator () const =0
 This method is used internally. More...
 
virtual NodenewNode ()=0
 Return new node. More...
 
virtual const char * toString ()=0
 Return string representation of the lattice. More...
 
virtual const char * toString (const Node *node)=0
 Return string representation of the node. More...
 
virtual const char * enumNBestAsString (size_t N)=0
 Return string representation of the N-best results. More...
 
virtual const char * toString (char *buf, size_t size)=0
 Return string representation of the lattice. More...
 
virtual const char * toString (const Node *node, char *buf, size_t size)=0
 Return string representation of the node. More...
 
virtual const char * enumNBestAsString (size_t N, char *buf, size_t size)=0
 Return string representation of the N-best result. More...
 
virtual bool has_constraint () const =0
 Returns true if any parsing constraint is set. More...
 
virtual int boundary_constraint (size_t pos) const =0
 Returns the boundary constraint at the position. More...
 
virtual const char * feature_constraint (size_t pos) const =0
 Returns the token constraint at the position. More...
 
virtual void set_boundary_constraint (size_t pos, int boundary_constraint_type)=0
 Set parsing constraint for partial parsing mode. More...
 
virtual void set_feature_constraint (size_t begin_pos, size_t end_pos, const char *feature)=0
 Set parsing constraint for partial parsing mode. More...
 
virtual void set_result (const char *result)=0
 Set golden parsing results for unittesting. More...
 
virtual const char * what () const =0
 Return error string. More...
 
virtual void set_what (const char *str)=0
 Set error string. More...
 
virtual ~Lattice ()
 

Static Public Member Functions

static Latticecreate ()
 Create new Lattice object. More...
 

Detailed Description

Lattice class.

Constructor & Destructor Documentation

◆ ~Lattice()

virtual MeCab::Lattice::~Lattice ( )
inlinevirtual

Member Function Documentation

◆ add_request_type()

virtual void MeCab::Lattice::add_request_type ( int  request_type)
pure virtual

Add request type.

Parameters
request_typenew request type added

◆ allocator()

virtual Allocator<Node, Path>* MeCab::Lattice::allocator ( ) const
pure virtual

This method is used internally.

◆ begin_nodes() [1/2]

virtual Node** MeCab::Lattice::begin_nodes ( ) const
pure virtual

This method is used internally.

◆ begin_nodes() [2/2]

virtual Node* MeCab::Lattice::begin_nodes ( size_t  pos) const
pure virtual

Return node linked list starting at |pos|.

You can obtain all nodes via "for (const Node *node = lattice->begin_nodes(pos); node; node = node->bnext) {}"

Parameters
posposition of nodes. 0 <= pos < size()
Returns
node linked list

◆ bos_node()

virtual Node* MeCab::Lattice::bos_node ( ) const
pure virtual

Return bos (begin of sentence) node.

You can obtain all nodes via "for (const Node *node = lattice->bos_node(); node; node = node->next) {}"

Returns
bos node object

◆ boundary_constraint()

virtual int MeCab::Lattice::boundary_constraint ( size_t  pos) const
pure virtual

Returns the boundary constraint at the position.

Parameters
posthe position of constraint
Returns
boundary constraint type

◆ clear()

virtual void MeCab::Lattice::clear ( )
pure virtual

Clear all internal lattice data.

◆ create()

static Lattice* MeCab::Lattice::create ( )
static

Create new Lattice object.

Returns
new Lattice object

◆ end_nodes() [1/2]

virtual Node** MeCab::Lattice::end_nodes ( ) const
pure virtual

This method is used internally.

◆ end_nodes() [2/2]

virtual Node* MeCab::Lattice::end_nodes ( size_t  pos) const
pure virtual

Return node linked list ending at |pos|.

You can obtain all nodes via "for (const Node *node = lattice->end_nodes(pos); node; node = node->enext) {}"

Parameters
posposition of nodes. 0 <= pos < size()
Returns
node linked list

◆ enumNBestAsString() [1/2]

virtual const char* MeCab::Lattice::enumNBestAsString ( size_t  N)
pure virtual

Return string representation of the N-best results.

Returned object is managed by this instance. When clear/set_sentence() method is called, the returned buffer is initialized.

Returns
string representation of the node
Parameters
Nhow many results you want to obtain

◆ enumNBestAsString() [2/2]

virtual const char* MeCab::Lattice::enumNBestAsString ( size_t  N,
char *  buf,
size_t  size 
)
pure virtual

Return string representation of the N-best result.

Result is saved in the specified.

Parameters
Nhow many results you want to obtain
bufoutput buffer
sizeoutput buffer size
Returns
string representation of the lattice

◆ eos_node()

virtual Node* MeCab::Lattice::eos_node ( ) const
pure virtual

Return eos (end of sentence) node.

Returns
eos node object

◆ feature_constraint()

virtual const char* MeCab::Lattice::feature_constraint ( size_t  pos) const
pure virtual

Returns the token constraint at the position.

Parameters
posthe beginning position of constraint.
Returns
constrained node starting at the position.

◆ has_constraint()

virtual bool MeCab::Lattice::has_constraint ( ) const
pure virtual

Returns true if any parsing constraint is set.

◆ has_request_type()

virtual bool MeCab::Lattice::has_request_type ( int  request_type) const
pure virtual

Return true if the object has a specified request type.

Returns
boolean

◆ is_available()

virtual bool MeCab::Lattice::is_available ( ) const
pure virtual

Return true if result object is available.

Returns
boolean

◆ newNode()

virtual Node* MeCab::Lattice::newNode ( )
pure virtual

Return new node.

Lattice objects has the ownership of the node.

Returns
new node object

◆ next()

virtual bool MeCab::Lattice::next ( )
pure virtual

Obtain next-best result.

The internal linked list structure is updated. You should set MECAB_NBEST reques_type in advance. Return false if no more results are available or request_type is invalid.

Returns
boolean

◆ remove_request_type()

virtual void MeCab::Lattice::remove_request_type ( int  request_type)
pure virtual

Remove request type.

Parameters
request_typenew request type removed

◆ request_type()

virtual int MeCab::Lattice::request_type ( ) const
pure virtual

Return the current request type.

Returns
request type

◆ sentence()

virtual const char* MeCab::Lattice::sentence ( ) const
pure virtual

Return sentence.

If MECAB_NBEST or MECAB_PARTIAL mode is off, the returned poiner is the same as the one set by set_sentence().

Returns
sentence

◆ set_boundary_constraint()

virtual void MeCab::Lattice::set_boundary_constraint ( size_t  pos,
int  boundary_constraint_type 
)
pure virtual

Set parsing constraint for partial parsing mode.

Parameters
posthe position of the boundary
boundary_constraint_typethe type of boundary

◆ set_feature_constraint()

virtual void MeCab::Lattice::set_feature_constraint ( size_t  begin_pos,
size_t  end_pos,
const char *  feature 
)
pure virtual

Set parsing constraint for partial parsing mode.

Parameters
begin_posthe starting position of the constrained token.
end_posthe the ending position of the constrained token.
featurethe feature of the constrained token.

◆ set_request_type()

virtual void MeCab::Lattice::set_request_type ( int  request_type)
pure virtual

Set request type.

Parameters
request_typenew request type assigned

◆ set_result()

virtual void MeCab::Lattice::set_result ( const char *  result)
pure virtual

Set golden parsing results for unittesting.

Parameters
resultthe parsing result written in the standard mecab output.

◆ set_sentence() [1/2]

virtual void MeCab::Lattice::set_sentence ( const char *  sentence)
pure virtual

Set sentence.

This method does not take the ownership of the object.

Parameters
sentencesentence

◆ set_sentence() [2/2]

virtual void MeCab::Lattice::set_sentence ( const char *  sentence,
size_t  len 
)
pure virtual

Set sentence.

This method does not take the ownership of the object.

Parameters
sentencesentence
lenlength of the sentence

◆ set_theta()

virtual void MeCab::Lattice::set_theta ( float  theta)
pure virtual

Set temparature parameter theta.

Parameters
thetatemparature parameter.

◆ set_what()

virtual void MeCab::Lattice::set_what ( const char *  str)
pure virtual

Set error string.

given string is copied to the internal buffer.

Parameters
strnew error string

◆ set_Z()

virtual void MeCab::Lattice::set_Z ( double  Z)
pure virtual

Set normalization factor of CRF.

Parameters
Znew normalization factor.

◆ size()

virtual size_t MeCab::Lattice::size ( ) const
pure virtual

Return sentence size.

Returns
sentence size

◆ theta()

virtual float MeCab::Lattice::theta ( ) const
pure virtual

Return temparature parameter theta.

Returns
temparature parameter.

◆ toString() [1/4]

virtual const char* MeCab::Lattice::toString ( )
pure virtual

Return string representation of the lattice.

Returned object is managed by this instance. When clear/set_sentence() method is called, the returned buffer is initialized.

Returns
string representation of the lattice

◆ toString() [2/4]

virtual const char* MeCab::Lattice::toString ( char *  buf,
size_t  size 
)
pure virtual

Return string representation of the lattice.

Result is saved in the specified buffer.

Parameters
bufoutput buffer
sizeoutput buffer size
Returns
string representation of the lattice

◆ toString() [3/4]

virtual const char* MeCab::Lattice::toString ( const Node node)
pure virtual

Return string representation of the node.

Returned object is managed by this instance. When clear/set_sentence() method is called, the returned buffer is initialized.

Returns
string representation of the node
Parameters
nodenode object

◆ toString() [4/4]

virtual const char* MeCab::Lattice::toString ( const Node node,
char *  buf,
size_t  size 
)
pure virtual

Return string representation of the node.

Result is saved in the specified buffer.

Parameters
nodenode object
bufoutput buffer
sizeoutput buffer size
Returns
string representation of the lattice

◆ what()

virtual const char* MeCab::Lattice::what ( ) const
pure virtual

Return error string.

Returns
error string

◆ Z()

virtual double MeCab::Lattice::Z ( ) const
pure virtual

return normalization factor of CRF.

Returns
normalization factor.

The documentation for this class was generated from the following file: