net.moraleboost.junsai.tagger
クラス Tagger

java.lang.Object
  上位を拡張 net.moraleboost.junsai.tagger.Tagger

public class Tagger
extends java.lang.Object

形態素解析器クラス Dictionary, CharProperty, Connectorは、複数のスレッドから 安全に共有できる。Taggerは、スレッドごとに別のインスタンスを 構築する必要がある。

作成者:
taketa

コンストラクタの概要
Tagger(Tagger tagger)
          他のインスタンスの辞書を流用して形態素解析器を構築する。
Tagger(TaggerConfig config)
          configを参照して、形態素解析器を構築する。
Tagger(TaggerConfig config, Dictionary[] dictionaries, Dictionary unknownDictionary, Connector connector, CharProperty charProperty)
          既存の辞書インスタンスを流用して形態素解析器を構築する。
 
メソッドの概要
protected  CharProperty getCharProperty()
           
protected  TaggerConfig getConfig()
           
protected  Connector getConnector()
           
protected  Dictionary[] getDictionaries()
           
protected  Dictionary getUnknownDictionary()
           
 Node nextNBestNode()
          次のNBest解ノードを取得する。
static CharProperty openCharProperty(TaggerConfig config)
          configを参照し、文字カテゴリ定義を開いて返す。
static Connector openConnector(TaggerConfig config)
          configを参照し、接続コスト行列を開いて返す。
static Dictionary[] openDictionaries(TaggerConfig config)
          configを参照し、Dictionaryを新しく開いて返す。
static Dictionary openUnknownDictionary(TaggerConfig config)
          configを参照し、未知語辞書を開いて返す。
 java.lang.String parse(java.lang.CharSequence str, int offset, int len)
          strを解析して、その結果を文字列として返す。
 void parse(java.lang.CharSequence str, int offset, int len, java.lang.Appendable out)
          strを解析して、その結果をoutに書き込む
 java.lang.String parseNBest(int N, java.lang.CharSequence str, int offset, int len)
          strを解析し、N-best解を文字列として返す。
 void parseNBest(int N, java.lang.CharSequence str, int offset, int len, java.lang.Appendable out)
          strを解析し、N-best解をoutに書き込む。
 void parseNBestInit(java.lang.CharSequence str, int offset, int len)
          strを解析し、N-best解を得る準備をする。
 Node parseToNode(java.lang.CharSequence str, int offset, int len)
          strを解析して、解析結果のノードを返す。
 void reset(TaggerConfig config, Dictionary[] dictionaries, Dictionary unknownDictionary, Connector connector, CharProperty charProperty)
           
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

Tagger

public Tagger(TaggerConfig config)
       throws TaggerException,
              DictionaryException,
              java.io.IOException
configを参照して、形態素解析器を構築する。 辞書を新しくオープンする。

パラメータ:
config -
例外:
TaggerException
DictionaryException
java.io.IOException

Tagger

public Tagger(TaggerConfig config,
              Dictionary[] dictionaries,
              Dictionary unknownDictionary,
              Connector connector,
              CharProperty charProperty)
       throws TaggerException,
              DictionaryException
既存の辞書インスタンスを流用して形態素解析器を構築する。

パラメータ:
config -
dictionaries -
unknownDictionary -
connector -
charProperty -
例外:
TaggerException
DictionaryException

Tagger

public Tagger(Tagger tagger)
       throws TaggerException,
              DictionaryException
他のインスタンスの辞書を流用して形態素解析器を構築する。

パラメータ:
tagger -
例外:
TaggerException
DictionaryException
メソッドの詳細

getConfig

protected TaggerConfig getConfig()

getDictionaries

protected Dictionary[] getDictionaries()

getUnknownDictionary

protected Dictionary getUnknownDictionary()

getConnector

protected Connector getConnector()

getCharProperty

protected CharProperty getCharProperty()

reset

public void reset(TaggerConfig config,
                  Dictionary[] dictionaries,
                  Dictionary unknownDictionary,
                  Connector connector,
                  CharProperty charProperty)
           throws TaggerException,
                  DictionaryException
例外:
TaggerException
DictionaryException

parse

public java.lang.String parse(java.lang.CharSequence str,
                              int offset,
                              int len)
                       throws TaggerException
strを解析して、その結果を文字列として返す。

パラメータ:
str - 解析対象テキスト
offset - str内での解析開始位置
len - offsetからの長さ
戻り値:
解析結果
例外:
TaggerException

parse

public void parse(java.lang.CharSequence str,
                  int offset,
                  int len,
                  java.lang.Appendable out)
           throws TaggerException
strを解析して、その結果をoutに書き込む

パラメータ:
str - 解析対象テキスト
offset - str内での解析開始位置
len - offsetからの長さ
out - 解析結果を書きこむオブジェクト
例外:
TaggerException

parseToNode

public Node parseToNode(java.lang.CharSequence str,
                        int offset,
                        int len)
                 throws TaggerException
strを解析して、解析結果のノードを返す。

パラメータ:
str - 解析対象テキスト
offset - str内での解析開始位置
len - offsetからの長さ
戻り値:
解析結果ノード
例外:
TaggerException

parseNBestInit

public void parseNBestInit(java.lang.CharSequence str,
                           int offset,
                           int len)
                    throws TaggerException
strを解析し、N-best解を得る準備をする。 解析結果は、nextNBestNode()を呼び出すことにより、 順次取得できる。

パラメータ:
str - 解析対象テキスト
offset - str内での解析開始位置
len - offsetからの長さ
例外:
TaggerException

parseNBest

public java.lang.String parseNBest(int N,
                                   java.lang.CharSequence str,
                                   int offset,
                                   int len)
                            throws TaggerException
strを解析し、N-best解を文字列として返す。

パラメータ:
N -
str -
offset -
len -
戻り値:
例外:
TaggerException

parseNBest

public void parseNBest(int N,
                       java.lang.CharSequence str,
                       int offset,
                       int len,
                       java.lang.Appendable out)
                throws TaggerException
strを解析し、N-best解をoutに書き込む。

パラメータ:
N -
str -
offset -
len -
out -
例外:
TaggerException

nextNBestNode

public Node nextNBestNode()
次のNBest解ノードを取得する。最後に達すると、nullを返す。

戻り値:
有効なBOSノードか、null。

openDictionaries

public static Dictionary[] openDictionaries(TaggerConfig config)
                                     throws DictionaryException,
                                            java.io.IOException
configを参照し、Dictionaryを新しく開いて返す。

パラメータ:
config -
戻り値:
例外:
DictionaryException
java.io.IOException

openUnknownDictionary

public static Dictionary openUnknownDictionary(TaggerConfig config)
                                        throws DictionaryException,
                                               java.io.IOException
configを参照し、未知語辞書を開いて返す。

パラメータ:
config -
戻り値:
例外:
DictionaryException
java.io.IOException

openConnector

public static Connector openConnector(TaggerConfig config)
                               throws DictionaryException,
                                      java.io.IOException
configを参照し、接続コスト行列を開いて返す。

パラメータ:
config -
戻り値:
例外:
DictionaryException
java.io.IOException

openCharProperty

public static CharProperty openCharProperty(TaggerConfig config)
                                     throws DictionaryException,
                                            java.io.IOException
configを参照し、文字カテゴリ定義を開いて返す。

パラメータ:
config -
戻り値:
例外:
DictionaryException
java.io.IOException