本文整理汇总了C++中PBowDocBs::SaveTxtStat方法的典型用法代码示例。如果您正苦于以下问题:C++ PBowDocBs::SaveTxtStat方法的具体用法?C++ PBowDocBs::SaveTxtStat怎么用?C++ PBowDocBs::SaveTxtStat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBowDocBs
的用法示例。
在下文中一共展示了PBowDocBs::SaveTxtStat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// bag-of-words to create
PBowDocBs BowDocBs;
// load input data
if (!InFPath.Empty()){ // directory-files
// prepare stop-words
PSwSet SwSet=TSwSet::GetSwSet(SwSetTypeNm);
if (!SwSetFNm.Empty()) { SwSet->LoadFromFile(SwSetFNm); }
// prepare stemmer
PStemmer Stemmer=TStemmer::GetStemmer(StemmerTypeNm);
// load bow
BowDocBs=TBowFl::LoadHtmlTxt(InFPath, RecurseDirP, Recs,
SwSet, Stemmer, MxNGramLen, MnNGramFq, SaveDocP);
} else
if (!InMtxFNm.Empty()){ // matrix-file
PBowSimMtx BowSimMtx=TBowSimMtx::LoadTxt(InMtxFNm);
BowDocBs=TBowFl::LoadFromSimMtx(BowSimMtx);
} else
if (!InTabFNm.Empty()){ // tab-file
BowDocBs=TBowFl::LoadTabTxt(InTabFNm, Recs);
} else
if (!InTsactFNm.Empty()){ // transaction-file
BowDocBs=TBowFl::LoadTsactTxt(InTsactFNm, Recs);
} else
if (!InSparseFNm.Empty()){ // sparse-file
TStr DocDefFNm=TStr::PutFExt(InSparseFNm, ".tup");
TStr WordDefFNm=TStr::PutFExt(InSparseFNm, ".var");
TStr TrainDataFNm=InSparseFNm;
BowDocBs=TBowFl::LoadSparseTxt(DocDefFNm, WordDefFNm, TrainDataFNm, Recs);
} else
if (!InSvmLightFNm.Empty()){ // SvmLight-file
TStr DocDefFNm=TStr::PutFExt(InSparseFNm, ".tup");
TStr WordDefFNm=TStr::PutFExt(InSparseFNm, ".var");
TStr TrainDataFNm=InSvmLightFNm;
BowDocBs=TBowFl::LoadSvmLightTxt(DocDefFNm, WordDefFNm, TrainDataFNm, "", Recs);
} else
if (!InTBsFNm.Empty()){ // Text-Base-file
//BowDocBs=TBowFl::LoadTBsTxt(InTBsFNm, Recs);
} else
if (!InCpdFNm.Empty()){ // Compact-Doc-file
BowDocBs=TBowFl::LoadCpdTxt(InCpdFNm, Recs,
SwSetTypeNm, StemmerTypeNm, MxNGramLen, MnNGramFq);
} else
if (!InLnDocFNm.Empty()){ // Line-Documents-file
BowDocBs=TBowFl::LoadLnDocTxt(InLnDocFNm, false, Recs,
SwSetTypeNm, StemmerTypeNm, MxNGramLen, MnNGramFq, SaveDocP);
} else
if (!InNmLnDocFNm.Empty()){ // Named-Line-Documents-file
BowDocBs=TBowFl::LoadLnDocTxt(InNmLnDocFNm, true, Recs,
SwSetTypeNm, StemmerTypeNm, MxNGramLen, MnNGramFq, SaveDocP);
} else
if (!InReuters21578FPath.Empty()){ // Reuters-21578-file
BowDocBs=TBowFl::LoadReuters21578Txt(InReuters21578FPath, Recs,
SwSetTypeNm, StemmerTypeNm, MxNGramLen, MnNGramFq);
} else
if (!InCiaWFBFPath.Empty()){ // CIA-World-Fact-Book
BowDocBs=TBowFl::LoadCiaWFBTxt(InCiaWFBFPath, Recs,
SwSetTypeNm, StemmerTypeNm, MxNGramLen, MnNGramFq);
} else
if (!InDaxFNm.Empty()) { // DocumentAtlasXml-File
PSwSet SwSet=TSwSet::GetSwSet(SwSetTypeNm);
PStemmer Stemmer=TStemmer::GetStemmer(StemmerTypeNm);
BowDocBs=TVizMapXmlDocBs::LoadBowDocBs(InDaxFNm,
SwSet, Stemmer, MxNGramLen, MnNGramFq);
} else {
TExcept::Throw("No Input-File specified!");
}
// save bow-file
if (!OutBowFNm.Empty()){
TStr::PutFExtIfEmpty(OutBowFNm, ".Bow");
printf("Saving Bow to '%s' ...", OutBowFNm.CStr());
BowDocBs->SaveBin(OutBowFNm);
printf(" Done.\n");
}
// save statistics
if ((OutStatP)&&(!OutBowFNm.Empty())){
// save bow-statistics
TStr OutBowStatFNm=TStr::PutFExt(OutBowFNm, ".Bow.Txt");
TStr::PutFExt(OutBowStatFNm, ".Bow.Txt");
if (!OutBowStatFNm.Empty()){
printf("Saving Bow-Statistics to '%s' ...", OutBowStatFNm.CStr());
BowDocBs->SaveTxtStat(OutBowStatFNm);
printf(" Done.\n");
}
// save ngram-statistics
PNGramBs NGramBs=BowDocBs->GetNGramBs();
TStr OutNGramStatFNm=TStr::PutFExt(OutBowFNm, ".NGram.Txt");
if (!NGramBs.Empty()){
printf("Saving NGram-Statistics to '%s' ...", OutNGramStatFNm.CStr());
NGramBs->SaveTxt(OutNGramStatFNm, true);
printf(" Done.\n");
}
}
return 0;
Catch;
return 1;
}