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

Tagger class. More...

#include <mecab.h>

List of all members.

Public Member Functions

virtual bool parse (Lattice *lattice) const =0
 Parse lattice object.
virtual const char * parse (const char *str)=0
 Parse given sentence and return parsed result as string.
virtual const NodeparseToNode (const char *str)=0
 Parse given sentence and return Node object.
virtual const char * parseNBest (size_t N, const char *str)=0
 Parse given sentence and obtain N-best results as a string format.
virtual bool parseNBestInit (const char *str)=0
 Initialize N-best enumeration with a sentence.
virtual const NodenextNode ()=0
 Return next-best parsed result.
virtual const char * next ()=0
 Return next-best parsed result.
virtual const char * formatNode (const Node *node)=0
 Return formatted node object.
virtual const char * parse (const char *str, size_t len, char *ostr, size_t olen)=0
 The same as parse() method, but input length and output buffer are passed.
virtual const char * parse (const char *str, size_t len)=0
 The same as parse() method, but input length can be passed.
virtual const NodeparseToNode (const char *str, size_t len)=0
 The same as parseToNode(), but input lenth can be passed.
virtual const char * parseNBest (size_t N, const char *str, size_t len)=0
 The same as parseNBest(), but input length can be passed.
virtual bool parseNBestInit (const char *str, size_t len)=0
 The same as parseNBestInit(), but input length can be passed.
virtual const char * next (char *ostr, size_t olen)=0
 The same as next(), but output buffer can be passed.
virtual const char * parseNBest (size_t N, const char *str, size_t len, char *ostr, size_t olen)=0
 The same as parseNBest(), but input length and output buffer can be passed.
virtual const char * formatNode (const Node *node, char *ostr, size_t olen)=0
 The same as formatNode(), but output buffer can be passed.
virtual void set_request_type (int request_type)=0
 Set request type.
virtual int request_type () const =0
 Return the current request type.
virtual bool partial () const =0
 Return true if partial parsing mode is on.
virtual void set_partial (bool partial)=0
 set partial parsing mode.
virtual int lattice_level () const =0
 Return lattice level.
virtual void set_lattice_level (int level)=0
 Set lattice level.
virtual bool all_morphs () const =0
 Return true if all morphs output mode is on.
virtual void set_all_morphs (bool all_morphs)=0
 set all-morphs output mode.
virtual void set_theta (float theta)=0
 Set temparature parameter theta.
virtual float theta () const =0
 Return temparature parameter theta.
virtual const DictionaryInfodictionary_info () const =0
 Return DictionaryInfo linked list.
virtual const char * what () const =0
 Return error string.
virtual ~Tagger ()

Static Public Member Functions

static bool parse (const Model &model, Lattice *lattice)
 Handy static method.
static Taggercreate (int argc, char **argv)
 Factory method to create a new Tagger with a specified main's argc/argv-style parameters.
static Taggercreate (const char *arg)
 Factory method to create a new Tagger with a string parameter representation, i.e., "-d /user/local/mecab/dic/ipadic -Ochasen".
static const char * version ()
 Return a version string.

Detailed Description

Tagger class.


Constructor & Destructor Documentation

virtual MeCab::Tagger::~Tagger ( ) [inline, virtual]

Member Function Documentation

virtual bool MeCab::Tagger::all_morphs ( ) const [pure virtual]

Return true if all morphs output mode is on.

This method is DEPRECATED. Use Lattice::has_request_type(MECAB_ALL_MORPHS).

Returns:
boolean
static Tagger* MeCab::Tagger::create ( int  argc,
char **  argv 
) [static]

Factory method to create a new Tagger with a specified main's argc/argv-style parameters.

Return NULL if new model cannot be initialized. Use MeCab::getLastError() to obtain the cause of the errors.

Returns:
new Tagger object
Parameters:
argcnumber of parameters
argvparameter list
static Tagger* MeCab::Tagger::create ( const char *  arg) [static]

Factory method to create a new Tagger with a string parameter representation, i.e., "-d /user/local/mecab/dic/ipadic -Ochasen".

