FreeLing
3.1
|
Class to handle loading a config file for freeling module, with XML-like sections. More...
#include <configfile.h>
Public Member Functions | |
config_file (bool skip=false, const std::wstring &comment=L"##") | |
Class to handle loading a config file for freeling module, with XML-like sections. | |
~config_file () | |
void | add_section (const std::wstring &key, int section) |
bool | open (const std::wstring &fname) |
void | close () |
bool | get_content_line (std::wstring &line) |
int | get_section () const |
int | get_line_num () const |
bool | at_section_start () const |
Private Member Functions | |
bool | isopensection (const std::wstring &s) const |
bool | isclosesection (const std::wstring &s) const |
bool | iscomment (const std::wstring &s) const |
Private Attributes | |
std::map< std::wstring, int > | sectionsopen |
std::map< std::wstring, int > | sectionsclose |
std::wifstream | filestr |
int | section |
std::wstring | filename |
bool | section_start |
std::wstring | comment_prefix |
int | line_num |
bool | skip_unknown_sections |
std::wstring | unk_name |
Static Private Attributes | |
static const int | NONE = -1 |
static const int | UNKNOWN = -2 |
Class to handle loading a config file for freeling module, with XML-like sections.
freeling::config_file::config_file | ( | bool | skip = false , |
const std::wstring & | comment = L"##" |
||
) |
Class to handle loading a config file for freeling module, with XML-like sections.
----------------------------------------- Constructor
----------------------------------------- Destructor
void freeling::config_file::add_section | ( | const std::wstring & | key, |
int | section | ||
) |
----------------------------------------- add a section with corresponding open/close label
References sectionsclose, and sectionsopen.
Referenced by freeling::alternatives::alternatives(), freeling::bioner::bioner(), freeling::completer::completer(), freeling::depLabeler::depLabeler(), freeling::dictionary::dictionary(), freeling::hmm_tagger::hmm_tagger(), freeling::nec::nec(), freeling::ner::ner(), freeling::ner_module::ner_module(), freeling::np::np(), freeling::phonetics::phonetics(), freeling::probabilities::probabilities(), freeling::semanticDB::semanticDB(), freeling::senses::senses(), freeling::splitter::splitter(), freeling::tagset::tagset(), freeling::tokenizer::tokenizer(), and freeling::ukb::ukb().
bool freeling::config_file::at_section_start | ( | ) | const |
---------------------------------------- get whether current line is first in its section
References section_start.
Referenced by freeling::phonetics::phonetics().
void freeling::config_file::close | ( | ) |
----------------------------------------- close stream
References filestr.
Referenced by freeling::alternatives::alternatives(), freeling::bioner::bioner(), freeling::completer::completer(), freeling::depLabeler::depLabeler(), freeling::dictionary::dictionary(), freeling::hmm_tagger::hmm_tagger(), freeling::nec::nec(), freeling::ner::ner(), freeling::ner_module::ner_module(), freeling::np::np(), freeling::phonetics::phonetics(), freeling::probabilities::probabilities(), freeling::semanticDB::semanticDB(), freeling::senses::senses(), freeling::splitter::splitter(), freeling::tagset::tagset(), freeling::tokenizer::tokenizer(), and freeling::ukb::ukb().
bool freeling::config_file::get_content_line | ( | std::wstring & | line | ) |
----------------------------------------- process next line, handling section opening and closing. returns only content lines
References ERROR_CRASH, filename, filestr, isclosesection(), iscomment(), isopensection(), line_num, NONE, section, section_start, sectionsclose, sectionsopen, skip_unknown_sections, TRACE, unk_name, UNKNOWN, and WARNING.
Referenced by freeling::alternatives::alternatives(), freeling::bioner::bioner(), freeling::completer::completer(), freeling::depLabeler::depLabeler(), freeling::dictionary::dictionary(), freeling::hmm_tagger::hmm_tagger(), freeling::nec::nec(), freeling::ner::ner(), freeling::ner_module::ner_module(), freeling::np::np(), freeling::phonetics::phonetics(), freeling::probabilities::probabilities(), freeling::semanticDB::semanticDB(), freeling::senses::senses(), freeling::splitter::splitter(), freeling::tagset::tagset(), freeling::tokenizer::tokenizer(), and freeling::ukb::ukb().
int freeling::config_file::get_line_num | ( | ) | const |
---------------------------------------- get current line number
References line_num.
Referenced by freeling::completer::completer(), and freeling::depLabeler::depLabeler().
int freeling::config_file::get_section | ( | ) | const |
----------------------------------------- get current section
References section.
Referenced by freeling::alternatives::alternatives(), freeling::bioner::bioner(), freeling::completer::completer(), freeling::depLabeler::depLabeler(), freeling::dictionary::dictionary(), freeling::hmm_tagger::hmm_tagger(), freeling::nec::nec(), freeling::ner::ner(), freeling::ner_module::ner_module(), freeling::np::np(), freeling::phonetics::phonetics(), freeling::probabilities::probabilities(), freeling::semanticDB::semanticDB(), freeling::senses::senses(), freeling::splitter::splitter(), freeling::tagset::tagset(), freeling::tokenizer::tokenizer(), and freeling::ukb::ukb().
bool freeling::config_file::isclosesection | ( | const std::wstring & | s | ) | const [private] |
----------------------------------------- See if a line is a section closing
Referenced by get_content_line().
bool freeling::config_file::iscomment | ( | const std::wstring & | s | ) | const [private] |
----------------------------------------- See if a line is a comment
References comment_prefix.
Referenced by get_content_line().
bool freeling::config_file::isopensection | ( | const std::wstring & | s | ) | const [private] |
----------------------------------------- See if a line is a section opening
Referenced by get_content_line().
bool freeling::config_file::open | ( | const std::wstring & | fname | ) |
----------------------------------------- open config file
References filename, filestr, line_num, NONE, freeling::util::open_utf8_file(), section, and section_start.
Referenced by freeling::alternatives::alternatives(), freeling::bioner::bioner(), freeling::completer::completer(), freeling::depLabeler::depLabeler(), freeling::dictionary::dictionary(), freeling::hmm_tagger::hmm_tagger(), freeling::nec::nec(), freeling::ner::ner(), freeling::ner_module::ner_module(), freeling::np::np(), freeling::phonetics::phonetics(), freeling::probabilities::probabilities(), freeling::semanticDB::semanticDB(), freeling::senses::senses(), freeling::splitter::splitter(), freeling::tagset::tagset(), freeling::tokenizer::tokenizer(), and freeling::ukb::ukb().
std::wstring freeling::config_file::comment_prefix [private] |
Referenced by iscomment().
std::wstring freeling::config_file::filename [private] |
Referenced by get_content_line(), and open().
std::wifstream freeling::config_file::filestr [private] |
Referenced by close(), get_content_line(), and open().
int freeling::config_file::line_num [private] |
Referenced by get_content_line(), get_line_num(), and open().
const int freeling::config_file::NONE = -1 [static, private] |
Referenced by get_content_line(), and open().
int freeling::config_file::section [private] |
Referenced by get_content_line(), get_section(), and open().
bool freeling::config_file::section_start [private] |
Referenced by at_section_start(), get_content_line(), and open().
std::map<std::wstring,int> freeling::config_file::sectionsclose [private] |
Referenced by add_section(), and get_content_line().
std::map<std::wstring,int> freeling::config_file::sectionsopen [private] |
Referenced by add_section(), and get_content_line().
Referenced by get_content_line().
std::wstring freeling::config_file::unk_name [private] |
Referenced by get_content_line().
const int freeling::config_file::UNKNOWN = -2 [static, private] |
Referenced by get_content_line().