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

Tagger class. More...

#include <mecab.h>

Public Member Functions

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

Static Public Member Functions

static bool parse (const Model &model, Lattice *lattice)
 Handy static method. More...
 
static Taggercreate (int argc, char **argv)
 Factory method to create a new Tagger with a specified main's argc/argv-style parameters. More...
 
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". More...
 
static const char * version ()
 Return a version string. More...
 

Detailed Description

Tagger class.

Constructor & Destructor Documentation

◆ ~Tagger()

virtual MeCab::Tagger::~Tagger ( )
inlinevirtual

Member Function Documentation

◆ all_morphs()

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

◆ create() [1/2]

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.

◆ create() [2/2]

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

◆ dictionary_info()

virtual const DictionaryInfo* MeCab::Tagger::dictionary_info ( ) const
pure virtual

Return DictionaryInfo linked list.

Returns
DictionaryInfo linked list

◆ formatNode() [1/2]

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

◆ formatNode() [2/2]

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

◆ lattice_level()

virtual int MeCab::Tagger::lattice_level ( ) const
pure virtual

Return lattice level.

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

Returns
int lattice level

◆ next() [1/2]

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

◆ next() [2/2]

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

◆ nextNode()

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

◆ parse() [1/5]

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

◆ parse() [2/5]

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

◆ parse() [3/5]

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

◆ parse() [4/5]

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(); const bool result = tagger->parse(lattice); delete tagger; return result; }

Returns
boolean

◆ parse() [5/5]

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

◆ parseNBest() [1/3]

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

◆ parseNBest() [2/3]

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

◆ parseNBest() [3/3]

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

◆ parseNBestInit() [1/2]

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

◆ parseNBestInit() [2/2]

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

◆ parseToNode() [1/2]

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

◆ parseToNode() [2/2]

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

◆ partial()

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

◆ request_type()

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

Return the current request type.

This method is DEPRECATED. Use Lattice class.

Returns
request type

◆ set_all_morphs()

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

◆ set_lattice_level()

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

◆ set_partial()

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

◆ set_request_type()

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

◆ set_theta()

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

Set temparature parameter theta.

Parameters
thetatemparature parameter.

◆ theta()

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

Return temparature parameter theta.

Returns
temparature parameter.

◆ version()

static const char* MeCab::Tagger::version ( )
static

Return a version string.

Returns
version string

◆ what()

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: