チュートリアルで試せる内容

1)作成する処理モジュールの仕様を決めます

2)雛形のSample1.java を利用して,モジュール作成の準備をします

3)NounTop10.java を編集し,プログラム作成の準備をします

コンストラクタの記述の修正

	public NounTop10()
	{
		setModuleID(9911);						// Set your module ID after you have got it
		pairingVisualizationID = new int[]{1,4};
	}

4)一度コンパイルして,NounTop10モジュールの動作を確認します

5)プログラムの作成に使える入力情報を確認します

6)名詞の頻度上位10個を求めるプログラムを作成します

	String top10Words[];
	int top10frequency[];

void MyMethod()内に作成する場合

	void MyMethod()
	{	
		int nounID[] = new int[text.keywordNumber];
		int frequency[] = new int[text.keywordNumber];
		int count;
		
		count = 0;
		for(int i=0;i<text.keywordNumber;i++)
			if(text.keyword[i].partOfSpeech == 1)
			{
				frequency[i] = text.keyword[i].frequency;
				count++;
			}
			else
				frequency[i] = 0;
		
		Qsort.initializeIndex(nounID, text.keywordNumber);
		Qsort.quicksort(frequency, nounID, text.keywordNumber);
		if(count > 10)
			count = 10;
	
		top10Words = new String[count];
		top10frequency = new int[count];			
		
		for(int i=0;i<count;i++)
		{
			top10Words[i] = text.keyword[nounID[i]].word;
			top10frequency[i] = frequency[i];
		}
	}

7)出力を可視化モジュールに渡します

			case 0:
				MyMethod();
				setData(1,top10Words);
				setData(2,top10frequency);
				break;

8)コンパイルして動作を確認します


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS