IBM Content Analyzer プログラミングガイド

本書には、IBM の専有情報が含まれています。その情報は、使用許諾条件に基づき提供され、 著作権により保護されています。 本書に記載される情報には、いかなる製品の保証も含まれていません。 また、本書で提供されるいかなる記述も、製品保証として解釈すべきではありません。 お客様の環境によっては、資料中の円記号がバックスラッシュと表示されたり、バックスラッシュが円記号と表示されたりする場合があります。

© Copyright IBM Corp. 2007, 2008. All Rights Reserved.

この文書では、IBM Content Analyzer のUser APIを利用したプログラミングを解説します。

1 はじめに
本書は、IBM Content Analyzer (ICA) サーバーの機能を利用するためのアプリケーションの作成方法について書かれています。ICAのアプリケーション・プログラミング・インターフェースを利用する方法を学習することで、ユーザーのアプリケーションにICAの機能を取り入れることが簡単であることが分かります。
1.1 機能概要
ICA は、エンド・ユーザー向けのGUIとアプリケーションのためのAPIを提供します。ICAサーバー・システムの標準的な構成を図1に示します。ICAのインデクサによって、ICAの前処理によって抽出された情報がICAインデックスに保存されます。IBM WebSphere Application Serverの上で動いているICAサーバーは、インデックスを読んで、ユーザーが検索条件で指定したキーワードと文書の情報を取り出します。ICAサーバーには、検索・マイニングの結果を戻す方法が 2通りあります。1つは、TEXT MINERを利用する方法です。TEXT MINERは、ユーザー向けにGUIを提供するアプリケーションで、IBM WebSphere Application Server上で動作します。もう1つの方法は、ICAのユーザーAPIを利用する方法です。ユーザーAPIは、アプリケーション・プログラムがICAサーバーの機能を利用するためのインターフェースを提供します。 本書では、このAPIとそれを利用したプログラミグの具体的な例を紹介します。


図 1. ICAサーバーの標準構成

図 1に示す通り、プログラミング・インターフェースは、ICAサーバーの実装とは完全に分離されています。ICA User APIと呼ばれるこのプログラミング・インターフェースは、否とJava APIのセットで構成されています。なお、本書の中では、単にAPIと呼ぶ場合もあります。
ユーザーがTEXT MINER(ICAが提供するGUIアプリケーション)から利用可能なほとんどの機能は、ICA User APIから利用することが可能です。それによって、ユーザーは、TEXT MINERに代わる固有のGUIを作成することが可能になります。ICA User API は、Java言語として提供されます。ICA User APIを利用してカスタム・アプリケーションを作成する場合には、次の2つのJARファイルをクラスパスに追加する必要があります。
  • %TAKMI_HOME%/lib/TAKMI_MINER_API.jar
  • %TAKMI_HOME%/lib/TAKMI_SDK.jar
1.2 User API の構造

ICA User APIを利用して、データベースへの接続、マイニング・エンジンの利用、カテゴリーツリーなどその他のリソースの操作を行うことができます。
ここではICA User APIの構造を示します。


図 2. ICA User APIの基本インターフェース

TextMiner は、対象となる文書セットに関する全てのインターフェースを提供します。これにより、アプリケーション開発者は、サーバーの背後にある実装を気にすることなく、マイニング機能の使い方に集中することができるようになります。

CategoryTree は、カテゴリーのセットに対応します。 Category は、カテゴリー・ツリーの1つのノードになります。各カテゴリーは、名前とルート・ノードからのパスを保持しています。

SearchQuery は、検索条件を木構造で保持します。条件ノードは、キーワード条件、カテゴリー条件、またはその2つを混ぜた条件のノードになります。それは、マイニング機能によって返される対象文書セットを絞り込むために使用します。SearchQuery のインスタンス内に検索条件の木構造を作る方法は2通りあります。 1つの方法はTextMinerが提供するユーティリティ機能を呼ぶ方法です。もう1つの方法は、検索条件ノード(SearchConditionNode)を作成してから、手作業で検索条件の木構造を構築し、それをSearchQueryにセットする方法です。 SearchConditionNodeは、SearchConditionNodeFactoryを用いて作成します。

MiningFunction は、ICAが提供する予め用意されたマイニング機能を実行するために使用します。現リリースでは、MiningFunctionのサブクラスとして、以下の機能が利用可能です。
  • TopViewFunction
  • DocListViewFunction
  • CategoryViewFunction
  • TimeSeriesViewFunction
  • TopicViewFunction
  • DeltaViewFunction
  • TwoDMapViewFunction

2 アプリケーション・プログラミング・インターフェース
2.1 データベース API
TextMiner は、ICAのカスタム・アプリケーションを作成するために必要なほとんど全ての機能を提供します。アプリケーションは、まず最初にTextMinerのインスタンスを取得する必要があります。その際、接続すべきデータベースを指定します。TextMinerのインスタンスを取得する前に、TAKMI_HOME環境変数がオペレーティング・システムの環境変数として定義されている必要があります。定義されていない場合には、プログラムの中で明示的に指定します。

2.1.1 提供される機能
データベースを操作するために次の機能が提供されます。
class com.ibm.takmi.ext.TextMiner
API Return Description

getDatabaseNames()
(static function)

returns: String[]
throws: MinerException
Return a list of available database names.
getInstance(
String databaseName)
(static function)
returns: TextMiner
throws: MinerException
Return TextMiner instance.
releaseDatabase() returns: (void)
throws: MinerException
Release the currently selected database.

ユーザーは、静的メソッドであるTextMiner#getDatabaseNames() を用いて、利用可能なデータベース名の一覧を取得することができます。続いて、その一覧にある1つのデータベース名を引数としてTextMiner#getInstance()を呼び出し、TextMinerのインスタンスを取得します。TextInstanceを取得する方法は、この方法だけになります。 これらの機能は、MinerException (com.ibm.takmi.ext.MinerException)を投げる可能性があるので、ユーザーは、例外処理を適切に行う必要があります。MinerExceptionは、ICA User APIによって使用される共通の例外です。

2.1.2 サンプル・コード
import com.ibm.takmi.ext.MinerException;
import com.ibm.takmi.ext.TextMiner;
:
(snip)
:
// If TAKMI_HOME environment variable is not defined, set here
// System.setProperty("TAKMI_HOME", "C:\\Program Files\\IBM\\takmi");

try {
  // Get database name list
   String databaseNames[] = TextMiner.getDatabaseNames();

  // Get TextMiner instance
  TextMiner miner = TextMiner.getInstance(“SAMPLE_DATABASE”);

  } catch (MinerException e) {
  // Do exception handling here
}

2.2 カテゴリー API
カテゴリーは、ICAサーバーに事前に定義されているカテゴリー・ツリーの中の1つのノードです。各カテゴリーは、独自のパスと名前で構成されています。アプリケーション内では、カテゴリーは、Category interface (com.ibm.takmi.ext.Category)を実装するインスタンスとして表現されます。 TextMiner は、サーバー上のカテゴリー・ツリーからカテゴリーを取得する幾つかの機能を提供します。

2.2.1 提供される機能
カテゴリーを操作するために次の機能が提供されます。
class com.ibm.takmi.ext.TextMiner
API Return Description

getRootCategories()

