hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
main.cpp
Go to the documentation of this file.
1 //#include <ProcessInfo.hpp>
2 #include <Refine.hpp>
3 #include <CWords.hpp>
4 #include <OutDataRefine.hpp>
5 
6 #include <string>
7 #include <vector>
8 #include <iostream>
9 #include <streambuf>
10 #include <Poco/String.h>
11 #include <Poco/StringTokenizer.h>
12 
23 int main()
24 {
25  std::string content(std::istreambuf_iterator<char>(std::cin), std::istreambuf_iterator<char>());
27  Poco::SharedPtr<HCE::DataBase> inData(new HCE::InDataRefine(HCE::CT_REFINE, 0, 0, content));
28 
32  std::vector<std::string> custom_delimiters = {"w"};
33  inData.cast<HCE::InDataRefine>()->setDelimiters(custom_delimiters);
34 
38  std::vector<HCE::component::ProcessInfo> processInfoTable;
39  HCE::component::ProcessInfo processInfo;
41  processInfoTable.push_back(processInfo);
42  inData.cast<HCE::InDataRefine>()->setProcessInfoTable(processInfoTable);
43 
44  Poco::SharedPtr<HCE::DataBase> outData = refine.process(inData);
45  std::vector<HCE::CWords> cWords = outData.cast<HCE::OutDataRefine>()->getCWords();
46  std::cout << "Content: \"" << content << "\" splitted by custom delimiters: \"" << custom_delimiters[0] << "\"" << std::endl;
47  for_each( cWords.begin(), cWords.end(), [](HCE::CWords val) { std::cout << val.getOriginWord() << std::endl;} );
48 
52  std::vector<std::string> default_delimiters;
53  inData.cast<HCE::InDataRefine>()->setDelimiters(default_delimiters);
54  outData = refine.process(inData);
55  cWords = outData.cast<HCE::OutDataRefine>()->getCWords();
56  std::cout << "Content: \"" << content << "\" splitted by defaultdelimiters:" << std::endl;
57  for_each( cWords.begin(), cWords.end(), [](HCE::CWords val) { std::cout << val.getOriginWord() << std::endl;} );
58  return EXIT_SUCCESS;
59 }
60