chinese-journal/rudict/rudict/noun.h
2014-11-26 22:38:50 +00:00

79 lines
1.9 KiB
C++

#ifndef NOUN_H_INCLUDED
#define NOUN_H_INCLUDED
#include <string>
#include <map>
#include <set>
#include <vector>
#include <fstream>
#include "boost/algorithm/string.hpp"
enum NounDeclencion
{
ND_1_HARD, // Папа (папы)
ND_1_SOFT, // Доска (доски)
ND_2_HARD_MALE, // Трактор (тракторы)
ND_2_SOFT_MALE, // Тополь (тополи)
ND_2_NEUTER_O, // Бревно (брёвна)
ND_2_NEUTER_E, // Поле (поля)
ND_3 // Лошадь
};
enum NounGrammaticalCase
{
NGC_P1_NOMINATIVE,
NGC_P2_GENITIVE,
NGC_P3_DATIVE,
NGC_P4_ACCUSATIVE,
NGC_P5_INSTRUMENTAL,
NGC_P6_PREPOSITIONAL
};
enum NounNumber
{
NPF_SINGULAR,
NPF_PLURAL
};
std::wstring NounDeclencionToWString(NounDeclencion nounDeclencion);
std::wstring NounGrammaticalCaseToWString(NounGrammaticalCase nounGrammaticalCase);
std::wstring NounNumberToWString(NounNumber nounNumber);
typedef std::tuple<NounDeclencion, NounGrammaticalCase, NounNumber> NounTuple;
typedef std::set<std::wstring> StringSet;
std::vector<std::wstring> GetAllNounEndingArr();
std::map<NounTuple, StringSet> getNounEndingTable();
bool NounIsInDictionary(std::wstring nounNominative);
std::set<NounDeclencion> GetPossibleNounDeclencionSet(std::wstring nounNominative);
bool charIsConsolant(wchar_t c);
bool charIsVowel(wchar_t c);
struct NounStruct
{
NounTuple nounTuple;
std::wstring noun;
};
std::vector<std::pair<std::wstring, std::wstring>> getPossibleNounEndingDivisionArr(std::wstring noun);
std::vector<NounTuple> GetPossibleNounTupleArr(std::wstring nounEnding);
//std::vector<NounTuple> FilterNounTupleArrByNounDeclentionSet(std::vector<NounTuple> nounTupleArr, std::set<NounDeclencion> filter);
std::wstring RestoreNounByTuple(std::wstring nounBase, NounTuple nounTuple);
std::vector<NounStruct> RecognizeNoun(std::wstring noun);
void LoadFrequentWordSet();
#endif //NOUN_H_INCLUDED