returns: Category[]
throws: MinerException
Return the list of root (top-level) categories defined in the category tree.
getChildCategories(
Category category)
returns: Category[]
throws: MinerException
Return a list of subcategories under the specified category.
getCategory(
String categoryPath)
returns: Category
throws: MinerException
Return the category of the specified category path.
dumpCategoryTree() returns: String
throws: MinerException
Return an XML String that describes the hierarchy structure of category tree.

class com.ibm.takmi.ext.Category
API Return Description
getPath() returns: String
throws: (none)
Returns the category path.
getName() returns: String
throws: (none)
Returns the category name.

TextMiner#getRootCategories() を用いて、サーバー上のカテゴリー・ツリーにあるルート・カテゴリーの配列を取得することができます。あるカテゴリーの子カテゴリーを取得する場合、 TextMiner#getChildCategories() を呼び出します。この時、引数としてカテゴリを指定します。取得されたカテゴリーは、カテゴリー検索の条件やマイニング機能のパラメータとして使用可能です。(マイニング機能の説明は後述。)
これらの機能は、MinerException (com.ibm.takmi.ext.MinerException)を投げる可能性があるので、ユーザーは、例外処理を適切に行う必要があります。MinerExceptionは、ICA User APIによって使用される共通の例外です。

2.2.2 サンプル・コード
import com.ibm.takmi.ext.Category;
import com.ibm.takmi.ext.TextMiner;
:
(snip)
:
Try {
  // As for initialization of TextMiner, please refer to the “Database API” chapter.
  TextMiner miner = ..;

  // Get root category list
  Category categories[] = miner.getRootCategories();

  // Show data for each root categories
  for (int i=0; i < categories.length; i++) {
    System.out.println(“Category name: “ + categories[i].getName());
    System.out.println(“Category path: “ + categories[i].getPath());
  }

  // Get child category list of the first root category
  Category childCategories[] = miner.getChildCategories(categories[0]);

  // Dump category tree.
   System.out.println(miner.dumpCategoryTree());

  // Get Category by category path
  Category myCategory = miner.getCategory(“".tkm_ja_base_word.noun"”)

  } catch (MinerException e) {
    // Do exception handling here
  }

2.3 サーチ API
ICAマイニング機能は、省略時において、選択されたデータベースにある全ての文書を対象としています。ユーザーは、マイニング機能のパラメータとして SearchQuery を指定することによって、対象となる文書セットを絞り込むことが可能になります。SearchQuery は、検索条件を木構造で保持します。各条件ノードは、キーワード条件ノード、カテゴリー条件ノード、あるいは、それらを混ぜた条件のードになります。
SearchQuery のインスタンス内部に検索条件ツリーを作成する方法が2通りあります。1つ目の方法は、TextMiner が提供するaddNodeTypeConditionと呼ばれる機能を利用する方法です。これらの機能は、ICA TEXT MINERが行うように、検索条件ツリーを漸次構築することを可能にします。
もう1つの方法は、検索条件ノードを作成してから、手作業で検索条件の木構造を構築し、それをSearchQueryにセットする方法です。The other way is to create search condition nodes (SearchConditionNode), build a tree structure of search condition by hand, and set it to the SearchQuery. SearchConditionNodeFactoryは、 TextMinerから取得可能で、全ての種類のSearchConditionNode インスタンスを作成することができます。この方法により、ユーザーは、TextMiner のユーティリティ機能を使う場合よりも、より複雑な検索条件ツリー を構築することが可能になります。

2.3.1 提供される機能
検索条件を操作するために次の機能が提供されます。
class com.ibm.takmi.ext.TextMiner
API 戻り 説明
newSearchQuery() returns: SearchQuery
throws: MinerException
Returns a search query instance.
addCategoryCondition(
SearchQuery query,
Category category,
boolean isAnd,
boolean isNot)
returns: SearchConditionNode
throws: MinerException
Add category condition node with the specified category to the given search query.
addKeywordCondition(
SearchQuery query,
Category category,
String keyword,
boolean isAnd,
boolean isNot)
returns: SearchConditionNode
throws: MinerException
Add keyword condition node with the specified keyword of the specified category to the given search query, and return the added SearchConditionNode.
addKeywordCondition(
SearchQuery query,
String keyword,
boolean isAnd,
boolean isNot)
returns: SearchConditionNode
throws: MinerException
Add keyword condition node with the specified keyword of all categories to the given search query, and return the added SearchConditionNode.
addStringCondition(
SearchQuery query,
String keyword,
boolean isAnd,
boolean isNot)
returns: SearchConditionNode
throws: MinerException
Add string condition node with the specified keyword to the given search query, and return the added SearchConditionNode.
addTimeCondition(
SearchQuery query,
String timeScale,
int timeValue,
boolean isAnd,
boolean isNot)
returns: SearchConditionNode
throws: MinerException
Add time condition node with the specified time value of the specified time scale to the given search query, and return the added SearchConditionNode.
getSearchConditionNode
Factory()
returns: SearchConditionNodeFactory
throws: MinerException
Returns a search condition node factory instance.

interface com.ibm.takmi.ext.search.SearchQuery
API 戻り 説明
setSearchConditionNode(SearchConditionNode node) returns: (void)
throws: MinerException
Sets the specified search condition node to the search query.
getSearchConditionNode() returns: SearchConditionNode
throws: (none)
Returns the search condition node set to the search query.

interface com.ibm.takmi.ext.search.SearchConditionNodeFactory
API 戻り 説明
newKeywordNode(
Category category,
String keyword)
returns: SearchConditionNode
throws: MinerException
Returns a new keyword search condition node with the specified keyword of the specified category.
newKeywordNode(
String keyword)
returns: SearchConditionNode
throws: MinerException
Returns a new keyword search condition node of with the specified keyword of all categories.
newCategoryNode(
Category category)
returns: SearchConditionNode
throws: MinerException
Returns a new category search condition node with the specified category.
newStringNode(
String keyword)
returns: SearchConditionNode
throws: MinerException
Returns a new string search condition node with the specified string.
newTimeNode(
String timeScale,
int timeValue)
returns: SearchConditionNode
throws: MinerException
Returns a new time search condition node with the specified time value of the specified time scale.
newAndNode() returns: SearchConditionNodeWithChildren
throws: (none)
Returns a new AND search condition node.
newOrNode() returns: SearchConditionNodeWithChildren
throws: (none)
Returns a new OR search condition node.

interface com.ibm.takmi.ext.search.SearchConditionNode
(super interface of KeywordSearchConditionNode, CategorySearchConditionNode, StringSearhConditonNode, AndSearchConditionNode, OrSearchConditionNode)
API 戻り 説明
isNot() returns: boolean
throws: (none)
Returns true if the search condition node is negative.
setNot(boolean isNot) returns: (none)
throws: (none)
Make the search condition node negative if isNot is true.
getFreqency() returns: int
throws: (none)
Returns the frequency of the search condition node.
getParent() returns: SearchConditionNode
throws: (none)
Returns the parent search condition node. Returns null if it is the root search condition node.
setParent(
SearchConditionNodeWithChildren parent)
returns: (none)
throws: MinerException
Sets the parent node to this node. If this node already has a parent, this node will be removed from the current parent.