Return NULL if new model cannot be initialized. Use MeCab::getLastError() to obtain the cause of the errors.

Returns:
new Model object
Parameters:
argsingle string representation of the argment.
virtual const DictionaryInfo* MeCab::Tagger::dictionary_info ( ) const [pure virtual]

Return DictionaryInfo linked list.

Returns:
DictionaryInfo linked list
virtual const char* MeCab::Tagger::formatNode ( const Node node) [pure virtual]

Return formatted node object.

The format is specified with --unk-format, --bos-format, --eos-format, and --eon-format respectively. You should not delete the returned string. The returned buffer is overwritten when parse method is called again. This method is NOT thread safe. This method is DEPRECATED. Use Lattice class.

Parameters:
nodenode object.
Returns:
parsed result
virtual const char* MeCab::Tagger::formatNode ( const Node node,
char *  ostr,
size_t  olen 
) [pure virtual]

The same as formatNode(), but output buffer can be passed.

Return NULL if more than |olen| buffer is required to store output string.

Parameters:
nodenode object
ostroutput buffer
olenoutput buffer length
Returns:
parsed result
virtual int MeCab::Tagger::lattice_level ( ) const [pure virtual]

Return lattice level.

This method is DEPRECATED. Use Lattice::*_request_type()

Returns:
int lattice level
virtual const char* MeCab::Tagger::next ( ) [pure virtual]

Return next-best parsed result.

You must call parseNBestInit() in advance. Return NULL if no more reuslt is available. This method is NOT thread safe. This method is DEPRECATED. Use Lattice class.

Returns:
parsed result
virtual const char* MeCab::Tagger::next ( char *  ostr,
size_t  olen 
) [pure virtual]

The same as next(), but output buffer can be passed.

Return NULL if more than |olen| buffer is required to store output string.

Parameters:
ostroutput buffer
olenoutput buffer length
Returns:
parsed result
virtual const Node* MeCab::Tagger::nextNode ( ) [pure virtual]

Return next-best parsed result.

You must call parseNBestInit() in advance. Return NULL if no more reuslt is available. This method is NOT thread safe. This method is DEPRECATED. Use Lattice class.

Returns:
node object
static bool MeCab::Tagger::parse ( const Model model,
Lattice lattice 
) [static]

Handy static method.

Return true if lattice is parsed successfully. This function is equivalent to { Tagger *tagger = model.createModel(); cosnt bool result = tagger->parse(lattice); delete tagger; return result; }

Returns:
boolean
virtual bool MeCab::Tagger::parse ( Lattice lattice) const [pure virtual]

Parse lattice object.

Return true if lattice is parsed successfully. A sentence must be set to the lattice with Lattice:set_sentence object before calling this method. Parsed node object can be obtained with Lattice:bos_node. This method is thread safe.

Returns:
lattice lattice object
boolean
virtual const char* MeCab::Tagger::parse ( const char *  str) [pure virtual]

Parse given sentence and return parsed result as string.

You should not delete the returned string. The returned buffer is overwritten when parse method is called again. This method is NOT thread safe.

Parameters:
strsentence
Returns:
parsed result
virtual const char* MeCab::Tagger::parse ( const char *  str,
size_t  len,
char *  ostr,
size_t  olen 
) [pure virtual]

The same as parse() method, but input length and output buffer are passed.

Return parsed result as string. The result pointer is the same as |ostr|. Return NULL, if parsed result string cannot be stored within |olen| bytes.

Parameters:
strsentence
lensentence length
ostroutput buffer
olenoutput buffer length
Returns:
parsed result
virtual const char* MeCab::Tagger::parse ( const char *  str,
size_t  len 
) [pure virtual]

The same as parse() method, but input length can be passed.

Parameters:
strsentence
lensentence length
Returns:
parsed result
virtual const char* MeCab::Tagger::parseNBest ( size_t  N,
const char *  str 
) [pure virtual]

Parse given sentence and obtain N-best results as a string format.

Currently, N must be 1 <= N <= 512 due to the limitation of the buffer size. You should not delete the returned string. The returned buffer is overwritten when parse method is called again. This method is DEPRECATED. Use Lattice class.

