net.trialpc.sticktools.model
クラス DocCollection<T extends DocumentModel>

java.lang.Object
  上位を拡張 net.trialpc.sticktools.model.AbstractLangModel
      上位を拡張 net.trialpc.sticktools.model.WrapModel<T>
          上位を拡張 net.trialpc.sticktools.model.DocCollection<T>
型パラメータ:
T -
すべての実装されたインタフェース:
java.io.Serializable, java.lang.Iterable<T>, java.util.EventListener, LangModel, StateChangeListener, StateChangeObservable

public class DocCollection<T extends DocumentModel>
extends WrapModel<T>
implements java.lang.Iterable<T>, java.io.Serializable

基本となる文書集合モデルのクラスです。 このクラスは、必ず文書モデルクラスをラッピングするように設計されています。

作成者:
tetsu
関連項目:
WrapModel, LangModels.EMPTY_COLLECTION, 直列化された形式

フィールドの概要
 
クラス net.trialpc.sticktools.model.WrapModel から継承されたフィールド
listeners
 
コンストラクタの概要
DocCollection()
          空の DocCollection インスタンスを生成します。
 
メソッドの概要
 boolean addDocument(T d)
          文書モデルを追加します。
 void addDocumentAll(java.util.Collection<T> c)
          複数の文書モデルを追加します。
 boolean containsDocument(java.lang.String docid)
          指定した文書 ID をもつ文書モデルが文書集合モデルに存在しているかどうかを返します。
 boolean containsDocument(T d)
          文書モデルが文書集合モデルに存在しているかどうかを返します。
 int documentFrequency(java.lang.String term)
          文書頻度を返します。
protected  java.util.Set<T> getChildrenModels()
          ラッピングしている言語モデルのセットを返します。
 T getDocument(java.lang.String id)
          指定した文書 ID を持つ文書モデルを返します。
 java.util.Set<T> getInvertedList(java.lang.String term)
          転置リストを返します。
 java.util.Iterator<T> iterator()
          文書モデルを返すイテレータです。
static
<T extends DocumentModel>
DocCollection<T>
unmodifiableInstance(DocCollection<T> o)
          変更不可能な文書集合インスタンスを返します。
 
クラス net.trialpc.sticktools.model.WrapModel から継承されたメソッド
addChildModel, addChildModelAll, addListener, castCollection, equals, getVocabulary, hashCode, isModifiable, numOfTerms, stateChanged, termCount
 
クラス net.trialpc.sticktools.model.AbstractLangModel から継承されたメソッド
containsTerm, containsTerms, contaisQueries, numOfVocabulary, termFrequency, toString
 
クラス java.lang.Object から継承されたメソッド
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

コンストラクタの詳細

DocCollection

public DocCollection()
空の DocCollection インスタンスを生成します。

メソッドの詳細

addDocument

public boolean addDocument(T d)
文書モデルを追加します。

パラメータ:
d - 文書モデル
戻り値:
文書モデルが追加できたときは true
例外:
java.lang.NullPointerException - dnull である場合

addDocumentAll

public void addDocumentAll(java.util.Collection<T> c)
複数の文書モデルを追加します。 この実装は、addDocument(DocumentModel) に依存しています。

パラメータ:
c - 文書モデルを含むコレクション

getDocument

public T getDocument(java.lang.String id)
指定した文書 ID を持つ文書モデルを返します。

パラメータ:
id - 文書 ID
戻り値:
文書モデル。文書集合モデルに存在しない場合は null

containsDocument

public boolean containsDocument(T d)
文書モデルが文書集合モデルに存在しているかどうかを返します。

パラメータ:
d - 文書モデル
戻り値:
d が存在していれば true

containsDocument

public boolean containsDocument(java.lang.String docid)
指定した文書 ID をもつ文書モデルが文書集合モデルに存在しているかどうかを返します。

パラメータ:
docid - 文書 ID
戻り値:
文書モデルが存在していれば true

documentFrequency

public int documentFrequency(java.lang.String term)

文書頻度を返します。 文書頻度 (document frequency; DF) とは、語 term の含まれる文書の数のことを指します。 この実装では、termnull のときは 0 を返します。

このメソッドで返される値の逆数の log を計算することで、 idf を求めることができます。

パラメータ:
term - 頻度を求める単語
戻り値:
term を含む文書数

getInvertedList

public java.util.Set<T> getInvertedList(java.lang.String term)
転置リストを返します。

パラメータ:
term - 語
戻り値:
term に対応した転置リスト

unmodifiableInstance

public static <T extends DocumentModel> DocCollection<T> unmodifiableInstance(DocCollection<T> o)
変更不可能な文書集合インスタンスを返します。

型パラメータ:
T - 文書集合の型
パラメータ:
o - 文書集合インスタンス
戻り値:
変更不可能な文書集合インスタンス

getChildrenModels

protected java.util.Set<T> getChildrenModels()
クラス WrapModel の記述:
ラッピングしている言語モデルのセットを返します。 ラッピングの対象がない場合でも、空のセットを返すように実装されるべきです。

定義:
クラス WrapModel<T extends DocumentModel> 内の getChildrenModels
戻り値:
ラッピングの対象となる言語モデルのセット

iterator

public java.util.Iterator<T> iterator()
文書モデルを返すイテレータです。

定義:
インタフェース java.lang.Iterable<T extends DocumentModel> 内の iterator
戻り値:
イテレータ