interface com.ibm.takmi.ext.search.SearchConditionNodeWithChildren
(super interface of AndSearchConditionNode, OrSearchConditionNode)
API 戻り 説明
setChild(SearchConditionNode node) returns: (none)
throws: MinerException
Add the specified node to the list of child nodes.
insertChildAt(int index,
SearchConditionNode node)
returns: (none)
throws: MinerException
Insert the specified node at the specified index of the child node list.
removeChild(SearchConditionNode node) returns: SearchConditionNode
throws: (none)
Remove the specified node from the list of child nodes, and return the removed node (null if not found).
size() returns: int
throws: (none)
Returns the number of child nodes.
getChildren() returns: SearchConditionNode
throws: (none)
Returns the array of child nodes.

SearchConditionNodeFactory インスタンスは、TextMiner#getSearchConditionNodeFactory()を呼び出して取得します。SearchConditionNodeFactory#newKeywordNode() はキーワード・ノードを返し、
SearchConditionNodeFactory#newCategoryNode() はカテゴリー・ノードを返します。どちらのノードも SearchConditionNode インターフェースを実装しています。複数の検索条件ノードは、 AndSearchConditionNode、または、OrSearchConditionNode クラスのsetChild()機能を呼び出して結合することができます。これらのインスタンスは、SearchConditionNodeFactory#newAndNode() 、または、 SearchConditionNodeFactory#newOrNode()を使って作成します。各検索条件ノードの否定形は、 SearchConditionNode#setNot() の引数に “true”を指定して呼び出すことにより作成できます。.
これらの機能は、MinerException (com.ibm.takmi.ext.MinerException)を投げる可能性があるので、ユーザーは、例外処理を適切に行う必要があります。MinerExceptionは、ICA User APIによって使用される共通の例外です。

2.3.2 サンプル・コード

TextMinerのユーティリティ機能を使用した検索条件の作成例
import com.ibm.takmi.ext.TextMiner;
import com.ibm.takmi.ext.search.SearchConditionNodeFactory;
import com.ibm.takmi.ext.search.SearchConditionNode;
import com.ibm.takmi.ext.search.SearchQuery;
:
(snip)
:
try {
  // As for initialization of TextMiner, please refer to the “Database API” chapter.
  TextMiner miner = …;

  // As for getting Category instance, please refer to “Category API” chapter
   Category category1 = …;
  Category category2 = …;

  //Get search query and set the search condition tree
  SearchQuery searchQuery = miner.newSearchQuery();

  //Create a search condition incrementally
  // keyword “PC” ( isAnd (3rd arg) is ignored in case of the first condition)
  miner.addKeywordCondition(query, “PC”, true, false);

  // keyword ”PC” AND NOT(keyword “display”) (isNot (4th arg) indicates a negation)
   miner.addKeywordCondition(query, category1 “display”, true, true);

  // category2 OR (“PC” and NOT(“display”))
  miner.addCategoryCondition(query, category2, false, false);

  // string “help” OR category2 OR (“PC” and NOT(“display”))
   miner.addStringCondition(query, “help”, false, false); // string “help” OR category2 OR

} catch (MinerException e) {
  // Do exception handling here
}

SearchConditionNodeFactoryを使用した検索条件の作成 例
import com.ibm.takmi.ext.TextMiner;
import com.ibm.takmi.ext.search.SearchConditionNodeFactory;
import com.ibm.takmi.ext.search.SearchConditionNode;
import com.ibm.takmi.ext.search.SearchQuery;
:
(snip)
:
try {
  // As for initialization of TextMiner, please refer to the “Database API” chapter.
  TextMiner miner = …;

  // As for getting Category instance, please refer to “Category API” chapter
  Category category1 = …;
  Category category2 = …;

  // Get SearchConditionNodeFactory
  SearchConditionNodeFactory nodeFactory = miner.getSearchConditionNodeFactory();

  // Create a keyword condition node
  SearchConditionNode keywordNode1 = nodeFactory.newKeywordNode( “PC”);
  SearchConditionNode keywordNode2 = nodeFactory.newKeywordNode(category1, “display”);

  // Create negation of the original condition
  keywordNode2.setNot(true);

  // Create a category condition node
  SearchConditionNode categoryNode = nodeFactory.newCategoryNode(category2);

  // Create a string condition node
  SearchConditionNode stringNode = nodeFactory.newStringNode(“PC”);

  // Compose a search condition tree
  AndSearchConditionNode andNode = nodeFactory.newAndNode();
  andNode.setChild(keywordNode1);
  andNode.setChild(keywordNode2);

  OrSearchConditionNode orNode = nodeFactory.newOrNode();
  orNode.setChild(andNode);
  orNode.setChild(categoryNode);
  orNode.setChild(stringNode);

  //Get search query and set the search condition tree
  SearchQuery searchQuery = miner.newSearchQuery();
  query.setSearchConditionNode(orNode);

} catch (MinerException e) {
  // Do exception handling here
}

2.4 マイニング API
ICA User API は、7つのマイニング機能を提供します。各マイニング機能は、MiningFunctionのサブクラスであり、2つの引数がある execute() メソッドを持ちます。引数の1つは、MiningFunctionInputsのサブクラスである入力パラメータで、もう1つの引数は、MiningFunctionOutputsのサブクラスである出力パラメータです。マイニング機能の実行手順は次の通りです。
  1. MiningFunction サブクラスのインスタンスを作成する
  2. 必要となる入力パラメータを与えて、MiningFunctionInputs サブクラスのインスタンスを作成する
  3. MiningFunctionOutputs サブクラスのインスタンスを作成する
  4. MiningFunction#execute(MiningFunctionInputs, MiningFunctionOutputs)を呼び出す
上記手順を実行すると、MiningFunctionOutputs サブクラスのインスタンスにマイニング機能の結果が入れられます。次節から、7つのマイニング機能をそれぞれ説明します。

2.4.1 TopViewFunction
TopViewFunction は、検索条件(SearchQuery のインスタンス)に合致する文書数を返す簡潔なマイニング機能です。

2.4.1.1 入力パラメータ
TopViewFunction の入力パラメータは、TopViewInputs のインスタンスに入れる必要があります。
TopViewInputsの持つフィールドは次の通りです。
名前 説明
searchQuery Search condition to narrow down the target document set. com.ibm.takmi.ext.search.SearchQuery
Available Constructors:
  • TopViewInputs()
  • TopViewInputs(SearchQuery searchQuery)

