LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
StopList.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 * Copyright (C) 2004-2012 by CEA LIST *
8 * *
9 ***************************************************************************/
10
11#include "StopList.h"
16
18
19#include <iostream>
20#include <fstream>
21
22using namespace std;
23
24namespace Lima
25{
26
27namespace LinguisticProcessing
28{
29
30namespace AnalysisDumpers
31{
32
34
38
39
42
48 Manager* manager)
49
50{
51 LIMA_UNUSED(manager);
53 QString stopListFileName;
54 try
55 {
56 stopListFileName = getResourceFileName(unitConfiguration.getParamsValueAtKey("file").c_str());
57 }
59 {
60 LERROR << "No param 'file' in StopList configuration group ! ";
62 }
63
64 std::ifstream stopListFile(stopListFileName.toUtf8().constData(), std::ifstream::binary);
65 if (!stopListFile) {
66 LERROR << "invalid file " << stopListFileName;
68 }
69
71 LDEBUG << "Loading stop list file: " << stopListFileName;
72 while (!wword.isEmpty())
73 {
74 insert(wword);
76 }
77}
78
79
80
81}
82
83}
84}
#define LIMA_UNUSED(x)
Definition LimaCommon.h:224
#define LDEBUG
Definition LimaCommon.h:157
#define LERROR
Definition LimaCommon.h:161
#define DUMPERLOGINIT
Defines a Factory to create Object of type Base.
#define STOPLIST_CLASSID
Definition StopList.h:28
return a message when a 'param' was not found
Manage initialization of InitializableObjects using configuration module and parameters.
Use this exception to signal an error in one of the configuration files.
Definition LimaCommon.h:345
QString getResourceFileName(const QString &paramName)
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
Definition StopList.cpp:46
std::string readLine(std::istream &inputFile)
LimaString utf8stdstring2limastring(const std::string &src)
SimpleFactory< AbstractResource, StopList > stopListFactory(STOPLIST_CLASSID)
NAUTITIA.
QString LimaString
Definition LimaString.h:33
STL namespace.
launch exception related to the configuration file parsing