QNLP
v1.0
|
#include <corpus_utils.hpp>
Public Types | |
typedef std::unordered_map< std::string, std::unordered_map< std::string, unsigned int > > | NTB |
typedef std::unordered_map< std::string, std::unordered_map< unsigned int, std::string > > | BTN |
Public Member Functions | |
CorpusUtils () | |
Construct a new Load Corpus object. Database name taken from the macro/compiler defined value. More... | |
CorpusUtils (const std::string filename) | |
Construct a new Load Corpus object. Database name given explicitly. More... | |
~CorpusUtils () | |
NTB & | getNameToBin () |
Get the NTB object. This is a map of maps, wherein the first key represents the grammatical type to load. The second key accesses the name to binary string mapping data, wherein each unique entity has a mapping to a unique binary string, which will representation it's encoding in the quantum state-space. More... | |
BTN & | getBinToName () |
Get the BTN object. This is a map of maps, wherein the first key represents the grammatical type to load. The second key accesses binary mapping data, wherein each unique entity has a mapping to a unique string entity. This allows for determining a result upon measurement of the quantum state-space back to a specific meaning eneity. More... | |
void | loadData (const std::string data_type, const std::string table="corpus") |
Loads from the database for a given data type (noun, verb, etc) More... | |
DBHelper & | getDBHelper () |
Return reference to database object. More... | |
void | printData (const std::string type, const std::string table) |
Print the data with given type. More... | |
const std::string | get_database_filename () |
Get the database filename object. More... | |
void | clearData () |
Clear all loaded data. More... | |
Private Attributes | |
NTB | name_to_bin |
BTN | bin_to_name |
DBHelper | db_helper |
std::string | database_filename |
Definition at line 19 of file corpus_utils.hpp.
typedef std::unordered_map<std::string, std::unordered_map<unsigned int, std::string> > QNLP::CorpusUtils::BTN |
Definition at line 36 of file corpus_utils.hpp.
typedef std::unordered_map<std::string, std::unordered_map<std::string, unsigned int> > QNLP::CorpusUtils::NTB |
Definition at line 35 of file corpus_utils.hpp.
CorpusUtils::CorpusUtils | ( | ) |
Construct a new Load Corpus object. Database name taken from the macro/compiler defined value.
Definition at line 15 of file corpus_utils.cpp.
CorpusUtils::CorpusUtils | ( | const std::string | filename | ) |
Construct a new Load Corpus object. Database name given explicitly.
filename | Database filename |
Definition at line 19 of file corpus_utils.cpp.
CorpusUtils::~CorpusUtils | ( | ) |
Definition at line 22 of file corpus_utils.cpp.
References clearData().
void CorpusUtils::clearData | ( | ) |
Clear all loaded data.
Definition at line 70 of file corpus_utils.cpp.
References bin_to_name, and name_to_bin.
Referenced by ~CorpusUtils().
const std::string CorpusUtils::get_database_filename | ( | ) |
Get the database filename object.
Definition at line 66 of file corpus_utils.cpp.
References database_filename.
Referenced by TEST_CASE().
CorpusUtils::BTN & CorpusUtils::getBinToName | ( | ) |
Get the BTN object. This is a map of maps, wherein the first key represents the grammatical type to load. The second key accesses binary mapping data, wherein each unique entity has a mapping to a unique string entity. This allows for determining a result upon measurement of the quantum state-space back to a specific meaning eneity.
Definition at line 30 of file corpus_utils.cpp.
References bin_to_name.
Referenced by TEST_CASE().
DBHelper & CorpusUtils::getDBHelper | ( | ) |
Return reference to database object.
Definition at line 75 of file corpus_utils.cpp.
References db_helper.
Referenced by loadData(), and TEST_CASE().
CorpusUtils::NTB & CorpusUtils::getNameToBin | ( | ) |
Get the NTB object. This is a map of maps, wherein the first key represents the grammatical type to load. The second key accesses the name to binary string mapping data, wherein each unique entity has a mapping to a unique binary string, which will representation it's encoding in the quantum state-space.
Definition at line 26 of file corpus_utils.cpp.
References name_to_bin.
Referenced by TEST_CASE().
void CorpusUtils::loadData | ( | const std::string | data_type, |
const std::string | table = "corpus" |
||
) |
Loads from the database for a given data type (noun, verb, etc)
data_type | String of the data type to load |
table | Database table to load data from |
Definition at line 34 of file corpus_utils.cpp.
References bin_to_name, database_filename, db_helper, getDBHelper(), name_to_bin, QNLP::DBHelper::openDB(), and SQL_RETURN_CHECK.
Referenced by printData(), and TEST_CASE().
void CorpusUtils::printData | ( | const std::string | type, |
const std::string | table = "corpus" |
||
) |
Print the data with given type.
type | Grammatical type |
table | Database table to print data from |
Definition at line 57 of file corpus_utils.cpp.
References loadData(), and name_to_bin.
|
private |
Definition at line 90 of file corpus_utils.hpp.
Referenced by clearData(), getBinToName(), and loadData().
|
private |
Definition at line 94 of file corpus_utils.hpp.
Referenced by get_database_filename(), and loadData().
|
private |
Definition at line 93 of file corpus_utils.hpp.
Referenced by getDBHelper(), and loadData().
|
private |
Definition at line 89 of file corpus_utils.hpp.
Referenced by clearData(), getNameToBin(), loadData(), and printData().