2011年3月1日
摘要: 将文件从头至尾读入内存 ifstreamifile(infoFromWekaAddress);stringstreamss;ss<<ifile.rdbuf()<<endl;stringrawtext=ss.str();ifile.close(); 阅读全文
posted @ 2011-03-01 17:03 finallyly 阅读(764) 评论(0) 推荐(1) 编辑
摘要: 从wekaUI调用kmeans算法后,最后生成的的结果文件中,聚类中心向量表达的不够清晰。参照网上的做法,采用java code中调用weka中的kmeans算法。 这段代码在网络上转载颇多,一时找不到出处。代码如下:java code中调用kmeans聚类importjava.io.*;importweka.clusterers.SimpleKMeans;importweka.core.DistanceFunction;//importweka.core.EuclideanDistance;importweka.core.Instances;importweka.core.converter 阅读全文
posted @ 2011-03-01 16:56 finallyly 阅读(1975) 评论(0) 推荐(1) 编辑
摘要: vector<string>Preprocess::mySplit(strings,set<string>stopwords){vector<string>wordCollection;trim(s,"");intnPosBegin=0;intnPosEnd=s.find(',',nPosBegin);while(nPosEnd!=string::npos){stringtemp=s.substr(nPosBegin,nPosEnd-nPosBegin);trim(temp,"");if(temp!=& 阅读全文
posted @ 2011-03-01 09:47 finallyly 阅读(391) 评论(0) 推荐(1) 编辑