|
ModErn Text Analysis
META Enumerates Textual Applications
|
Contains unit testing functions for the META toolkit. More...
Classes | |
| struct | annotation_checker |
| struct | binary_checker |
| struct | file_guard |
| Always makes sure a new file is created. More... | |
| class | unit_test_exception |
| Exception class used to report errors in the unit test. More... | |
Functions | |
| template<class Analyzer > | |
| void | check_analyzer_expected (Analyzer &ana, corpus::document doc, uint64_t num_unique, uint64_t length) |
| int | content_tokenize () |
| Test tokenization on documents with content. More... | |
| int | file_tokenize () |
| Test tokenization on documents that read content from files. More... | |
| int | analyzer_tests () |
| Runs the analyzer tests. More... | |
| template<class Index , class Classifier > | |
| void | check_cv (Index &idx, Classifier &c, double min_accuracy) |
| Checks that the CV accuracy is above a threshold. More... | |
| template<class Index , class Classifier > | |
| void | check_split (Index &idx, Classifier &c, double min_accuracy) |
| Checks that the split accuracy is above a threshold. More... | |
| int | run_tests (const std::string &type) |
| Runs the classifier tests. More... | |
| int | classifier_tests () |
| Runs the classifier tests. More... | |
| int | compression_tests () |
| Tests compressed_file_reader and compressed_file_writer. | |
| int | filter_tests () |
| Tests filters. More... | |
| void | create_libsvm_config () |
| Creates a test-config.toml with the desired settings. | |
| template<class Index > | |
| void | check_bcancer_expected (Index &idx) |
| Asserts that the bcancer corpus was created correctly. More... | |
| template<class Index > | |
| void | check_ceeaus_expected_fwd (Index &idx) |
| Asserts that the bcancer corpus was created correctly. More... | |
| template<class Index > | |
| void | check_bcancer_doc_id (Index &idx) |
| Asserts that the ceeaus corpus was created correctly. More... | |
| template<class Index > | |
| void | check_ceeaus_doc_id (Index &idx) |
| Asserts that the ceeaus corpus was created correctly. More... | |
| void | ceeaus_forward_test () |
| Runs the ceeaus forward index tests. | |
| void | bcancer_forward_test () |
| Runs the bcancer forward index tests. | |
| int | forward_index_tests () |
| Runs all the forward_index tests. More... | |
| int | graph_tests () |
| Runs the undirected and directed graph tests. More... | |
| void | create_config (const std::string &corpus_type) |
| Creates test-config.toml with the desired settings. More... | |
| template<class Index > | |
| void | check_ceeaus_expected (Index &idx) |
| Checks that ceeaus index was built correctly. More... | |
| template<class Index > | |
| void | check_term_id (Index &idx) |
| Checks that the term info is consistent with the correct one. More... | |
| int | inverted_index_tests () |
| Runs the inverted index tests. More... | |
| int | ir_eval_tests () |
| Runs the IR evaluation tests. More... | |
| void | label () |
| Tests libsvm strings containing a class label. | |
| void | no_label () |
| Tests libsvm strings not containing a class label. | |
| void | bad_label () |
| Tests libsvm strings containing a bad class label. | |
| void | bad_counts () |
| Tests libsvm strings containing a bad count data. | |
| int | libsvm_parser_tests () |
| Runs all the libsvm parser tests. More... | |
| template<class Type > | |
| void | hard_func (Type &x) |
| template<class Type > | |
| void | easy_func (Type &x) |
| int | test_speed (std::vector< double > &v) |
| Assumes multi-core machine: tests speed; serial should be slower than parallel. More... | |
| int | test_correctness (std::vector< double > &v) |
| Checks that each thread touches each index exactly once. More... | |
| int | test_threadpool () |
| Tests the threadpool. More... | |
| int | parallel_tests () |
| Tests all the parallel functions. More... | |
| int | parser_tests () |
| Tests for parser functionality. More... | |
| template<class Ranker , class Index > | |
| void | test_rank (Ranker &r, Index &idx) |
| Queries an index with its own docs to ensure that the query is the first doc returned. More... | |
| int | ranker_tests () |
| Runs all the ranking tests. More... | |
| int | stemmer_tests () |
| Runs all the stemming tests. More... | |
| void | assert_read (std::ifstream &file, const std::string &expect) |
| int | string_list_tests () |
| Runs the string list tests. More... | |
| std::string | filename (const std::string &path) |
| template<class T , class K , class BinOp > | |
| std::string | assert_equal (const T &expected, const K &actual, const char *expstr, const char *actstr, BinOp &&binop) |
| Allows the user to see what the evaluated statements are. More... | |
| template<class T , class K > | |
| std::string | assert_equal (const T &expected, const K &actual, const char *expstr, const char *actstr) |
| template<class T , class K > | |
| std::string | assert_approx_equal (const T &expected, const K &actual, const char *expstr, const char *actstr) |
| template<class T , class K > | |
| std::string | assert_less (const T &expected, const K &actual, const char *expstr, const char *actstr) |
| template<class T , class K > | |
| std::string | assert_greater (const T &expected, const K &actual, const char *expstr, const char *actstr) |
| template<class Func > | |
| int | run_test (const std::string &test_name, Func &&func) |
| Runs a unit test in a semi-controlled environment. More... | |
| void | write_file (uint16_t size=20) |
| Writes a file to decode. More... | |
| void | assert_correctness (uint16_t size=20) |
| Makes sure the content in the vocab map is correct. More... | |
| void | read_file (uint16_t size=20) |
| Reads data from the vocab map file. More... | |
| int | vocabulary_map_tests () |
| Runs the vocab map tests. More... | |
| template<class Graph > | |
| void | check_sizes (const Graph &g, uint64_t num_nodes, uint64_t num_edges) |
| int | test_undirected () |
| int | test_directed () |
| int | test_betweenness () |
| void | missing_label () |
| parser::parse_tree | tree (std::string input) |
| void | assert_tree_equal (std::string input, std::string expected, parser::tree_transformer &trns) |
| int | transformer_tests () |
| int | head_finder_tests () |
| int | binarizer_tests () |
| int | debinarizer_tests () |
| template<class Ranker , class Index > | |
| void | test_rank (Ranker &r, Index &idx, const std::string &encoding) |
Contains unit testing functions for the META toolkit.
| void meta::testing::check_analyzer_expected | ( | Analyzer & | ana, |
| corpus::document | doc, | ||
| uint64_t | num_unique, | ||
| uint64_t | length | ||
| ) |
| ana | The anlyzer to use |
| doc | The document to analyze |
| num_unique | Number of unique terms |
| length | Number of terms |
| int meta::testing::content_tokenize | ( | ) |
Test tokenization on documents with content.
| int meta::testing::file_tokenize | ( | ) |
Test tokenization on documents that read content from files.
| int meta::testing::analyzer_tests | ( | ) |
Runs the analyzer tests.
| void meta::testing::check_cv | ( | Index & | idx, |
| Classifier & | c, | ||
| double | min_accuracy | ||
| ) |
Checks that the CV accuracy is above a threshold.
| idx | The index to run the classifier on |
| c | The classifier to test |
| min_accuracy | The mininum acceptable accuracy |
| void meta::testing::check_split | ( | Index & | idx, |
| Classifier & | c, | ||
| double | min_accuracy | ||
| ) |
Checks that the split accuracy is above a threshold.
| idx | The index to run the classifier on |
| c | The classifier to test |
| min_accuracy | The mininum acceptable accuracy |
| int meta::testing::run_tests | ( | const std::string & | type | ) |
Runs the classifier tests.
| type | The index type |
| int meta::testing::classifier_tests | ( | ) |
Runs the classifier tests.
| int meta::testing::filter_tests | ( | ) |
Tests filters.
| void meta::testing::check_bcancer_expected | ( | Index & | idx | ) |
Asserts that the bcancer corpus was created correctly.
| idx | The index to use |
| void meta::testing::check_ceeaus_expected_fwd | ( | Index & | idx | ) |
Asserts that the bcancer corpus was created correctly.
| idx | The index to use |
| void meta::testing::check_bcancer_doc_id | ( | Index & | idx | ) |
Asserts that the ceeaus corpus was created correctly.
| idx | The index to use |
| void meta::testing::check_ceeaus_doc_id | ( | Index & | idx | ) |
Asserts that the ceeaus corpus was created correctly.
| idx | The index to use |
| int meta::testing::forward_index_tests | ( | ) |
Runs all the forward_index tests.
| int meta::testing::graph_tests | ( | ) |
Runs the undirected and directed graph tests.
| void meta::testing::create_config | ( | const std::string & | corpus_type | ) |
Creates test-config.toml with the desired settings.
| corpus_type | line or file corpus |
| void meta::testing::check_ceeaus_expected | ( | Index & | idx | ) |
Checks that ceeaus index was built correctly.
| idx | The index to check |
| void meta::testing::check_term_id | ( | Index & | idx | ) |
Checks that the term info is consistent with the correct one.
| idx | The index to check |
| int meta::testing::inverted_index_tests | ( | ) |
Runs the inverted index tests.
| int meta::testing::ir_eval_tests | ( | ) |
Runs the IR evaluation tests.
| int meta::testing::libsvm_parser_tests | ( | ) |
Runs all the libsvm parser tests.
| int meta::testing::test_speed | ( | std::vector< double > & | v | ) |
Assumes multi-core machine: tests speed; serial should be slower than parallel.
Assumes multi-core machine...
| v | A vector of doubles to perform math ops on |
| int meta::testing::test_correctness | ( | std::vector< double > & | v | ) |
Checks that each thread touches each index exactly once.
| v | A vector of doubles to perform math ops on |
| int meta::testing::test_threadpool | ( | ) |
Tests the threadpool.
| int meta::testing::parallel_tests | ( | ) |
Tests all the parallel functions.
| int meta::testing::parser_tests | ( | ) |
Tests for parser functionality.
| void meta::testing::test_rank | ( | Ranker & | r, |
| Index & | idx | ||
| ) |
Queries an index with its own docs to ensure that the query is the first doc returned.
| r | The ranker to test |
| idx | The index to use |
| int meta::testing::ranker_tests | ( | ) |
Runs all the ranking tests.
| int meta::testing::stemmer_tests | ( | ) |
Runs all the stemming tests.
| void meta::testing::assert_read | ( | std::ifstream & | file, |
| const std::string & | expect | ||
| ) |
| file | The file to read from |
| expect | What we expect to read |
| int meta::testing::string_list_tests | ( | ) |
Runs the string list tests.
|
inline |
| path | The path to truncate |
|
inline |
Allows the user to see what the evaluated statements are.
| expected | The expected expression |
| actual | The actual expression |
| expstr | The expected string |
| actstr | The actual string |
| binop | The binary operator to compare the expressions; by default std::equal_to |
|
inline |
| expected | The expected expression |
| actual | The actual expression |
| expstr | The expected string |
| actstr | The actual string |
|
inline |
| expected | The expected expression |
| actual | The actual expression |
| expstr | The expected string |
| actstr | The actual string |
|
inline |
| expected | The expected expression |
| actual | The actual expression |
| expstr | The expected string |
| actstr | The actual string |
|
inline |
| expected | The expected expression |
| actual | The actual expression |
| expstr | The expected string |
| actstr | The actual string |
| int meta::testing::run_test | ( | const std::string & | test_name, |
| Func && | func | ||
| ) |
Runs a unit test in a semi-controlled environment.
| testName | The name to display when running this test |
| func | The function (unit test) to run. This function should take no parameters and return void. |
| void meta::testing::write_file | ( | uint16_t | size = 20 | ) |
Writes a file to decode.
| size | The number of bytes in the file |
| void meta::testing::assert_correctness | ( | uint16_t | size = 20 | ) |
Makes sure the content in the vocab map is correct.
| size | The number of bytes in the file |
| void meta::testing::read_file | ( | uint16_t | size = 20 | ) |
Reads data from the vocab map file.
| size | The number of bytes in the file |
| int meta::testing::vocabulary_map_tests | ( | ) |
Runs the vocab map tests.
1.8.9.1