32namespace LinguisticProcessing
34namespace MorphologicAnalysis
37#define NAMEINDEXRESSOURCE_CLASSID "NameIndex"
56void NameIndexResource::readNames(
const std::string& filepath ) {
58 std::ifstream names(filepath.data());
61 for(
int counter = 0 ; ; counter++ ) {
63 names.getline(strbuff, 200,
'\n' );
65 if( line.size() == 0 ) {
66 LDEBUG <<
"end of list of words. counter= " << counter;
72 int i=namels.indexOf(
'\t');
74 insert(std::pair<std::basic_string<wchar_t>,std::basic_string<wchar_t> >(
78 insert(std::pair<std::basic_string<wchar_t>,std::basic_string<wchar_t> >(
87 wchar_t warray[limastr.length()+1];
88 int warray_len = limastr.toWCharArray(warray);
90 return std::basic_string<wchar_t>(warray, warray_len);
109 if( stat(filepath.toUtf8().constData(),&sb) == 0)
111 readNames(filepath.toUtf8().constData());
116 LERROR <<
"resource file" << filepath <<
"not found";
121 LERROR <<
"no param 'filename' in NameIndex group for language " << (int) manager->getInitializationParameters().language;
130 <<
" no found for language "
131 << (int) manager->getInitializationParameters().language;
137 m_withIndex = (
withIndex.compare(
"true") == 0);
#define ANALYSISDICTLOGINIT
#define NAMEINDEXRESSOURCE_CLASSID
Defines a Factory to create Object of type Base.
Use this exception to signal the used of a wrongly initialized LIMA dictionary.
std::string & getParamsValueAtKey(const std::string &key)
return a message when a 'param' was not found
Use this exception to signal an error in one of the configuration files.
virtual void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
static std::basic_string< wchar_t > LimaStr2wcharStr(const QString &limastr)
virtual ~NameIndexResource()
static const MediaticData & single()
const singleton accessor
QString findFileInPaths(const QString &paths, const QString &fileName, const QChar &separator)
Find the given file in the given paths.
LimaString utf8stdstring2limastring(const std::string &src)
SimpleFactory< AbstractResource, NameIndexResource > fsaAccessResourceFactory(NAMEINDEXRESSOURCE_CLASSID)
launch exception related to the configuration file parsing