MeCab
|
#include <mecab.h>
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 Node * | parseToNode (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 Node * | nextNode ()=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 Node * | parseToNode (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 DictionaryInfo * | dictionary_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 Tagger * | create (int argc, char **argv) |
Factory method to create a new Tagger with a specified main's argc/argv-style parameters. | |
static Tagger * | create (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. |
Tagger class.
virtual MeCab::Tagger::~Tagger | ( | ) | [inline, virtual] |
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).
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.
argc | number of parameters |
argv | parameter 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.
arg | single string representation of the argment. |
virtual const DictionaryInfo* MeCab::Tagger::dictionary_info | ( | ) | const [pure virtual] |
Return 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.
node | node object. |
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.
node | node object |
ostr | output buffer |
olen | output buffer length |
virtual int MeCab::Tagger::lattice_level | ( | ) | const [pure virtual] |
Return lattice level.
This method is DEPRECATED. Use Lattice::*_request_type()
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.
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.
ostr | output buffer |
olen | output buffer length |
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.
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; }
virtual bool MeCab::Tagger::parse | ( | Lattice * | lattice | ) | const [pure virtual] |
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.
str | sentence |
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.
str | sentence |
len | sentence length |
ostr | output buffer |
olen | output buffer length |
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.
str | sentence |
len | sentence length |
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.
N | how many results you want to obtain |
str | sentence |
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.
N | how many results you want to obtain |
str | sentence |
len | sentence length |
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.
N | how many results you want to obtain |
str | input sentence |
len | input sentence length |
ostr | output buffer |
olen | output buffer length |
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.
str | sentence |
virtual bool MeCab::Tagger::parseNBestInit | ( | const char * | str, |
size_t | len | ||
) | [pure virtual] |
The same as parseNBestInit(), but input length can be passed.
str | sentence |
len | sentence length |
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.
str | sentence |
virtual const Node* MeCab::Tagger::parseToNode | ( | const char * | str, |
size_t | len | ||
) | [pure virtual] |
The same as parseToNode(), but input lenth can be passed.
str | sentence |
len | sentence length |
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).
virtual int MeCab::Tagger::request_type | ( | ) | const [pure virtual] |
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)
all_morphs |
virtual void MeCab::Tagger::set_lattice_level | ( | int | level | ) | [pure virtual] |
Set lattice level.
This method is DEPRECATED. Use Lattice::*_request_type()
level | lattice 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)
partial | partial 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).
request_type | new request type assigned |
virtual void MeCab::Tagger::set_theta | ( | float | theta | ) | [pure virtual] |
Set temparature parameter theta.
theta | temparature parameter. |
virtual float MeCab::Tagger::theta | ( | ) | const [pure virtual] |
Return temparature parameter theta.
static const char* MeCab::Tagger::version | ( | ) | [static] |
Return a version string.
virtual const char* MeCab::Tagger::what | ( | ) | const [pure virtual] |
Return error string.