LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
NormalizationUtils.cpp
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/************************************************************************
7 *
8 * @file NormalizationUtils.cpp
9 * @author Besancon Romaric (romaric.besancon@cea.fr)
10 * @date Tue Jun 13 2006
11 * copyright Copyright (C) 2006-2012 by CEA LIST
12 *
13 ***********************************************************************/
14
15#include "NormalizationUtils.h"
16
18
19namespace Lima {
20namespace LinguisticProcessing {
21
22//**********************************************************************
23// some helper functions
24bool testMicroCategory(const std::set<LinguisticCode>* micros,
25 const Common::PropertyCode::PropertyAccessor* microAccessor,
26 const LinguisticCode properties)
27{
28 LinguisticCode code = microAccessor->readValue(properties);
29 return (micros->find(code) != micros->end());
30}
31
32bool testMicroCategory(const std::set<LinguisticCode>* micros,
33 const Common::PropertyCode::PropertyAccessor* microAccessor,
34 const MorphoSyntacticData* data)
35{
36 MorphoSyntacticData::const_iterator
37 it=data->begin(),
38 it_end=data->end();
39 for (; it!=it_end; it++) {
40 if (testMicroCategory(micros,microAccessor,(*it).properties)) {
41 return true;
42 }
43 }
44 return false;
45}
46
47bool isInteger(Token* t) {
48 const TStatus& status=t->status();
49 switch(status.getNumeric()) {
50 case T_INTEGER: return true;
51 default: return false;
52 }
53}
54
55} // end namespace
56} // end namespace
Provide function to read write and check a property.
LinguisticCode readValue(const LinguisticCode &code) const
read a property in a coded int.
bool testMicroCategory(const std::set< LinguisticCode > *micros, const Common::PropertyCode::PropertyAccessor *microAccessor, const LinguisticCode properties)
NAUTITIA.