我寫了一個簡單的程序來收集一些數據中有關bigrams的統計信息。 我將統計信息打印到自定義文件。Hadoop作業輸出中不需要的字符
Path file = new Path(context.getConfiguration().get("mapred.output.dir") + "/bigram.txt");
FSDataOutputStream out = file.getFileSystem(context.getConfiguration()).create(file);
我的代碼有下面幾行:
Text.writeString(out, "total number of unique bigrams: " + uniqBigramCount + "\n");
Text.writeString(out, "total number of bigrams: " + totalBigramCount + "\n");
Text.writeString(out, "number of bigrams that appear only once: " + onceBigramCount + "\n");
我獲得以下在vim/gedit中輸出:
'total number of unique bigrams: 424462
!total number of bigrams: 1578220
0number of bigrams that appear only once: 296139
除在行的開頭不想要的字符,也有一些非打印字符。這背後的原因是什麼?
你怎麼看呢? – 2012-07-25 05:18:20
@Thomas Jungblut:vim/gedit – abhinavkulkarni 2012-07-25 05:28:12
我相信這是導致一些二進制偏斜的字符串(寫在前面)的長度。 – 2012-07-25 07:14:15