MeCab

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Members

Public Member Functions | Static Public Member Functions
MeCab::Lattice Class Reference

Lattice class. More...

`#include <mecab.h>`

List of all members.

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

## Detailed Description

Lattice class.

## Constructor & Destructor Documentation

virtual MeCab::Lattice::~Lattice | ( |  | ) | `[inline, virtual]`

## Member Function Documentation

virtual void MeCab::Lattice::add_request_type | ( | int | request_type | ) | `[pure virtual]`

Add request type.

Parameters:

  request_type | new request type added

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

This method is used internally.

virtual Node** MeCab::Lattice::begin_nodes | ( |  | ) | const`[pure virtual]`

This method is used internally.

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:

  pos | position of nodes. 0 <= pos < size()

Returns:
  node linked list

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

virtual int MeCab::Lattice::boundary_constraint | ( | size_t | pos | ) | const`[pure virtual]`

Returns the boundary constraint at the position.

Parameters:

  pos | the position of constraint

Returns:
  boundary constraint type

virtual void MeCab::Lattice::clear | ( |  | ) | `[pure virtual]`

Clear all internal lattice data.

static Lattice* MeCab::Lattice::create | ( |  | ) | `[static]`

Create new Lattice object.

Returns:
  new Lattice object

virtual Node** MeCab::Lattice::end_nodes | ( |  | ) | const`[pure virtual]`

This method is used internally.

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:

  pos | position of nodes. 0 <= pos < size()

Returns:
  node linked list

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:

  N | how many results you want to obtain

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:

  N | how many results you want to obtain
  buf | output buffer
  size | output buffer size

Returns:
  string representation of the lattice

virtual Node* MeCab::Lattice::eos_node | ( |  | ) | const`[pure virtual]`

Return eos (end of sentence) node.

Returns:
  eos node object

virtual const char* MeCab::Lattice::feature_constraint | ( | size_t | pos | ) | const`[pure virtual]`

Returns the token constraint at the position.

Parameters:

  pos | the beginning position of constraint.

Returns:
  constrained node starting at the position.

virtual bool MeCab::Lattice::has_constraint | ( |  | ) | const`[pure virtual]`

Returns true if any parsing constraint is set.

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

virtual bool MeCab::Lattice::is_available | ( |  | ) | const`[pure virtual]`

Return true if result object is available.

Returns:
  boolean

virtual Node* MeCab::Lattice::newNode | ( |  | ) | `[pure virtual]`

Return new node.

Lattice objects has the ownership of the node.

Returns:
  new node object

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

virtual void MeCab::Lattice::remove_request_type | ( | int | request_type | ) | `[pure virtual]`

Remove request type.

Parameters:

  request_type | new request type removed

virtual int MeCab::Lattice::request_type | ( |  | ) | const`[pure virtual]`

Return the current request type.

Returns:
  request type

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

virtual void MeCab::Lattice::set_boundary_constraint | ( | size_t | pos,
|  | int | boundary_constraint_type
| ) |  | `[pure virtual]`

Set parsing constraint for partial parsing mode.

Parameters:

  pos | the position of the boundary
  boundary_constraint_type | the type of boundary

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_pos | the starting position of the constrained token.
  end_pos | the the ending position of the constrained token.
  feature | the feature of the constrained token.

virtual void MeCab::Lattice::set_request_type | ( | int | request_type | ) | `[pure virtual]`

Set request type.

Parameters:

  request_type | new request type assigned

virtual void MeCab::Lattice::set_result | ( | const char * | result | ) | `[pure virtual]`

Set golden parsing results for unittesting.

Parameters:

  result | the parsing result written in the standard mecab output.

virtual void MeCab::Lattice::set_sentence | ( | const char * | sentence | ) | `[pure virtual]`

Set sentence.

This method does not take the ownership of the object.

Parameters:

  sentence | sentence

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:

  sentence | sentence
  len | length of the sentence

virtual void MeCab::Lattice::set_theta | ( | float | theta | ) | `[pure virtual]`

Set temparature parameter theta.

Parameters:

  theta | temparature parameter.

virtual void MeCab::Lattice::set_what | ( | const char * | str | ) | `[pure virtual]`

Set error string.

given string is copied to the internal buffer.

Parameters:

  str | new error string

virtual void MeCab::Lattice::set_Z | ( | double | Z | ) | `[pure virtual]`

Set normalization factor of CRF.

Parameters:

  Z | new normalization factor.

virtual size_t MeCab::Lattice::size | ( |  | ) | const`[pure virtual]`

Return sentence size.

Returns:
  sentence size

virtual float MeCab::Lattice::theta | ( |  | ) | const`[pure virtual]`

Return temparature parameter theta.

Returns:
  temparature parameter.

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

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:

  node | node object

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:

  buf | output buffer
  size | output buffer size

Returns:
  string representation of the lattice

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:

  node | node object
  buf | output buffer
  size | output buffer size

Returns:
  string representation of the lattice

virtual const char* MeCab::Lattice::what | ( |  | ) | const`[pure virtual]`

Return error string.

Returns:
  error string

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:

- /home/taku/proj/mecab/mecab/src/mecab.h