30namespace LinguisticProcessing
32namespace SyntacticAnalysis
58 LDEBUG <<
"Creating a SyntagmDefStruct (loads file)";
62 m_nominalMatrix.
language(m_language);
71 LERROR <<
"no parameter 'file' in SyntagmDefinitionStructure group for language " << (int) m_language <<
" !";
89 LDEBUG <<
"Loading matrices from " << fileName;
100 QFile file(fileName.c_str());
101 if (!file.open(QFile::ReadOnly))
105 if (!handler.
parse(&file))
115 SyntagmaticMatrixFilter::iterator it, it_end;
117 it = m_filters.begin(); it_end = m_filters.end();
118 for (; it != it_end; it++)
120 (*it).second.deleteRow();
126 std::cout <<
"Displaying a matrix" << std::endl;
127 for (SyntagmaticMatrixFilter::const_iterator it(m_filters.begin()); it != m_filters.end(); it++)
129 std::cout << ((*it).first) <<
" : ";
130 for (std::set< TokenFilter, tfless >::const_iterator it2((*it).second.m_filters.begin()); it2 != (*it).second.m_filters.end(); it2++)
132 std::cout << (*it2) <<
", ";
134 std::cout << std::endl << std::endl;
150 SyntagmaticMatrixFilter::const_iterator it = m_filters.begin();
151 SyntagmaticMatrixFilter::const_iterator it_end = m_filters.end();
152 for (; it != it_end; it++)
163 std::cout << std::endl << std::endl;
165 std::cout << std::endl << std::endl;
166 std::cout << m_nomChainBeg << std::endl << std::endl;
167 std::cout << m_nomChainEnd << std::endl << std::endl;
168 std::cout << m_verbChainBeg << std::endl << std::endl;
169 std::cout << m_verbChainEnd << std::endl << std::endl;
204 return (m_nomChainBeg.
find(f) != m_nomChainBeg.
m_filters.end());
210 return (m_nomChainEnd.
find(f) != m_nomChainEnd.
m_filters.end());
216 return (m_verbChainBeg.
find(f) != m_verbChainBeg.
m_filters.end());
222 return (m_verbChainEnd.
find(f) != m_verbChainEnd.
m_filters.end());
254 auto ends = std::make_pair(m_nominalMatrix.
filters().begin(),
255 m_nominalMatrix.
filters().end());
256 for (; ends.first != ends.second; (ends.first)++)
258 if (
tf_dwless()(ends.first->first,srcTf) )
261 std::set< TokenFilter, tfless >::const_iterator itRow = row.
find(destTf);
262 if (itRow != row.
m_filters.end())
return true;
279 auto ends = std::make_pair(m_verbalMatrix.
filters().begin(),
280 m_verbalMatrix.
filters().end());
284 for (; ends.first != ends.second; (ends.first)++)
286 if (
tf_dwless()(ends.first->first , srcTf) )
289 std::set< TokenFilter, tfless >::const_iterator itRow = row.
find(destTf);
290 if (itRow != row.
m_filters.end())
return true;
301 bool attribFound =
false;
304 std::set< StringsPoolIndex >::const_iterator itx, ity, itx_end, ity_end;
315 while ((itx != itx_end) && (ity != ity_end))
333 bool categFound =
false;
334 std::set< LinguisticCode >::const_iterator itx, ity, itx_end, ity_end;
343 while ((itx != itx_end) && (ity != ity_end))
356 return ( categFound );
363 bool attribFound =
false;
368 std::set< StringsPoolIndex >::const_iterator itx, ity, itx_end, ity_end;
379 while ((itx != itx_end) && (ity != ity_end))
397 bool categFound =
false;
398 std::set< LinguisticCode >::const_iterator itx, ity, itx_end, ity_end;
407 while ((itx != itx_end) && (ity != ity_end))
420 return ( categFound );
427 bool attribFound =
false;
431 std::set< StringsPoolIndex >::const_iterator itx, ity, itx_end, ity_end;
442 while ((itx != itx_end) && (ity != ity_end))
460 bool categFound =
false;
461 std::set< LinguisticCode >::const_iterator itx, ity, itx_end, ity_end;
470 while ((itx != itx_end) && (ity != ity_end))
483 return ( categFound );
488 std::set< TokenFilter, tfless >::const_iterator it =
m_filters.begin();
489 std::set< TokenFilter, tfless >::const_iterator it_end =
m_filters.end();
490 for (; it != it_end; it++)
#define LIMA_EXCEPTION_SELECT_LOGINIT(X, Y, Z)
This macro writes the message Y to the error stream configured by its first parameter X,...
#define LIMA_EXCEPTION_SELECT(X, Y)
This macro writes the message X to a previously configured error stream before throwing a Y exception...
Defines a Factory to create Object of type Base.
#define SYNTAGMDEFSTRUCT_CLASSID
std::string & getParamsValueAtKey(const std::string &key)
return a message when a 'param' was not found
Manage initialization of InitializableObjects using configuration module and parameters.
const InitializationParameters & getInitializationParameters() const
get Initialization Parameters
Use this exception to signal an error in one of the configuration files.
Holds morphosyntactic informations.
virtual ~SyntagmDefStruct()
bool belongsToNominalMatrix(const LinguisticAnalysisStructure::MorphoSyntacticData *src, const LinguisticAnalysisStructure::MorphoSyntacticData *dest) const
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
bool canNominalChainEndBy(const LinguisticAnalysisStructure::MorphoSyntacticData *cat) const
bool canVerbalChainEndBy(const LinguisticAnalysisStructure::MorphoSyntacticData *cat) const
bool canChainEndBy(const LinguisticAnalysisStructure::MorphoSyntacticData *filter, Common::MediaticData::ChainsType type) const
bool canVerbalChainBeginBy(const LinguisticAnalysisStructure::MorphoSyntacticData *cat) const
bool canChainBeginBy(const LinguisticAnalysisStructure::MorphoSyntacticData *filter, Common::MediaticData::ChainsType type) const
bool belongsToMatrix(const LinguisticAnalysisStructure::MorphoSyntacticData *src, const LinguisticAnalysisStructure::MorphoSyntacticData *dest, Common::MediaticData::ChainsType type) const
void loadFromFile(const std::string &fileName)
bool belongsToVerbalMatrix(const LinguisticAnalysisStructure::MorphoSyntacticData *src, const LinguisticAnalysisStructure::MorphoSyntacticData *dest) const
bool canNominalChainBeginBy(const LinguisticAnalysisStructure::MorphoSyntacticData *cat) const
std::set< TokenFilter, tfless > m_filters
std::set< TokenFilter, tfless >::const_iterator find(const TokenFilter &f) const
SyntagmaticMatrixFilter & filters()
SyntagmaticMatrixFilter::const_iterator find(const TokenFilter &f) const
std::pair< std::set< StringsPoolIndex >::iterator, std::set< StringsPoolIndex >::iterator > attributesIterators()
std::set< StringsPoolIndex > & attributes()
std::pair< std::set< LinguisticCode >::iterator, std::set< LinguisticCode >::iterator > categoriesIterators()
This is a SAX document handler the Detect configuration files.
bool parse(QIODevice *device)
QString errorString() const
bool operator()(const TokenFilter &x, const TokenFilter &y) const
Used to search a DicoWord inside syntagmatic structure.
static const MediaticData & single()
const singleton accessor
Throw this exception when encountering problems with XML files opening or parsing.
QString findFileInPaths(const QString &paths, const QString &fileName, const QChar &separator)
Find the given file in the given paths.
std::map< TokenFilter, SyntagmaticMatrixRow, tfless > SyntagmaticMatrixFilter
SimpleFactory< AbstractResource, SyntagmDefStruct > syntagmDefStructFactory(SYNTAGMDEFSTRUCT_CLASSID)