#include <concordia/concordia.hpp> #include <concordia/matched_pattern_fragment.hpp> #include <concordia/example.hpp> #include "config.hpp" #include <boost/shared_ptr.hpp> #include <vector> using namespace std; int main() { Concordia concordia("/tmp", EXAMPLES_DIR"/../tests/resources/concordia-config/concordia.cfg"); // adding sentences to index concordia.addExample(Example("Alice has a cat", 56)); concordia.addExample(Example("Alice has a dog", 23)); concordia.addExample(Example("New test product has a mistake", 321)); concordia.addExample(Example("This is just testing and it has nothing to do with the above", 14)); // generating index concordia.refreshSAfromRAM(); // searching cout << "Searching for pattern: has a" << endl; vector<MatchedPatternFragment> result = concordia.simpleSearch("has a"); // printing results for(vector<MatchedPatternFragment>::iterator it = result.begin(); it != result.end(); ++it) { cout << "Found substring in sentence: " << it->getExampleId() << " at offset: " << it->getExampleOffset() << endl; } // clearing index concordia.clearIndex(); }