Parameters:
Nhow many results you want to obtain
strsentence
Returns:
parsed result
virtual const char* MeCab::Tagger::parseNBest ( size_t  N,
const char *  str,
size_t  len 
) [pure virtual]

The same as parseNBest(), but input length can be passed.

Parameters:
Nhow many results you want to obtain
strsentence
lensentence length
Returns:
parsed result
virtual const char* MeCab::Tagger::parseNBest ( size_t  N,
const char *  str,
size_t  len,
char *  ostr,
size_t  olen 
) [pure virtual]

The same as parseNBest(), but input length and output buffer can be passed.

Return NULL if more than |olen| buffer is required to store output string.

Parameters:
Nhow many results you want to obtain
strinput sentence
leninput sentence length
ostroutput buffer
olenoutput buffer length
Returns:
parsed result
virtual bool MeCab::Tagger::parseNBestInit ( const char *  str) [pure virtual]

Initialize N-best enumeration with a sentence.

Return true if initialization finishes successfully. N-best result is obtained by calling next() or nextNode() in sequence. This method is NOT thread safe. This method is DEPRECATED. Use Lattice class.

Parameters:
strsentence
Returns:
boolean
virtual bool MeCab::Tagger::parseNBestInit ( const char *  str,
size_t  len 
) [pure virtual]

The same as parseNBestInit(), but input length can be passed.

Parameters:
strsentence
lensentence length
Returns:
boolean
parsed result
virtual const Node* MeCab::Tagger::parseToNode ( const char *  str) [pure virtual]

Parse given sentence and return Node object.

You should not delete the returned node object. The returned buffer is overwritten when parse method is called again. You can traverse all nodes via Node::next member. This method is NOT thread safe.

Parameters:
strsentence
Returns:
bos node object
virtual const Node* MeCab::Tagger::parseToNode ( const char *  str,
size_t  len 
) [pure virtual]

The same as parseToNode(), but input lenth can be passed.

Parameters:
strsentence
lensentence length
Returns:
node object
virtual bool MeCab::Tagger::partial ( ) const [pure virtual]

Return true if partial parsing mode is on.

This method is DEPRECATED. Use Lattice::has_request_type(MECAB_PARTIAL).

Returns:
boolean
virtual int MeCab::Tagger::request_type ( ) const [pure virtual]

Return the current request type.

This method is DEPRECATED. Use Lattice class.

Returns:
request type
virtual void MeCab::Tagger::set_all_morphs ( bool  all_morphs) [pure virtual]

set all-morphs output mode.

This method is DEPRECATED. Use Lattice::add_request_type(MECAB_ALL_MORPHS) or Lattice::remove_request_type(MECAB_ALL_MORPHS)

Parameters:
all_morphs
virtual void MeCab::Tagger::set_lattice_level ( int  level) [pure virtual]

Set lattice level.

This method is DEPRECATED. Use Lattice::*_request_type()

Parameters:
levellattice level
virtual void MeCab::Tagger::set_partial ( bool  partial) [pure virtual]

set partial parsing mode.

This method is DEPRECATED. Use Lattice::add_request_type(MECAB_PARTIAL) or Lattice::remove_request_type(MECAB_PARTIAL)

Parameters:
partialpartial mode
virtual void MeCab::Tagger::set_request_type ( int  request_type) [pure virtual]

Set request type.

This method is DEPRECATED. Use Lattice::set_request_type(MECAB_PARTIAL).

Parameters:
request_typenew request type assigned
virtual void MeCab::Tagger::set_theta ( float  theta) [pure virtual]

Set temparature parameter theta.

Parameters:
thetatemparature parameter.
virtual float MeCab::Tagger::theta ( ) const [pure virtual]

Return temparature parameter theta.

Returns:
temparature parameter.
static const char* MeCab::Tagger::version ( ) [static]

Return a version string.

Returns:
version string
virtual const char* MeCab::Tagger::what ( ) const [pure virtual]

Return error string.

Returns:
error string

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