JavaでスタンフォードPOSタグを使用するプログラムを実装したばかりです。Stanford-taggerベースのプログラムのパフォーマンスを向上
数百ワードからなる数KBの入力ファイルを使用しました。ヒープサイズも600 MBに設定しました。
しかし、まだ遅く、ヒープメモリが不足することがあります。実行速度とメモリパフォーマンスをどのように高めることができますか?私は入力として数MBを使用できるようにしたいと思います。
public static void postag(String args) throws ClassNotFoundException
{
try
{
File filein=new File("c://input.txt");
String content = FileUtils.readFileToString(filein);
MaxentTagger tagger = new MaxentTagger("postagging/wsj-0-18-bidirectional-distsim.tagger");
String tagged = tagger.tagString(content);
try
{
File file = new File("c://output.txt");
if (!file.exists())
{
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write("\n"+tagged);
bw.close();
}
catch (IOException e)
{
e.printStackTrace();
}
} catch (IOException e1)
{
e1.printStackTrace();
}
}
ありがとうございました。 Left3wordsを使用します:) – Ameer