Mahout0.6-VectorDumper bug修復

VectorDumper類的功能是從SequenceFile中按照鍵值對的方式讀取信息並將其轉化爲文本形式,具體使用見第五部分1.1.2節第3)條。若是不對源碼進行修改使用時存在兩個bug,如今只對bug1作修復,bug1修復後就能夠知足使用需求了,bug2會在後續工做中修復。ui

bug1:spa

用$MAHOUT0P6_HOME/bin/mahout vectordump –h查看vectordump參數,發現有兩個-n參數,爲了不混淆,將代碼修改以下:ip

第一步修改:源碼

改前:it

OptionnamesAsCommentsOpt =obuilder.withLongName("namesAsComments").withRequired(false).withDescription(io

            "If using CSV output,optionally add a comment line for each NamedVector (if the vector is one)printing out the name")csv

            .withShortName("n").create();bug

改後:sort

Option namesAsCommentsOpt = obuilder.withLongName("namesAsComments").withRequired(false).withDescription(filter

            "If using CSV output, optionally add a comment linefor each NamedVector (if the vector is one) printing out the name")

            .withShortName("ac").create();

第二步修改:

當結果第一步修改,能夠使用-c和-ac組合參數讀取結果,可是會報錯,顯示沒有參數ac,緣由是0.6版中丟失了一段代碼,修改前源碼和修還後的源碼爲

修改前:

Group group = gbuilder.withName("Options").withOption(seqOpt).withOption(outputOpt)

                          .withOption(dictTypeOpt).withOption(dictOpt).withOption(csvOpt).withOption(vectorAsKeyOpt).withOption(printKeyOpt).withOption(sortVectorsOpt).withOption(filtersOpt).withOption(helpOpt).withOption(numItemsOpt)

                         .withOption(sizeOpt).withOption(numIndexesPerVectorOpt).create();

修改後:

Group group = gbuilder.withName("Options").withOption(seqOpt).withOption(outputOpt)

                         .withOption(dictTypeOpt).withOption(dictOpt).withOption(csvOpt).withOption(namesAsCommentsOpt)

                         .withOption(vectorAsKeyOpt).withOption(printKeyOpt).withOption(sortVectorsOpt)

                         .withOption(filtersOpt).withOption(helpOpt).withOption(numItemsOpt)

                         .withOption(sizeOpt).withOption(numIndexesPerVectorOpt).create();

 

bug2

但不適用-c參數時會報錯,待修復

相關文章
相關標籤/搜索