144 LERROR <<
"Error: receiving a null element name while parsing matrix file";
148 const QString& stringName = name;
152 if (stringName == (
"matrice"))
156 QString currentMatrixType = attributes.value(
"type");
157 if (currentMatrixType ==
"nominale") m_currentMatrixType =
NOMINAL;
158 else if (currentMatrixType ==
"verbale") m_currentMatrixType =
VERBAL;
161 else if (stringName == (
"ligne"))
165 m_currentMatrixLineId = attributes.value(
"REF").toUtf8().data();
167 else if (stringName == (
"succ"))
172 using namespace boost;
173 std::string successorsStr = (attributes.value(
"REF")).toUtf8().data();
174 std::set< std::string > successors;
177 copy(tok.begin(), tok.end(),
178 std::insert_iterator< std::set< std::string > >(successors, successors.end()));
181 std::set< std::string >::iterator it = successors.begin();
182 for (; it != successors.end(); it++)
185 row.
m_filters.insert(m_tokenFilters[m_currentMatrixType][(*it)]);
188 TokenFilter filter = m_tokenFilters[m_currentMatrixType][m_currentMatrixLineId];
190 if (m_currentMatrixType ==
NOMINAL)
191 m_matrices.
nominal().
filters().insert(std::make_pair(filter, row));
192 else if (m_currentMatrixType ==
VERBAL)
193 m_matrices.
verbal().
filters().insert(std::make_pair(filter, row));
195 else if (stringName == (
"debuts"))
200 using namespace boost;
201 std::string beginningsStr = (attributes.value(
"REF")).toUtf8().data();
202 std::set< std::string > beginnings;
205 copy(tok.begin(), tok.end(),
206 std::insert_iterator< std::set< std::string > >(beginnings, beginnings.end()));
209 std::set< std::string >::iterator it = beginnings.begin();
210 for (; it != beginnings.end(); it++)
212 row.
m_filters.insert(m_tokenFilters[m_currentMatrixType][(*it)]);
214 if (m_currentMatrixType ==
NOMINAL)
219 else if (m_currentMatrixType ==
VERBAL)
225 else if (stringName == (
"fins"))
230 using namespace boost;
231 std::string endingsStr = (attributes.value(
"REF")).toUtf8().data();
232 std::set< std::string > endings;
235 copy(tok.begin(), tok.end(),
236 std::insert_iterator< std::set< std::string > >(endings, endings.end()));
239 std::set< std::string >::iterator it = endings.begin();
240 for (; it != endings.end(); it++)
242 row.
m_filters.insert(m_tokenFilters[m_currentMatrixType][(*it)]);
245 if (m_currentMatrixType ==
NOMINAL)
247 else if (m_currentMatrixType ==
VERBAL)
250 else if (stringName == (
"chaine"))
254 std::string currentChainType = (attributes.value(
"type")).toUtf8().data();
255 if (currentChainType ==
"nominale") m_currentChainType =
NOMINAL;
256 else if (currentChainType ==
"verbale") m_currentChainType =
VERBAL;
260 else if (stringName == (
"filtre"))
264 m_currentFilterId = (attributes.value(
"ID")).toUtf8().data();
265 m_currentFilterAttributes =std::set< StringsPoolIndex >();
266 m_currentFilterCategories = std::set< LinguisticCode >();
269 else if ( (stringName == (
"nom")) || (stringName == (
"attribut"))
270 || (stringName == (
"categorie")) )
273 m_currentElement = stringName.toUtf8().data();
286 LERROR <<
"Error: receiving a null closing element name while parsing matrix file";
289 const QString& stringName = name;
292 if ( stringName == (
"matrice") )
296 else if ( stringName == (
"chaine") )
300 else if (stringName == (
"filtre"))
304 TokenFilter filter(m_currentFilterId, m_currentFilterName, m_currentFilterAttributes, m_currentFilterCategories);
306 m_tokenFilters[m_currentChainType][m_currentFilterId] = filter;
307 m_currentFilterId =
"";
308 m_currentFilterName =
"";
309 m_currentFilterAttributes = std::set< StringsPoolIndex >();
310 m_currentFilterCategories = std::set< LinguisticCode >();
312 else if ( (stringName == (
"nom")) || (stringName == (
"attribut"))
313 || (stringName == (
"categorie")) )
316 m_currentElement =
"";
319 else if ( stringName == (
"chaine") )
321 m_currentMatrixLineId =
"";