full tests
Former-commit-id: b6d1e4521fb9fba7170ab5a77ade5ec3c71b8f4b
This commit is contained in:
parent
13e3cd9e33
commit
76bb26f45f
@ -9,7 +9,7 @@
|
|||||||
#include "concordia/common/utils.hpp"
|
#include "concordia/common/utils.hpp"
|
||||||
#include "build/libdivsufsort/include/divsufsort.h"
|
#include "build/libdivsufsort/include/divsufsort.h"
|
||||||
|
|
||||||
#define READ_BUFFER_LENGTH 1000
|
#define READ_BUFFER_LENGTH 10000
|
||||||
|
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
@ -22,9 +22,9 @@ int main(int argc, char** argv) {
|
|||||||
"Concordia configuration file (required)")
|
"Concordia configuration file (required)")
|
||||||
("generate-index,g", "Generate suffix array based index out of "
|
("generate-index,g", "Generate suffix array based index out of "
|
||||||
"added sentences")
|
"added sentences")
|
||||||
("load-index,l", "Load the generated index for searching")
|
|
||||||
("simple-search,s", boost::program_options::value<std::string>(),
|
("simple-search,s", boost::program_options::value<std::string>(),
|
||||||
"Pattern to be searched in the index")
|
"Pattern to be searched in the index")
|
||||||
|
("silent,n", "While searching, do not output search results")
|
||||||
("read-file,r", boost::program_options::value<std::string>(),
|
("read-file,r", boost::program_options::value<std::string>(),
|
||||||
"File to be read and added to index");
|
"File to be read and added to index");
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ int main(int argc, char** argv) {
|
|||||||
boost::posix_time::time_duration msdiff = time_end - time_start;
|
boost::posix_time::time_duration msdiff = time_end - time_start;
|
||||||
std::cout << "\tIndex generated in: " <<
|
std::cout << "\tIndex generated in: " <<
|
||||||
msdiff.total_milliseconds() << "ms." << std::endl;
|
msdiff.total_milliseconds() << "ms." << std::endl;
|
||||||
} else if (cli.count("load-index")) {
|
} else if (cli.count("simple-search")) {
|
||||||
std::cout << "\tLoading index..." << std::endl;
|
std::cout << "\tLoading index..." << std::endl;
|
||||||
boost::posix_time::ptime time_start =
|
boost::posix_time::ptime time_start =
|
||||||
boost::posix_time::microsec_clock::local_time();
|
boost::posix_time::microsec_clock::local_time();
|
||||||
@ -71,10 +71,24 @@ int main(int argc, char** argv) {
|
|||||||
boost::posix_time::time_duration msdiff = time_end - time_start;
|
boost::posix_time::time_duration msdiff = time_end - time_start;
|
||||||
std::cout << "\tIndex loaded in: " <<
|
std::cout << "\tIndex loaded in: " <<
|
||||||
msdiff.total_milliseconds() << "ms." << std::endl;
|
msdiff.total_milliseconds() << "ms." << std::endl;
|
||||||
} else if (cli.count("simple-search")) {
|
|
||||||
std::string pattern = cli["simple-search"].as<std::string>();
|
std::string pattern = cli["simple-search"].as<std::string>();
|
||||||
std::cout << "\tSearching for pattern: \"" << pattern <<
|
std::cout << "\tSearching for pattern: \"" << pattern <<
|
||||||
"\"" << std::endl;
|
"\"" << std::endl;
|
||||||
|
time_start = boost::posix_time::microsec_clock::local_time();
|
||||||
|
vector<saidx_t> result = concordia.simpleSearch(pattern);
|
||||||
|
time_end = boost::posix_time::microsec_clock::local_time();
|
||||||
|
msdiff = time_end - time_start;
|
||||||
|
std::cout << "\tFound: " << result.size() << " matches. "
|
||||||
|
<< "Search took: " <<
|
||||||
|
msdiff.total_milliseconds() << "ms." << std::endl;
|
||||||
|
if (!cli.count("silent")) {
|
||||||
|
for (vector<saidx_t>::iterator it = result.begin();
|
||||||
|
it != result.end(); ++it) {
|
||||||
|
std::cout << "\t\tfound match on word number: " << *it
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (cli.count("read-file")) {
|
} else if (cli.count("read-file")) {
|
||||||
std::string filePath = cli["read-file"].as<std::string>();
|
std::string filePath = cli["read-file"].as<std::string>();
|
||||||
std::cout << "\tReading sentences from file: " << filePath <<
|
std::cout << "\tReading sentences from file: " << filePath <<
|
||||||
|
9
concordia-runner-large.sh
Executable file
9
concordia-runner-large.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Running Concordia"
|
||||||
|
|
||||||
|
rm prod/resources/temp/*
|
||||||
|
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -r prod/resources/text-files/large.txt
|
||||||
|
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -g
|
||||||
|
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -s "drawn from his own" -n
|
||||||
|
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -s "it is" -n
|
@ -5,6 +5,5 @@ echo "Running Concordia"
|
|||||||
rm prod/resources/temp/*
|
rm prod/resources/temp/*
|
||||||
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -r prod/resources/text-files/medium.txt
|
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -r prod/resources/text-files/medium.txt
|
||||||
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -g
|
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -g
|
||||||
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -l
|
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -s "drawn from his own"
|
||||||
#./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -s "Ala ma chyba kota"
|
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg -s "it is" -n
|
||||||
|
|
||||||
|
1
prod/resources/text-files/large.txt.REMOVED.git-id
Normal file
1
prod/resources/text-files/large.txt.REMOVED.git-id
Normal file
@ -0,0 +1 @@
|
|||||||
|
8f5abeba4f43e795e84bbdef654dd76d92b4a448
|
Loading…
Reference in New Issue
Block a user