-
Notifications
You must be signed in to change notification settings - Fork 0
/
delafdict.h
56 lines (38 loc) · 1.14 KB
/
delafdict.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef DELAFDICT_H
#define DELAFDICT_H
#include <string>
#include <unordered_map>
#include <vector>
namespace casimiro {
typedef std::vector<std::string> StringVector;
enum WordType {
Noun,
Adjective,
Abbreviation,
Acronym,
UnknownWordType
};
class DelafWordInfo {
public:
DelafWordInfo(const std::string _canonical, WordType _wordType):canonical(_canonical), wordType(_wordType)
{}
std::string canonical;
WordType wordType;
};
class DelafDict
{
public:
DelafDict();
virtual void loadFromFile(const std::string& _fileName);
virtual bool hasWord(const std::string& _word) const;
virtual std::string getCanonical(const std::string& _word) const;
virtual WordType getWordType(const std::string& _word) const;
virtual StringVector getUnknownWords(const StringVector& _words) const;
virtual StringVector getNouns(const StringVector& _words) const;
virtual bool isNoun(const std::string& _word) const;
private:
std::unordered_map<std::string, DelafWordInfo> m_words;
virtual WordType extractWordType(const std::string& _line);
};
}
#endif // DELAFDICT_H