計算の最後に、結果を出力します。
System.out.println("\nTree\t\tOdds of being by the sought author");
for (ParseTree pt : testTrees) {
conditionalProbs = reg.classify(pt.features());
System.out.printf("%s\t\t%f", pt.toString(), conditionalProbs[1]);
System.out.println();
}
これにより、たとえば次のようになります。
Tree Odds of being by the sought author
K and Burstner 0.000000
how is babby formed answer 0.005170
Mary is in heat 0.999988
Prelim 1.000000
そこに 2 つ入れるのはちょっと\t
不器用です。列が実際には整列していません。次のような出力が必要です。
Tree Odds of being by the sought author
K and Burstner 0.000000
how is babby formed answer 0.005170
Mary is in heat 0.999988
Prelim 1.000000
(注: SO テキスト エディターでこれらの列を完全に整列させるのに問題がありますが、うまくいけば、アイデアが得られることを願っています。)
これを行う簡単な方法はありますか、または「ツリー」列の文字列の長さに基づいてそれを把握しようとする方法を作成する必要がありますか?