2.4.1.2 出力パラメータ
TopViewFunction の出力パラメータは、TopViewOutputs のインスタンスに保持されます。 TopViewOutputs の持つフィールドは次の通りです。
名前 説明
searchQuery The search query with the frequency being set in each search condition node. com.ibm.takmi.ext.search.SearchQuery
size The number of documents that meets the SearchQuery.
If the searchQuery in the input parameter is a null value, this value is 0.
(Getter: TopViewOutputs#getSize())
int

2.4.1.3 サンプル・コード
TopViewFunctionの実行方法例
import com.ibm.takmi.ext.TextMiner;
import com.ibm.takmi.ext.search.SearchQuery;
import com.ibm.takmi.ext.topview.TopViewFunction;
import com.ibm.takmi.ext.topview.TopViewInputs;
import com.ibm.takmi.ext.topview.TopViewOutputs;
import com.ibm.takmi.ext.search.SearchConditionNode;
import com.ibm.takmi.ext.search.SearchConditionNodeWithChildren;
:
(snip)
:
try {
  // As for initialization of TextMiner, please refer to the “Database API” chapter.
  TextMiner miner = …;

  // As for getting and filling SearchQuery instance, please refer to “Search API” chapter
  SearchQuery searchQuery = …;

  //Create instances of mining function, input and output
  TopViewFunction tvFunction = new TopVIewFunction(miner);
  TopViewInputs tvInputs = new TopViewInputs(searchQuery);
  TopViewOutputs tvOutputs = new TopViewOutputs();

  //Execute the mining function
  tvFunction.execute(tvInputs, tvOutputs);

  //Get the result from output instance
  int size = tvOutputs.getSize();

  //Print the frequencies of search condition node recursively
  SearchConditionNode node = out.getSearchQuery().getSearchConditionNode();
  printFreqs(node);

  } catch (MinerException e) {
    // Do exception handling here
  }
:
(snip)
:
// Recursive function to print the frequencies of search condition node tree.
private void printFreqs(SearchConditionNode node){
  // Print the frequency of current node
  System.out.print(node.getFrequency());

  // Check if the current node has children
  if (node instanceof SearchConditionNodeWithChildren) {
    // Get array of child SearchConditionNode
    SearchConditionNode children[] = ((SearchConditionNodeWithChildren)node).getChildren();
    System.out.print(" [ ");

    // Call printFreqs for each child
    for (int i=0; i<children.length; i++) {
      printFreqs(children[i]);
      System.out.print(" ");
    }
    System.out.print("]");
  }
}


2.4.2 DocListViewFunction
DocListViewFunction は、文書の配列を提供します。文書は、文書IDやタイトル、featureなどの情報を保持しています。

2.4.2.1 入力パラメータ
DocListViewFunction の入力ラメータは、DocListViewInputs のインスタンスに入れる必要があります。
DocListViewInputsの持つフィールドは次の通りです。
名前 説明
searchQuery
(optional)
Search condition to narrow down the target document set. If null is specified then the target is a set of all documents in the database. com.ibm.takmi.ext.search.SearchQuery
fromIndex The start index in the document set (starting from 0). When you set fromIndex=5, the output Document array starts with a Document that corresponds to the sixth document in the document set. int
pageSize The size of Document array to get. If the range specified by fromIndex and pageSize runs over the whole document set, then the result is trimmed. int
Available Constructors:
  • DocListViewInputs(int fromIndex, int pageSize)
  • DocListViewInputs(SearchQuery searchQuery, int fromIndex, int pageSize)

2.4.2.2 出力パラメータ
DocListViewFunction の出力パラメータは、DocListViewOutputs のインスタンスに保持されます。
DocListViewOutputs
の持つフィールドは次の通りです。
名前 説明
documents The array of Document objects.
(Getter: DocListViewOutputs#getDocuments())
com.ibm.takmi.ext.Document
searchQuery The search query with the frequency being set in each search condition node. com.ibm.takmi.ext.search.SearchQuery
size The number of documents that meets the SearchQuery.
(Getter: DocListViewOutputs#getSize())
int

2.4.2.3 文書
Document のインスタンスは、検索された文書に関する情報を保持します。Document のフィールドは次の通りです。
Name Description Type
documentID The array of Document objects. Getter: Document#getDocumentID() String
title The title of the document.Getter: Document#getTitle() String
input The original text of the input document.
Getter: Document#getInput()
String
standardFeature
Elements
The array of standard feature elements.
Getter: Document#getStandardFeatureElements()
com.ibm.takmi.ext.StandardFeatureElement[]
keywordFeature
Elements
The array of keyword feature elements.
Getter: Document#getKeywordFeatureElements()
com.ibm.takmi.ext.KeywordFeatureElement[]

2.4.2.4 StandardFeatureElement と KeywordFeatureElement
StandardFeatureElementKeywordFeatureElement は、文書に付与されたアノテーションを保持します。StandardFeatureElement は、ICAの事前処理よりも前に存在しているアノテーションを保持します。 KeywordFeatureElement は、ICAの事前処理の間に与えられたアノテーションを保持します。
2つのクラスのフィールドは次の通りです。
com.ibm.takmi.ext.StandardFeatureElement
名前 説明
category The category path of the feature element.Getter: getCategory() com.ibm.takmi.ext.Category
value The value of the feature element.Getter: getValue() String

com.ibm.takmi.ext.KeywordFeatureElement
名前 説明
category The category path of the feature element.Getter: getCategory() com.ibm.takmi.ext.Category
value The value of the feature element.Getter: getValue() String
begin The start index of the keyword occurrence. The index starts from 0.
Getter: getBegin()
int
end The end index of the keyword occurrence. The character at the end index is not contained by the occurrence.
Getter: getEnd()
int

2.4.2.5 サンプル・コード
DocListViewFunctionの実行方法例
import com.ibm.takmi.ext.TextMiner;
import com.ibm.takmi.ext.Document;
import com.ibm.takmi.ext.search.SearchQuery;
import com.ibm.takmi.ext.doclistview.DocListViewFunction;
import com.ibm.takmi.ext.doclistview.DocListViewInputs;
import com.ibm.takmi.ext.doclistview.DocListViewOutputs;
:
(snip)
:
try {
  // As for initialization of TextMiner, please refer to the “Database API” chapter.
  TextMiner miner = …;

  // As for getting and filling SearchQuery instance, please refer to “Search API” chapter
  SearchQuery searchQuery = …;

  //Create instances of mining function, input and output
  DocListViewFunction dlvFunction = new DocListVIewFunction(miner);
  DocListViewInputs dlvInputs = new DocListViewInputs(searchQuery, 10, 20);
  DocListViewOutputs dlvOutputs = new DocListViewOutputs();

  //Execute the mining function
  dlvFunction.execute(dlvInputs, dlvOutputs);

  //Get Documents from output instance
  Document documents[] = dlvOutputs.getDocuments();

  //Loop thru the Document array
  for (int i=0; i<docs.length; i++) {
    //Print fields
    System.out.println("[Document ID: " + docs[i].getDocumentID() + "]");
    System.out.println("Title: " + docs[i].getTitle());
    System.out.println("Input: " + docs[i].getInput());

    //Print standard feature elements
    StandardFeatureElement sfe[] = docs[i].getStandardFeatureElements();
    for (int j=0; j<sfe.length; j++) {
      System.out.println("Category: " + sfe[j].getCategory().getName() + ", Value: " + sfe[j].getValue());
    };

    // Print keyword feature elements
    KeywordFeatureElement kfe[] = docs[i].getKeywordFeatureElements();
    for (int j=0; j<kfe.length; j++) {
      System.out.println("Category: " + kfe[j].getCategory().getName() + ", Keyword: " + kfe[j].getKeyword()
          + " [" + kfe[j].getBegin() + "-" + kfe[j].getEnd() + "]");
    }
  }
} catch (MinerException e) {
  // Do exception handling here
}


2.4.3 CategoryViewFunction
CategoryViewFunction は、対象となる文書集合にあるカテゴリーに対するキーワード、またはサブカテゴリーの分布を返します。

2.4.3.1 入力パラメータ
CategoryViewFunction の入力パラメータは、CategoryViewInputs のインンスタンスに入れる必要があります。CategoryViewInputsの持つフィールドは次の通りです。
名前 説明
searchQuery
(optional)
Search condition to narrow down the target document set. If null is specified then the target is a set of all documents in the database. com.ibm.takmi.ext.search.SearchQuery
category The target category for keywords or subcategries. This must not be a null value. com.ibm.takmi.ext.Category
subcategoryFlag If true, CategoryViewFunction will return the distribution of subcategories for a target category. Otherwise, it will return that of keywords. boolean
sort The type of sort. Below are the valid values.
  • CategoryViewInputs.SORT_FREQ (by frequency)
  • CategoryViewInputs.SORT_CORR (by correlation)
  • CategoryViewInputs.SORT_ALPHA (alphabetical order)
String
maxLinesToDisplay The maximum number of keywords or subcategories in the result. Must be a positive number. int
Available Constructors:
  • CategoryViewInputs(Category category, boolean subcategoryFlag, String sort, int maxLinesToDisplay)
  • CategoryViewInputs(SearchQuery searchQuery, Category category, boolean subcategoryFlag, String sort, int maxLinesToDisplay)

2.4.3.2 出力パラメータ
CategoryViewFunction の出力パラメータは、CategoryViewOutputs のインスタンスに保持されます。CategoryViewOutputsの持つフィールドは次の通りです。
名前 説明
categories An array of subcategories. Valid only when subcategoryFlag in the input parameter is true, and a null value when it is false.
(Getter: CategoryViewOutputs#getCategories())
com.ibm.takmi.ext.Category[]
keywords An array of subcategories. Valid only when subcategoryFlag in the input parameter is true, and a null value when it is false.
(Getter: CategoryViewOutputs#getCategories())
String[]
freqs An array of frequencies in the document set.
(Getter: CategoryViewOutputs#getFreqs())
int[]
corrs An array of correlation values.
(Getter: CategoryViewOutputs#getCorrs())
double[]
searchQuery The search query with the frequency being set in each search condition node. com.ibm.takmi.ext.search.SearchQuery
size The number of documents that meets the SearchQuery.
(Getter: CategoryViewOutputs#getSize())
int

2.4.3.3 サンプル・コード
CategoryViewFunctionの実行方法例
import com.ibm.takmi.ext.TextMiner;
import com.ibm.takmi.ext.Document;
import com.ibm.takmi.ext.Category;
import com.ibm.takmi.ext.search.SearchQuery;
import com.ibm.takmi.ext.categoryview.CategorytViewFunction;
import com.ibm.takmi.ext.categoryview.CategoryViewInputs;
import com.ibm.takmi.ext.categoryview.CategoryViewOutputs;
:
(snip)
:
try {
  // As for initialization of TextMiner, please refer to the “Database API” chapter.
  TextMiner miner = …;

  // As for getting and filling SearchQuery instance, please refer to “Search API” chapter
  SearchQuery searchQuery = …;

  // As for getting category, please refer to “Category API” chapter
  Category category = …;

  //Create instances of mining function, input and output
  CategoryViewFunction cvFunction = new CategoryVIewFunction(miner);
  CategoryViewInputs cvInputs =
  new CategoryViewInputs(searchQuery, category, true, CategoryViewInputs.SORT_FREQ, 10);
  CategoryViewOutputs cvOutputs = new CategoryViewOutputs();

  //Execute the mining function
  cvFunction.execute(cvInputs, cvOutputs);

  //Get results from output instance
  String categories[] = cvOutputs.getCategories();
  int freqs[] = cvOutputs.getFreqs();
  int corrs[] = cvOutputs.getCorrs();

} catch (MinerException e) {
  // Do exception handling here
}


2.4.4 TimeSeriesViewFunction
TimeSeriesViewFunction は、毎年、あるいは毎日といったそれぞれの期間における文書の出現頻度を返します。

2.4.4.1 入力パラメータ
TimeSeriesViewFunction の入力パラメータは、TimeSeriesViewInputs のインスタンスに入れる必要があります。TimeSeriesViewInputsの持つフィールドは次の通りです。
名前 説明
searchQuery
(optional)
Search condition to narrow down the target document set. If null is specified then the target is a set of all documents in the database. com.ibm.takmi.ext.search.SearchQuery
timeScale The time scale to group documents. Below are the valid values.
  • TimeSeriesViewInputs.TIME_YEAR
  • TimeSeriesViewInputs.TIME_HALF (half year)
  • TimeSeriesViewInputs.TIME_QUARTER (quarter year)
  • TimeSeriesViewInputs.TIME_MONTH
  • TimeSeriesViewInputs.TIME_WEEK
  • TimeSeriesViewInputs.TIME_DATE
  • TimeSeriesViewInputs.TIME_DAY_OF_WEEK
  • TimeSeriesViewInputs.TIME_DAY_OF_MONTH
String
sort The type of sort. Below are the valid values.
  • TimeSeriesViewInputs.SORT_ASC (ascending)
  • TimeSeriesViewInputs.SORT_DESC (descending)
String
Available Constructors:
  • TimeSeriesViewInputs(String timeScale, String sort)
  • TimeSeriesViewInputs(SearchQuery searchQuery, String timeScale, String sort)

2.4.4.2 出力パラメータ
TimeSeriesViewFunction の出力パラメータは、TimeSeriesViewOutputs のインスタンスに保持されます。TimeSeriesViewOutputsの持つフィールドは次の通りです。
名前 説明
timeScale The time scale used in the calculation.
(Getter: TimeSeriesViewOutputs#getTimeScale())
String
timeValues An array of time values. The format of time values depend on the timeScale in the input parameters. For detail, see “2.4.4.3 Time Values” section
(Getter: TimeSeriesViewOutputs#getTimeValues())
int[]
freqs An array of frequencies in the time values.
(Getter: TimeSeriesViewOutputs#getFreqs())
int[]
searchQuery The search query with the frequency being set in each search condition node. com.ibm.takmi.ext.search.SearchQuery
size The number of documents that meets the SearchQuery.
(Getter: TimeSeriesViewOutputs#getSize())
int

2.4.4.3 時間値(Time Values)
The 出力パラメータ内の時間値のフォーマットは、入力パラメータに指定されたタイム・スケールの値に依存します。各タイム・スケールに対応する時間値のフォーマットは次の通りです。
タイム・スケール 値フォーマット 補足
TYPE_YEAR YYYY 2006 -> 2006
TYPE_HALF YYYYH 1H of 2006 -> 20061 H = 1 or 2
TYPE_QUARTER YYYYQ 2Q of 2006 -> 20062 Q = 1. 2. 3 or 4
TYPE_MONTH YYYYMM May, 2006 -> 200605
TYPE_WEEK YYYYWW 20th week of 2006 -> 200620
TYPE_DATE YYYYMMDD May 4, 2006 -> 20060504
TYPE_DAYOFWEEK number Sunday -> 1 From 1 up to 7, 1 for Sunday and 7 for for Saturday
TYPE_DAYOFMONTH number 4th -> 4, 31th -> 31 From 1 up to 31

2.4.4.4 サンプル・コード
TimeSeriesViewFunctionの実行方法例
import com.ibm.takmi.ext.TextMiner;
import com.ibm.takmi.ext.Document;
import com.ibm.takmi.ext.search.SearchQuery;
import com.ibm.takmi.ext.timeseriesview.TimeSeriesViewFunction;
import com.ibm.takmi.ext.timeseriesview.TimeSeriesViewInputs;
import com.ibm.takmi.ext.timeseriesview.TimeSeriesViewOutputs;
:
(snip)
:
try {
  // As for initialization of TextMiner, please refer to the “Database API” chapter.
  TextMiner miner = …;

  // As for getting and filling SearchQuery instance, please refer to “Search API” chapter
  SearchQuery searchQuery = …;

  //Create instances of mining function, input and output
  TimeSeriesViewFunction tsvFunction = new TimeSeriesVIewFunction(miner);
  TimeSeriesViewInputs tsvInputs = new TimeSeriesViewInputs(
  searchQuery, TimeSeriesViewInputs.TYPE_DATE, TimeSeriesViewInputs.SORT_ASC);
  TimeSeriesViewOutputs tsvOutputs = new TimeSeriesViewOutputs();

  //Execute the mining function
  tsvFunction.execute(tsvInputs, tsvOutputs);

  //Get results from output instance
  String timeValues[] = tsvOutputs.getTimeValues();
  Int freqs[] = tsvOutputs.getFreqs();
   ….
} catch (MinerException e) {
  // Do exception handling here
}


2.4.5 TopicViewFunction
TopicViewFunction は、1回で多くの期間に対するCategoryViewFunctionとして動作します。 各期間に対して、TopicViewFunction は、キーワード、またはサブカテゴリーの頻度を返します。トピックの指標は、ある一定の期間において、キーワード、またはサブカテゴリーがどの程度傑出した傾向があるかを示しています。

2.4.5.1 入力パラメータ
TopicViewFunction の入力パラメータは、TopicViewInputs のインスタンスに入れる必要があります。TopicViewInputsの持つフィールドは次の通りです。
名前 説明
searchQuery
(optional)
Search condition to narrow down the target document set. If null is specified then the target is a set of all documents in the database. com.ibm.takmi.ext.search.SearchQuery
timeScale The time scale to group documents. Below are the valid values.
  • TopicViewInputs.TIME_YEAR
  • TopicViewInputs.TIME_HALF (half year)
  • TopicViewInputs.TIME_QUARTER (quarter year)
  • TopicViewInputs.TIME_MONTH
  • TopicViewInputs.TIME_WEEK
  • TopicViewInputs.TIME_DATE
  • TopicViewInputs.TIME_DAY_OF_WEEK
  • TopicViewInputs.TIME_DAY_OF_MONTH
String
category The target category for keywords or subcategories. This must not be a null value. com.ibm.takmi.ext.Category
subcategoryFlag If true, TopicViewFunction will return the distribution of subcategories for a target category. Otherwise, it will return that of keywords. boolean
sort The type of sort. Below are the valid values.
  • TopicViewInputs.SORT_FREQ (by frequency)
  • TopicViewInputs.SORT_ALPHA (alphabetical order)
String
maxLinesToDisplay The maximum number of keywords or subcategories in the result. Must be a positive number. int
Available Constructors:
  • TopicViewInputs(String timeScale, Category category, boolean subcategoryFlag, String sort, int maxLinesToDisplay)
  • TopicViewInputs(SearchQuery searchQuery, String timeScale, Category category, boolean subcategoryFlag, String sort, int maxLinesToDisplay)

2.4.5.2 出力パラメータ
TopicViewFunction の出力パラメータは、TopicViewOutputs のインスタンスに保持されます。TopicViewOutputsの持つフィールドは次の通りです。
Name Description Type
verticalCategory The target category for keywords or subcategories.
(Getter: TopicViewOutputs#getVerticalCategory())
com.ibm.takmi.ext.Category
subcategories An array of subcategories. Valid only when subcategoryFlag in the input parameter is true, and a null value when it is false.
(Getter: TopicViewOutputs#getSubcategories())
com.ibm.takmi.ext.Category[]
keywords An array of keywords. Valid only when subcategoryFlag in the input parameter is false, and a null value when it is true.
(Getter: TopicViewOutputs#getKeywords())
String[]
verticalFreqs An array of frequencies for keywords or subcategories. (Getter: (Getter: TopicViewOutputs #getVerticalFreqs()) int[]
timeValues An array of time values. The format of time values depend on the timeScale in the input parameters. For detail, see “2.4.4.3 Time Values” section
(Getter: TopicViewOutputs#getTimeValues())
int[]
timeScale The time scale used in the calculation.
(Getter: TopicViewOutputs#getTimeScale())
String
timeFreqs An array of frequencies for the time values.
(Getter: TopicViewOutputs#getTimeFreqs())
int[]
freqMatrix A matrix in which every element represents the frequency of a keyword in a certain period of time.
(Getter: TopicViewOutputs#getFreqMatrix())
int[][]
topicIndicatorMatrix A matrix in which every element represents the topic indicator value for a subcategory/keyword and a certain period of time.
(Getter: TopicViewOutputs#getTopicIndicatorMatrix())
float[][]
searchQuery The search query with the frequency being set in each search condition node. com.ibm.takmi.ext.search.SearchQuery
size The number of documents that meets the SearchQuery.
(Getter: TopicViewOutputs#getSize())
int

2.4.5.3 サンプル・コード
TopicViewFunctionの実行方法例
import com.ibm.takmi.ext.TextMiner;
import com.ibm.takmi.ext.Document;
import com.ibm.takmi.ext.search.SearchQuery;
import com.ibm.takmi.ext.topicview.TopicViewFunction;
import com.ibm.takmi.ext.topicview.TopicViewInputs;
import com.ibm.takmi.ext.topicview.TopicViewOutputs;
:
(snip)
:
try {
  // As for initialization of TextMiner, please refer to the “Database API” chapter.
  TextMiner miner = …;

  // As for getting and filling SearchQuery instance, please refer to “Search API” chapter
  SearchQuery searchQuery = …;

  // As for getting category, please refer to “Category API” chapter
  Category category = …;

  //Create instances of mining function, input and output
  TopicViewFunction tvFunction = new TopicVIewFunction(miner);
  TopicViewInputs tvInputs = new TopicViewInputs(
  searchQuery, TopicViewInputs.TYPE_DAYOFWEEK, category, true, TopicViewInputs.SORT_ALPHA, 10);
  TopicViewOutputs tvOutputs = new TopicViewOutputs();

  //Execute the mining function
  tvFunction.execute(tvInputs, tvOutputs);

  //Get results from output instance
  String categories[] = tvOutputs.getSubcategories();
  int timevalues[] = tvOutputs.getTimeValues();
  int freqs[][] = tvOutputs.getFreqMatrix();
  float topicInd[][] = tvOutputs.getTopicIndicatorMatrix();
  …
} catch (MinerException e) {
  // Do exception handling here
}


2.4.6 DeltaViewFunction
DeltaViewFunction は、各キーワード、またはサブカテゴリーの出現頻度を返します。アラートの指標は、時間経過に伴う変化の観点から、ある一定の期間において、キーワード、またはサブカテゴリーがどの程度傑出した傾向があるかを示しています。

2.4.6.1 入力パラメータ
DeltaViewFunction の入力パラメータは、DeltaViewInputsのインスタンスに入れる必要があります。DeltaViewInputsの持つフィールドは次の通りです。
名前 説明
searchQuery
(optional)
Search condition to narrow down the target document set. If null is specified then the target is a set of all documents in the database. com.ibm.takmi.ext.search.SearchQuery
timeScale The time scale to group documents. Below are the valid values.
  • DeltaViewInputs.TIME_YEAR
  • DeltaViewInputs.TIME_MONTH
  • DeltaViewInputs.TIME_WEEK
  • DeltaViewInputs.TIME_DATE
String
category The target category for keywords or subcategories. This must not be a null value. com.ibm.takmi.ext.Category
subcategoryFlag If true, DeltaViewFunction will return the distribution of subcategories for a target category. Otherwise, it will return that of keywords. boolean
sort The type of sort. Below are the valid values.
  • DeltaViewInputs.SORT_FREQ (by frequency)
  • DeltaViewInputs.SORT_ALPHA (alphabetical order)
  • DeltaViewInputs.SORT_ALERT (by alert indication)
String
sortPivotTime The pivot time value for sorting alert indicator. This value is neglected either when the sort mode is not SORT_ALERT or when the given value does not exist in the time values. int
maxLinesToDisplay The maximum number of keywords or subcategories in the result. Must be a positive number. int
Available Constructors:
  • DeltaViewInputs(String timeScale, Category category, boolean subcategoryFlag, String sort, int sortPivotTIme, int maxLinesToDisplay)
  • DeltaViewInputs(SearchQuery searchQuery, String timeScale, Category category, boolean subcategoryFlag, String sort, int sortPivotTIme, int maxLinesToDisplay)

2.4.6.2 出力パラメータ
DeltaViewFunction の出力パラメータは、DeltaViewOutputsのインスタンスに保持されます。DeltaViewOutputsの持つフィールドは次の通りです。
名前 説明
verticalCategory The target category for keywords or subcategories.
(Getter: DeltaViewOutputs#getVerticalCategory())
com.ibm.takmi.ext.Category
subcategories An array of subcategories. Valid only when subcategoryFlag in the input parameter is true, and a null value when it is false.
(Getter: DeltaViewOutputs#getSubcategories())
com.ibm.takmi.ext.Category[]
keywords An array of keywords. Valid only when subcategoryFlag in the input parameter is false, and a null value when it is true.
(Getter: DeltaViewOutputs#getKeywords())
String[]
verticalFreqs An array of frequencies for keywords or subcategories.
(Getter: DeltaViewOutputs #getVerticalFreqs())
int[]
timeValues An array of time values. The format of time values depend on the timeScale in the input parameters. For detail, see “2.4.4.3 Time Values” section
(Getter: DeltaViewOutputs#getTimeValues())
int[]
timeScale The time scale used in the calculation.
(Getter: DeltaViewOutputs#getTimeScale())
String
timeFreqs An array of frequencies for the time values.
(Getter: DeltaViewOutputs#getTimeFreqs())
int[]
freqMatrix A matrix in which every element represents the frequency of a keyword in a certain period of time.
(Getter: DeltaViewOutputs#getFreqMatrix())
int[][]
alertIndicatorMatrix A matrix in which every element represents the alert indicator value for a subcategory/keyword and a certain period of time.
(Getter: DeltaViewOutputs#getAlertIndicatorMatrix())
float[][]
searchQuery The search query with the frequency being set in each search condition node. com.ibm.takmi.ext.search.SearchQuery
size The number of documents that meets the SearchQuery.
(Getter: DeltaViewOutputs#getSize())
int

2.4.6.3 サンプル・コード
DeltaViewFunctionの実行方法例
import com.ibm.takmi.ext.TextMiner;
import com.ibm.takmi.ext.Document;
import com.ibm.takmi.ext.search.SearchQuery;
import com.ibm.takmi.ext.deltaview.DeltaViewFunction;
import com.ibm.takmi.ext.deltaview.DeltaViewInputs;
import com.ibm.takmi.ext.deltaview.DeltaViewOutputs;
:
(snip)
:
try {
  // As for initialization of TextMiner, please refer to the “Database API” chapter.
  TextMiner miner = …;

  // As for getting and filling SearchQuery instance, please refer to “Search API” chapter
  SearchQuery searchQuery = …;

  // As for getting category, please refer to “Category API” chapter
  Category category = …;

  //Create instances of mining function, input and output
  DeltaViewFunction dvFunction = new DeltaVIewFunction(miner);
  DeltaViewInputs dvInputs = new DeltaViewInputs(
  searchQuery, DeltaViewInputs.TYPE_WEEK, category, true, DeltaViewInputs.SORT_ALERT, 200601, 10);
  DeltaViewOutputs dvOutputs = new DeltaViewOutputs();

  //Execute the mining function
  dvFunction.execute(dvInputs, dvOutputs);

  //Get results from output instance
  String categories[] = dvOutputs.getSubcategories();
  int timevalues[] = dvOutputs.getTimeValues();
  int freqs[][] = dvOutputs.getFreqMatrix();
  float alertIndicatorMatrix[][] = dvOutputs.getAlertIndicatorMatrix();
  …
} catch (MinerException e) {
  // Do exception handling here
}


2.4.7 TwoDMapViewFunction
TwoDMapViewFunction は、縦方向カテゴリーに属するキーワード/サブカテゴリと横方向カテゴリーに属するキーワード/サブカテゴリの相関関係を示すテーブルを返します。

2.4.7.1 入力パラメータ
TwoDMapViewFunction の入力パラメータは、TwoDMapViewInputs のインスタンスに入れる必要があります。TwoDMapViewInputsの持つフィールドは次の通りです。
名前 説明
searchQuery
(optional)
Search condition to narrow down the target document set. If null is specified then the target is a set of all documents in the database. com.ibm.takmi.ext.search.SearchQuery
verticalCategory The vertical target category for keywords or subcategories. This must not be a null value. com.ibm.takmi.ext.Category
verticalSubcategory
Flag
If true, TwoDMapViewFunction will return a list of subcategories of the vertical target category. Otherwise, it will return that of keywords. boolean
verticalSort The type of vertical sort. Below are the valid values.
  • DeltaViewInputs.SORT_FREQ (by frequency)
  • DeltaViewInputs.SORT_ALPHA (alphabetical order)
String
verticalMaxLines
ToDisplay
The maximum number of vertical keywords or subcategories in the result. Must be a positive number. int
horizontalCategory The horizontal target category for keywords or subcategories. This must not be a null value. com.ibm.takmi.ext.Category
horizontalSubcategory
Flag
If true, TwoDMapViewFunction will return a list of subcategories of the horizontal target category. Otherwise, it will return that of keywords. boolean
horizontalSort The type of horizontal sort. Below are the valid values.
  • DeltaViewInputs.SORT_FREQ (by frequency)
  • DeltaViewInputs.SORT_ALPHA (alphabetical order)
String
horizontalMaxLines
ToDisplay
The maximum number of horizontal keywords or subcategories in the result. Must be a positive number. int
Available Constructors:
  • TwoDMapViewInputs(Category verticalCategory, boolean verticalSubcategoryFlag, String verticalSort, int verticalMaxLinesToDisplay, Category horizontalCategory, boolean horizontalSubcategoryFlag, String horizontalSort, int horizontalMaxLinesToDisplay)
  • TwoDMapViewInputs(SearchQuery searchQuery, Category verticalCategory, boolean verticalSubcategoryFlag, String verticalSort, int verticalMaxLinesToDisplay, Category horizontalCategory, boolean horizontalSubcategoryFlag, String horizontalSort, int horizontalMaxLinesToDisplay)

2.4.7.2 出力パラメータ
TwoDMapViewFunction の出力パラメータは、TwoDMapViewOutputs のインスタンスに保持されます。TwoDMapViewOutputsの持つフィールドは次の通りです。
名前 説明
verticalSubcategories An array of vertical subcategories. Valid only when verticalSubcategoryFlag in the input parameter is true, and a null value when it is false.
(Getter: TwoDMapViewOutputs#getVerticalSubcategories())
com.ibm.takmi.ext.Category[]
verticalKeywords An array of vertical keywords. Valid only when verticalSubcategoryFlag in the input parameter is false, and a null value when it is true.
(Getter: TwoDMapViewOutputs#getVerticalKeywords())
String[]
verticalFreqs An array of frequencies for vertical keywords/subcategories. (Getter: TwoDMapViewOutputs #getVerticalFreqs()) int[]
horizontalSubcategories An array of horizontal subcategories. Valid only when horizontalSubcategoryFlag in the input parameter is true, and a null value when it is false.
(Getter: TwoDMapViewOutputs#getHorizontalSubcategories())
com.ibm.takmi.ext.Category[]
horizontalKeywords An array of horizontal keywords. Valid only when horizontalSubcategoryFlag in the input parameter is false, and a null value when it is true.
(Getter: TwoDMapViewOutputs#getHorizontalKeywords())
String[]
horizontalFreqs An array of frequencies for horizontal keywords/subcategories. (Getter: TwoDMapViewOutputs #getHorizontalFreqs()) int[]
freqMatrix A matrix in which every element represents the frequency of a pair of a vertical keyword/subcategory and a horizontal keyword/subcategory.
(Getter: TwoDMapViewOutputs#getFreqMatrix())
int[][]
corrMatrix A matrix in which every element represents the correlation value of a pair of vertical keyword/subcategory and a horizontal keyword/subcategory.
(Getter: TwoDMapViewOutputs#getAlertIndicatorMatrix())
float[][]
searchQuery The search query with the frequency being set in each search condition node. com.ibm.takmi.ext.search.SearchQuery
size The number of documents that meets the SearchQuery.
(Getter: TwoDMapViewOutputs#getSize())
int

2.4.7.3 サンプル・コード
TwoDMapViewFunctionの実行方法例
import com.ibm.takmi.ext.TextMiner;
import com.ibm.takmi.ext.Document;
import com.ibm.takmi.ext.search.SearchQuery;
import com.ibm.takmi.ext.twodmapview.TwoDMapViewFunction;
import com.ibm.takmi.ext.twodmapview.TwoDMapViewInputs;
import com.ibm.takmi.ext.twodmapview.TwoDMapViewOutputs;
:
(snip)
:
try {
  // As for initialization of TextMiner, please refer to the “Database API” chapter.
  TextMiner miner = …;

  // As for getting and filling SearchQuery instance, please refer to “Search API” chapter
   SearchQuery searchQuery = …;

  // As for getting category, please refer to “Category API” chapter
  Category verticalCategory = …;
  Category horizontalCategory = …;

  //Create instances of mining function, input and output
  TwoDMapViewFunction tdmvFunction = new TwoDMapVIewFunction(miner);
  TwoDMapViewInputs tdmvInputs = new TwoDMapViewInputs(searchQuery,
  verticalCategory, true, TwoDMapViewInputs.SORT_FREQ, 10,
  horizontalCategory, false, TwoDMapViewInputs.SORT_ALPHA, 20);
  TwoDMapViewOutputs tdmvOutputs = new TwoDMapViewOutputs();

  //Execute the mining function
  tdmvFunction.execute(tdmvInputs, tdmvOutputs);

  //Get results from output instance
   Category verticalSubcategories[] = tdmvOutputs.getVerticalSubcategories();
  String horizontalKeywords[] = tdmvOutputs.getHorizontalKeywords();
  int freqMatrix[][] = tdmvOutputs.getFreqMatrix();
  float corrMatrix[][] = tdmvOutputs.getCorrMatrix();
   …
} catch (MinerException e) {
  // Do exception handling here
}

4 付録
商標

ここでは、IBM の商標と、特定のIBM 以外の商標をリストします。 IBM の商標について詳しくは、http://www.ibm.com/legal/copytrade.shtml を参照して下さい。 以下は、それぞれ各社の商標または登録商標です。

Java およびすべてのJava 関連の商標およびロゴは、Sun Microsystems, Inc. の米国およびその他の国における商標または登録商標です。 Microsoft、Windows、Windows NT およびWindows ロゴは、Microsoft Corporationの米国およびその他の国における商標です。 Intel、Intel Inside (ロゴ)、およびPentium は、Intel Corporation の米国およびその他の国における商標です。 UNIX は、The Open Group の米国およびその他の国における登録商標です。 Linux は、Linus Torvalds の米国およびその他の国における商標です。 他の会社名、製品名およびサービス名等はそれぞれ各社の商標です。

©Copyright IBM Corp. 2007. All Rights Reserved.

特記事項

本書でIBM 製品、プログラム、またはサービスに言及していても、そのIBM 製品、プログラム、またはサービスのみが使用可能であることを意味するものではありません。 これらに代えて、IBM の知的所有権を侵害することのない、機能的に同等の製品、プログラム、またはサービスを使用することができます。 ただし、IBM 以外の製品とプログラムの操作またはサービスの評価および検証は、お客様の責任で行っていただきます。

IBM は、本書に記載されている内容に関して特許権(特許出願中のものを含む) を保有している場合があります。 本書の提供は、お客様にこれらの特許権について実施権を許諾することを意味するものではありません。

この情報には、技術的に不適切な記述や誤植を含む場合があります。本書は定期的に見直され、必要な変更は本書の次版に組み込まれます。 IBM は予告なしに、随時、この文書に記載されている製品またはプログラムに対して、改良または変更を行うことがあります。

本書においてIBM 以外のWeb サイトに言及している場合がありますが、便宜のため記載しただけであり、決してそれらのWeb サイトを推奨するものではありません。 それらのWeb サイトにある資料は、このIBM 製品の資料の一部ではありません。それらのWeb サイトは、お客様の責任でご使用ください。

IBM は、お客様が提供するいかなる情報も、お客様に対してなんら義務も負うことのない、自ら適切と信ずる方法で、使用もしくは配布することができるものとします。

本プログラムに関する上記の情報は、適切な使用条件の下で使用することができますが、有償の場合もあります。 本書で説明されているライセンス・プログラムまたはその他のライセンス資料は、IBM所定のプログラム契約の契約条項、IBM プログラムのご使用条件、またはそれと同等の条項に基づいて、IBM より提供されます。

この文書に含まれるいかなるパフォーマンス・データも、管理環境下で決定されたものです。そのため、他のオペレーティング環境で得られた結果は、異なる可能性があります。 一部の測定が、開発レベルのシステムで行われた可能性がありますが、その測定値が、一般に利用可能なシステムのものと同じである保証はありません。 さらに、一部の測定値が、推定値である可能性があります。実際の結果は、異なる可能性があります。お客様は、お客様の特定の環境に適したデータを確かめる必要があります。

IBM 以外の製品に関する情報は、その製品の供給者、出版物、もしくはその他の公に利用可能なソースから入手したものです。 IBM は、それらの製品のテストは行っておりません。したがって、他社製品に関する実行性、互換性、またはその他の要求については確証できません。 IBM 以外の製品の性能に関する質問は、それらの製品の供給者にお願いします。 IBM の将来の方向または意向に関する記述については、予告なしに変更または撤回される場合があり、単に目標を示しているものです。

本書には、日常の業務処理で用いられるデータの例が含まれています。より具体性を与えるために、それらの例には、個人、企業、ブランド、あるいは製品などの名前が含まれている場合があります。 これらの名称はすべて架空のものであり、名称や住所が類似する企業が実在しているとしても、それは偶然にすぎません。