Refactoring
This commit is contained in:
parent
f48b8c6929
commit
1b88f4c095
@ -28,7 +28,7 @@ namespace AJ
|
|||||||
|
|
||||||
boost::split_regex(lineArr, line, boost::wregex(L" "));
|
boost::split_regex(lineArr, line, boost::wregex(L" "));
|
||||||
|
|
||||||
nominativeMaleForm = lineArr[1];
|
SetWord(lineArr[1]);
|
||||||
|
|
||||||
standardShortFormAvailable = lineArr[2] == L"1" ? true : false;
|
standardShortFormAvailable = lineArr[2] == L"1" ? true : false;
|
||||||
|
|
||||||
@ -38,6 +38,38 @@ namespace AJ
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AdjectiveStruct::operator<(const AdjectiveStruct& n) const
|
||||||
|
{
|
||||||
|
if (grammaticalCase != n.grammaticalCase)
|
||||||
|
{
|
||||||
|
return grammaticalCase < n.grammaticalCase;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (count != n.count)
|
||||||
|
{
|
||||||
|
return count < n.count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gender != n.gender)
|
||||||
|
{
|
||||||
|
return gender < n.gender;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (isDeclentionAnimated != n.isDeclentionAnimated)
|
||||||
|
{
|
||||||
|
return isDeclentionAnimated < n.isDeclentionAnimated;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return adjectiveRecord < n.adjectiveRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::wstring> GetAllAdjectiveEndingArr()
|
std::vector<std::wstring> GetAllAdjectiveEndingArr()
|
||||||
{
|
{
|
||||||
@ -160,6 +192,25 @@ namespace AJ
|
|||||||
return IFORM_MALE_INANIMATE;
|
return IFORM_MALE_INANIMATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AdjectiveEndingDivision::operator<(const AdjectiveEndingDivision& other) const
|
||||||
|
{
|
||||||
|
if (base != other.base)
|
||||||
|
{
|
||||||
|
return base < other.base;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ending != other.ending)
|
||||||
|
{
|
||||||
|
return ending < other.ending;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return divisionCase < other.divisionCase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::set<AdjectiveEndingDivision> getPossibleAdjectiveEndingDivisionSet(std::wstring noun)
|
std::set<AdjectiveEndingDivision> getPossibleAdjectiveEndingDivisionSet(std::wstring noun)
|
||||||
{
|
{
|
||||||
std::set<AdjectiveEndingDivision> result;
|
std::set<AdjectiveEndingDivision> result;
|
||||||
@ -208,7 +259,7 @@ namespace AJ
|
|||||||
{
|
{
|
||||||
for (auto& adjective : AdjectiveRecordArr)
|
for (auto& adjective : AdjectiveRecordArr)
|
||||||
{
|
{
|
||||||
if (adjective.nominativeMaleForm == nominative)
|
if (adjective.GetWord() == nominative)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -221,7 +272,7 @@ namespace AJ
|
|||||||
{
|
{
|
||||||
for (auto& adjective : AdjectiveRecordArr)
|
for (auto& adjective : AdjectiveRecordArr)
|
||||||
{
|
{
|
||||||
if (adjective.nominativeMaleForm == nominative)
|
if (adjective.GetWord() == nominative)
|
||||||
{
|
{
|
||||||
return adjective;
|
return adjective;
|
||||||
}
|
}
|
||||||
@ -231,28 +282,6 @@ namespace AJ
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
std::set<std::wstring> GetAdjectiveNominative(std::wstring base, AdjectiveDeclencion declencion, NounCount nounCount)
|
|
||||||
{
|
|
||||||
std::set<std::wstring> result;
|
|
||||||
|
|
||||||
AdjectiveDeclencionCaseTableRecord declencionCaseTableRecord = adjectiveDeclencionCaseTable[static_cast<int>(declencion)];
|
|
||||||
|
|
||||||
for (auto& grammaticalTableRecord : declencionCaseTableRecord.grammaticalCaseTable)
|
|
||||||
{
|
|
||||||
if (grammaticalTableRecord.grammaticalCase == NGC_P1_NOMINATIVE && grammaticalTableRecord.count == nounCount)
|
|
||||||
{
|
|
||||||
for (auto& e : grammaticalTableRecord.ending)
|
|
||||||
{
|
|
||||||
result.insert(base + e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
std::set<std::wstring> GetNominativeMaleSingular(std::wstring base)
|
std::set<std::wstring> GetNominativeMaleSingular(std::wstring base)
|
||||||
{
|
{
|
||||||
std::wstring result;
|
std::wstring result;
|
||||||
|
@ -14,10 +14,8 @@
|
|||||||
namespace AJ
|
namespace AJ
|
||||||
{
|
{
|
||||||
|
|
||||||
struct AdjectiveRecord : public TranslationUnitSetMix
|
struct AdjectiveRecord : public TranslationUnitSetMix, public WordHolder
|
||||||
{
|
{
|
||||||
std::wstring nominativeMaleForm;
|
|
||||||
|
|
||||||
bool standardShortFormAvailable;
|
bool standardShortFormAvailable;
|
||||||
|
|
||||||
std::wstring specialShortForm;
|
std::wstring specialShortForm;
|
||||||
@ -25,10 +23,6 @@ namespace AJ
|
|||||||
AdjectiveRecord();
|
AdjectiveRecord();
|
||||||
AdjectiveRecord(std::wstring line);
|
AdjectiveRecord(std::wstring line);
|
||||||
|
|
||||||
bool operator<(const AdjectiveRecord& n) const
|
|
||||||
{
|
|
||||||
return nominativeMaleForm < n.nominativeMaleForm;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -46,38 +40,7 @@ namespace AJ
|
|||||||
|
|
||||||
AdjectiveRecord adjectiveRecord;
|
AdjectiveRecord adjectiveRecord;
|
||||||
|
|
||||||
bool operator<(const AdjectiveStruct& n) const
|
bool operator<(const AdjectiveStruct& n) const;
|
||||||
{
|
|
||||||
if (grammaticalCase != n.grammaticalCase)
|
|
||||||
{
|
|
||||||
return grammaticalCase < n.grammaticalCase;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (count != n.count)
|
|
||||||
{
|
|
||||||
return count < n.count;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (gender != n.gender)
|
|
||||||
{
|
|
||||||
return gender < n.gender;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (isDeclentionAnimated != n.isDeclentionAnimated)
|
|
||||||
{
|
|
||||||
return isDeclentionAnimated < n.isDeclentionAnimated;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return adjectiveRecord < n.adjectiveRecord;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -132,24 +95,8 @@ namespace AJ
|
|||||||
DC_COMMON = 0
|
DC_COMMON = 0
|
||||||
} divisionCase;
|
} divisionCase;
|
||||||
|
|
||||||
bool operator<(const AdjectiveEndingDivision& other) const
|
bool operator<(const AdjectiveEndingDivision& other) const;
|
||||||
{
|
|
||||||
if (base != other.base)
|
|
||||||
{
|
|
||||||
return base < other.base;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ending != other.ending)
|
|
||||||
{
|
|
||||||
return ending < other.ending;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return divisionCase < other.divisionCase;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::set<AdjectiveEndingDivision> getPossibleAdjectiveEndingDivisionSet(std::wstring noun);
|
std::set<AdjectiveEndingDivision> getPossibleAdjectiveEndingDivisionSet(std::wstring noun);
|
||||||
@ -179,7 +126,6 @@ namespace AJ
|
|||||||
|
|
||||||
void FillDivisionCaseMaps();
|
void FillDivisionCaseMaps();
|
||||||
|
|
||||||
|
|
||||||
std::set<AdjectiveStruct> RecognizeAdjective(std::wstring noun);
|
std::set<AdjectiveStruct> RecognizeAdjective(std::wstring noun);
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,42 @@ boost::property_tree::wptree TranslationUnitSetMix::CreateTranslationPropertyTre
|
|||||||
return ptree;
|
return ptree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WordHolder::operator<(const WordHolder& other) const
|
||||||
|
{
|
||||||
|
return word < other.word;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WordHolder::SetWord(const std::wstring& w)
|
||||||
|
{
|
||||||
|
word = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring WordHolder::GetWord() const
|
||||||
|
{
|
||||||
|
return word;
|
||||||
|
}
|
||||||
|
|
||||||
|
wchar_t WordHolder::GetLastChar() const
|
||||||
|
{
|
||||||
|
if (word.size() > 0)
|
||||||
|
{
|
||||||
|
std::cout << "Error in GetLastChar" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return word[word.size() - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
wchar_t WordHolder::GetPrevLastChar() const
|
||||||
|
{
|
||||||
|
if (word.size() > 1)
|
||||||
|
{
|
||||||
|
std::cout << "Error in GetPrevLastChar" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return word[word.size() - 2];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NounCount WStringToNounCount(std::wstring str)
|
NounCount WStringToNounCount(std::wstring str)
|
||||||
{
|
{
|
||||||
|
@ -65,6 +65,24 @@ public:
|
|||||||
boost::property_tree::wptree CreateTranslationPropertyTree() const;
|
boost::property_tree::wptree CreateTranslationPropertyTree() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class WordHolder
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::wstring word;
|
||||||
|
public:
|
||||||
|
|
||||||
|
void SetWord(const std::wstring& w);
|
||||||
|
|
||||||
|
std::wstring GetWord() const;
|
||||||
|
|
||||||
|
wchar_t GetLastChar() const;
|
||||||
|
|
||||||
|
wchar_t GetPrevLastChar() const;
|
||||||
|
|
||||||
|
bool operator<(const WordHolder& other) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
std::wstring NounCountToWString(NounCount nounCount);
|
std::wstring NounCountToWString(NounCount nounCount);
|
||||||
NounCount WStringToNounCount(std::wstring str);
|
NounCount WStringToNounCount(std::wstring str);
|
||||||
|
@ -35,7 +35,7 @@ NounRecord::NounRecord(std::wstring line)
|
|||||||
|
|
||||||
boost::split_regex(lineArr, line, boost::wregex(L" "));
|
boost::split_regex(lineArr, line, boost::wregex(L" "));
|
||||||
|
|
||||||
nominativeForm = lineArr[1];
|
SetWord(lineArr[1]);
|
||||||
|
|
||||||
if (lineArr[2] == L"м")
|
if (lineArr[2] == L"м")
|
||||||
{
|
{
|
||||||
@ -157,6 +157,51 @@ NounDeclencion WStringToNounDeclencion(std::wstring str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool NounEndingDivision::operator<(const NounEndingDivision& other) const
|
||||||
|
{
|
||||||
|
if (base != other.base)
|
||||||
|
{
|
||||||
|
return base < other.base;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ending != other.ending)
|
||||||
|
{
|
||||||
|
return ending < other.ending;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return divisionCase < other.divisionCase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NounStruct::operator<(const NounStruct& other) const
|
||||||
|
{
|
||||||
|
if (nounGrammaticalCase != other.nounGrammaticalCase)
|
||||||
|
{
|
||||||
|
return nounGrammaticalCase < other.nounGrammaticalCase;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (nounCount != other.nounCount)
|
||||||
|
{
|
||||||
|
return nounCount < other.nounCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (animated != other.animated)
|
||||||
|
{
|
||||||
|
return animated < other.animated;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nounRecord < other.nounRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::wstring> GetAllNounEndingArr()
|
std::vector<std::wstring> GetAllNounEndingArr()
|
||||||
{
|
{
|
||||||
std::vector<std::wstring> result
|
std::vector<std::wstring> result
|
||||||
@ -197,7 +242,7 @@ bool NounIsInDictionary(std::wstring nounNominative)
|
|||||||
{
|
{
|
||||||
for (auto& noun : NounRecordArr)
|
for (auto& noun : NounRecordArr)
|
||||||
{
|
{
|
||||||
if (noun.nominativeForm == nounNominative)
|
if (noun.GetWord() == nounNominative)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -283,7 +328,7 @@ std::set<std::wstring> getPluralForm(NounRecord noun)
|
|||||||
{
|
{
|
||||||
if (noun.haveStandardMultipleForm)
|
if (noun.haveStandardMultipleForm)
|
||||||
{
|
{
|
||||||
std::wstring pluralForm = convertToStandardPluralForm(noun.nominativeForm);
|
std::wstring pluralForm = convertToStandardPluralForm(noun.GetWord());
|
||||||
|
|
||||||
if (noun.haveStandardMultipleFormEnding)
|
if (noun.haveStandardMultipleFormEnding)
|
||||||
{
|
{
|
||||||
@ -300,7 +345,7 @@ std::set<std::wstring> getPluralForm(NounRecord noun)
|
|||||||
|
|
||||||
if (noun.haveStandardMultipleFormWithMissingLastVowel)
|
if (noun.haveStandardMultipleFormWithMissingLastVowel)
|
||||||
{
|
{
|
||||||
std::wstring pluralForm = convertToStandardPluralForm(noun.nominativeForm);
|
std::wstring pluralForm = convertToStandardPluralForm(noun.GetWord());
|
||||||
|
|
||||||
wchar_t prevsschar = pluralForm[pluralForm.size() - 4];
|
wchar_t prevsschar = pluralForm[pluralForm.size() - 4];
|
||||||
|
|
||||||
@ -330,7 +375,7 @@ std::set<std::wstring> getPluralForm(NounRecord noun)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.insert(noun.nominativeForm);
|
result.insert(noun.GetWord());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -357,7 +402,7 @@ NounRecord GetNounRecordFromDictionary(std::wstring nounNominative)
|
|||||||
{
|
{
|
||||||
for (auto& noun : NounRecordArr)
|
for (auto& noun : NounRecordArr)
|
||||||
{
|
{
|
||||||
if (noun.nominativeForm == nounNominative)
|
if (noun.GetWord() == nounNominative)
|
||||||
{
|
{
|
||||||
return noun;
|
return noun;
|
||||||
}
|
}
|
||||||
@ -531,95 +576,85 @@ std::wstring GetNounNoninativeSpecialPluralA(std::wstring nounBase, NounDeclenci
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wchar_t GetLastChar(const NounRecord& nounRecord)
|
|
||||||
{
|
|
||||||
return nounRecord.nominativeForm[nounRecord.nominativeForm.size() - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
wchar_t GetPrevLastChar(const NounRecord& nounRecord)
|
|
||||||
{
|
|
||||||
return nounRecord.nominativeForm[nounRecord.nominativeForm.size() - 2];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool FirstAIFormInanimateSingularCondition(const NounRecord& nounRecord)
|
bool FirstAIFormInanimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.canBeInanimate && (GetLastChar(nounRecord) == L'а' && charIsIFormConsolant(GetPrevLastChar(nounRecord)));
|
return nounRecord.haveSingleForm && nounRecord.canBeInanimate && (nounRecord.GetLastChar() == L'а' && charIsIFormConsolant(nounRecord.GetPrevLastChar()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FirstAIFormAnimateSingularCondition(const NounRecord& nounRecord)
|
bool FirstAIFormAnimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.canBeAnimate && (GetLastChar(nounRecord) == L'а' && charIsIFormConsolant(GetPrevLastChar(nounRecord)));
|
return nounRecord.haveSingleForm && nounRecord.canBeAnimate && (nounRecord.GetLastChar() == L'а' && charIsIFormConsolant(nounRecord.GetPrevLastChar()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FirstAIFormInanimatePluralCondition(const NounRecord& nounRecord)
|
bool FirstAIFormInanimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.canBeInanimate && (
|
return nounRecord.haveMultipleForm && nounRecord.canBeInanimate && (
|
||||||
(GetLastChar(nounRecord) == L'а' && charIsIFormConsolant(GetPrevLastChar(nounRecord))) ||
|
(nounRecord.GetLastChar() == L'а' && charIsIFormConsolant(nounRecord.GetPrevLastChar())) ||
|
||||||
!nounRecord.haveSingleForm && (GetLastChar(nounRecord) == L'и' && charIsIFormConsolant(GetPrevLastChar(nounRecord)))
|
!nounRecord.haveSingleForm && (nounRecord.GetLastChar() == L'и' && charIsIFormConsolant(nounRecord.GetPrevLastChar()))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FirstAIFormAnimatePluralCondition(const NounRecord& nounRecord)
|
bool FirstAIFormAnimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.canBeAnimate && (
|
return nounRecord.haveMultipleForm && nounRecord.canBeAnimate && (
|
||||||
(GetLastChar(nounRecord) == L'а' && charIsIFormConsolant(GetPrevLastChar(nounRecord))) ||
|
(nounRecord.GetLastChar() == L'а' && charIsIFormConsolant(nounRecord.GetPrevLastChar())) ||
|
||||||
!nounRecord.haveSingleForm && (GetLastChar(nounRecord) == L'и' && charIsIFormConsolant(GetPrevLastChar(nounRecord)))
|
!nounRecord.haveSingleForm && (nounRecord.GetLastChar() == L'и' && charIsIFormConsolant(nounRecord.GetPrevLastChar()))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FirstAUFormInanimateSingularCondition(const NounRecord& nounRecord)
|
bool FirstAUFormInanimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.canBeInanimate && (GetLastChar(nounRecord) == L'а' && charIsUFormConsolant(GetPrevLastChar(nounRecord)));
|
return nounRecord.haveSingleForm && nounRecord.canBeInanimate && (nounRecord.GetLastChar() == L'а' && charIsUFormConsolant(nounRecord.GetPrevLastChar()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FirstAUFormAnimateSingularCondition(const NounRecord& nounRecord)
|
bool FirstAUFormAnimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.canBeAnimate && (GetLastChar(nounRecord) == L'а' && charIsUFormConsolant(GetPrevLastChar(nounRecord)));
|
return nounRecord.haveSingleForm && nounRecord.canBeAnimate && (nounRecord.GetLastChar() == L'а' && charIsUFormConsolant(nounRecord.GetPrevLastChar()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FirstAUFormInanimatePluralCondition(const NounRecord& nounRecord)
|
bool FirstAUFormInanimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.canBeInanimate && (
|
return nounRecord.haveMultipleForm && nounRecord.canBeInanimate && (
|
||||||
(GetLastChar(nounRecord) == L'а' && charIsUFormConsolant(GetPrevLastChar(nounRecord))) ||
|
(nounRecord.GetLastChar() == L'а' && charIsUFormConsolant(nounRecord.GetPrevLastChar())) ||
|
||||||
!nounRecord.haveSingleForm && (GetLastChar(nounRecord) == L'ы' && charIsUFormConsolant(GetPrevLastChar(nounRecord)))
|
!nounRecord.haveSingleForm && (nounRecord.GetLastChar() == L'ы' && charIsUFormConsolant(nounRecord.GetPrevLastChar()))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FirstAUFormAnimatePluralCondition(const NounRecord& nounRecord)
|
bool FirstAUFormAnimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.canBeAnimate && (
|
return nounRecord.haveMultipleForm && nounRecord.canBeAnimate && (
|
||||||
(GetLastChar(nounRecord) == L'а' && charIsUFormConsolant(GetPrevLastChar(nounRecord))) ||
|
(nounRecord.GetLastChar() == L'а' && charIsUFormConsolant(nounRecord.GetPrevLastChar())) ||
|
||||||
!nounRecord.haveSingleForm && (GetLastChar(nounRecord) == L'ы' && charIsUFormConsolant(GetPrevLastChar(nounRecord)))
|
!nounRecord.haveSingleForm && (nounRecord.GetLastChar() == L'ы' && charIsUFormConsolant(nounRecord.GetPrevLastChar()))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FirstYaFormInanimateSingularCondition(const NounRecord& nounRecord)
|
bool FirstYaFormInanimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.canBeInanimate && (GetLastChar(nounRecord) == L'я');
|
return nounRecord.haveSingleForm && nounRecord.canBeInanimate && (nounRecord.GetLastChar() == L'я');
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FirstYaFormAnimateSingularCondition(const NounRecord& nounRecord)
|
bool FirstYaFormAnimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.canBeAnimate && (GetLastChar(nounRecord) == L'я');
|
return nounRecord.haveSingleForm && nounRecord.canBeAnimate && (nounRecord.GetLastChar() == L'я');
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FirstYaFormInanimatePluralCondition(const NounRecord& nounRecord)
|
bool FirstYaFormInanimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.canBeInanimate && (
|
return nounRecord.haveMultipleForm && nounRecord.canBeInanimate && (
|
||||||
(GetLastChar(nounRecord) == L'я') ||
|
(nounRecord.GetLastChar() == L'я') ||
|
||||||
!nounRecord.haveSingleForm && (GetLastChar(nounRecord) == L'и')
|
!nounRecord.haveSingleForm && (nounRecord.GetLastChar() == L'и')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FirstYaFormAnimatePluralCondition(const NounRecord& nounRecord)
|
bool FirstYaFormAnimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.canBeAnimate && (
|
return nounRecord.haveMultipleForm && nounRecord.canBeAnimate && (
|
||||||
(GetLastChar(nounRecord) == L'я') ||
|
(nounRecord.GetLastChar() == L'я') ||
|
||||||
!nounRecord.haveSingleForm && (GetLastChar(nounRecord) == L'и')
|
!nounRecord.haveSingleForm && (nounRecord.GetLastChar() == L'и')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,14 +663,14 @@ bool FirstYaFormAnimatePluralCondition(const NounRecord& nounRecord)
|
|||||||
|
|
||||||
bool SecondMaleIFormInanimateSingularCondition(const NounRecord& nounRecord)
|
bool SecondMaleIFormInanimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && charIsIFormConsolant(GetLastChar(nounRecord));
|
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && charIsIFormConsolant(nounRecord.GetLastChar());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondMaleIFormInanimatePluralCondition(const NounRecord& nounRecord)
|
bool SecondMaleIFormInanimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && (
|
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && (
|
||||||
charIsIFormConsolant(GetLastChar(nounRecord)) ||
|
charIsIFormConsolant(nounRecord.GetLastChar()) ||
|
||||||
!nounRecord.haveSingleForm && charIsIFormConsolant(GetPrevLastChar(nounRecord)) && GetLastChar(nounRecord) == L'и'
|
!nounRecord.haveSingleForm && charIsIFormConsolant(nounRecord.GetPrevLastChar()) && nounRecord.GetLastChar() == L'и'
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -643,92 +678,92 @@ bool SecondMaleIFormInanimatePluralCondition(const NounRecord& nounRecord)
|
|||||||
|
|
||||||
bool SecondMaleIFormAnimateSingularCondition(const NounRecord& nounRecord)
|
bool SecondMaleIFormAnimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && charIsIFormConsolant(GetLastChar(nounRecord));
|
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && charIsIFormConsolant(nounRecord.GetLastChar());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondMaleIFormAnimatePluralCondition(const NounRecord& nounRecord)
|
bool SecondMaleIFormAnimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && (
|
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && (
|
||||||
charIsIFormConsolant(GetLastChar(nounRecord)) ||
|
charIsIFormConsolant(nounRecord.GetLastChar()) ||
|
||||||
!nounRecord.haveSingleForm && charIsIFormConsolant(GetPrevLastChar(nounRecord)) && GetLastChar(nounRecord) == L'и'
|
!nounRecord.haveSingleForm && charIsIFormConsolant(nounRecord.GetPrevLastChar()) && nounRecord.GetLastChar() == L'и'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SecondMaleUFormInanimateSingularCondition(const NounRecord& nounRecord)
|
bool SecondMaleUFormInanimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && charIsUFormConsolant(GetLastChar(nounRecord));
|
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && charIsUFormConsolant(nounRecord.GetLastChar());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondMaleUFormInanimatePluralCondition(const NounRecord& nounRecord)
|
bool SecondMaleUFormInanimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && (
|
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && (
|
||||||
charIsUFormConsolant(GetLastChar(nounRecord)) ||
|
charIsUFormConsolant(nounRecord.GetLastChar()) ||
|
||||||
!nounRecord.haveSingleForm && charIsUFormConsolant(GetPrevLastChar(nounRecord)) && GetLastChar(nounRecord) == L'ы'
|
!nounRecord.haveSingleForm && charIsUFormConsolant(nounRecord.GetPrevLastChar()) && nounRecord.GetLastChar() == L'ы'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SecondMaleUFormAnimateSingularCondition(const NounRecord& nounRecord)
|
bool SecondMaleUFormAnimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && charIsUFormConsolant(GetLastChar(nounRecord));
|
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && charIsUFormConsolant(nounRecord.GetLastChar());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondMaleUFormAnimatePluralCondition(const NounRecord& nounRecord)
|
bool SecondMaleUFormAnimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && (
|
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && (
|
||||||
charIsUFormConsolant(GetLastChar(nounRecord)) ||
|
charIsUFormConsolant(nounRecord.GetLastChar()) ||
|
||||||
!nounRecord.haveSingleForm && charIsUFormConsolant(GetPrevLastChar(nounRecord)) && GetLastChar(nounRecord) == L'ы'
|
!nounRecord.haveSingleForm && charIsUFormConsolant(nounRecord.GetPrevLastChar()) && nounRecord.GetLastChar() == L'ы'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SecondMaleSSFormInanimateSingularCondition(const NounRecord& nounRecord)
|
bool SecondMaleSSFormInanimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && GetLastChar(nounRecord) == L'ь';
|
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && nounRecord.GetLastChar() == L'ь';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondMaleSSFormInanimatePluralCondition(const NounRecord& nounRecord)
|
bool SecondMaleSSFormInanimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && (
|
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeInanimate && (
|
||||||
GetLastChar(nounRecord) == L'ь' ||
|
nounRecord.GetLastChar() == L'ь' ||
|
||||||
!nounRecord.haveSingleForm && GetLastChar(nounRecord) == L'и'
|
!nounRecord.haveSingleForm && nounRecord.GetLastChar() == L'и'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SecondMaleSSFormAnimateSingularCondition(const NounRecord& nounRecord)
|
bool SecondMaleSSFormAnimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && GetLastChar(nounRecord) == L'ь';
|
return nounRecord.haveSingleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && nounRecord.GetLastChar() == L'ь';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondMaleSSFormAnimatePluralCondition(const NounRecord& nounRecord)
|
bool SecondMaleSSFormAnimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && (
|
return nounRecord.haveMultipleForm && nounRecord.gender == NG_MALE && nounRecord.canBeAnimate && (
|
||||||
GetLastChar(nounRecord) == L'ь' ||
|
nounRecord.GetLastChar() == L'ь' ||
|
||||||
!nounRecord.haveSingleForm && GetLastChar(nounRecord) == L'и'
|
!nounRecord.haveSingleForm && nounRecord.GetLastChar() == L'и'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SecondIShortInanimateSingularCondition(const NounRecord& nounRecord)
|
bool SecondIShortInanimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.canBeInanimate && GetLastChar(nounRecord) == L'й';
|
return nounRecord.haveSingleForm && nounRecord.canBeInanimate && nounRecord.GetLastChar() == L'й';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondIShortAnimateSingularCondition(const NounRecord& nounRecord)
|
bool SecondIShortAnimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.canBeAnimate && GetLastChar(nounRecord) == L'й';
|
return nounRecord.haveSingleForm && nounRecord.canBeAnimate && nounRecord.GetLastChar() == L'й';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondIShortInanimatePluralCondition(const NounRecord& nounRecord)
|
bool SecondIShortInanimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.canBeInanimate && GetLastChar(nounRecord) == L'й';
|
return nounRecord.haveSingleForm && nounRecord.canBeInanimate && nounRecord.GetLastChar() == L'й';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondIShortAnimatePluralCondition(const NounRecord& nounRecord)
|
bool SecondIShortAnimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.canBeAnimate && GetLastChar(nounRecord) == L'й';
|
return nounRecord.haveSingleForm && nounRecord.canBeAnimate && nounRecord.GetLastChar() == L'й';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -737,54 +772,54 @@ bool SecondIShortAnimatePluralCondition(const NounRecord& nounRecord)
|
|||||||
|
|
||||||
bool SecondNeutralEFormSingularCondition(const NounRecord& nounRecord)
|
bool SecondNeutralEFormSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.gender == NG_NEUTRAL && GetLastChar(nounRecord) == L'е';
|
return nounRecord.haveSingleForm && nounRecord.gender == NG_NEUTRAL && nounRecord.GetLastChar() == L'е';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondNeutralEFormPluralCondition(const NounRecord& nounRecord)
|
bool SecondNeutralEFormPluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.gender == NG_NEUTRAL && (
|
return nounRecord.haveMultipleForm && nounRecord.gender == NG_NEUTRAL && (
|
||||||
GetLastChar(nounRecord) == L'е' ||
|
nounRecord.GetLastChar() == L'е' ||
|
||||||
!nounRecord.haveSingleForm && GetLastChar(nounRecord) == L'я'
|
!nounRecord.haveSingleForm && nounRecord.GetLastChar() == L'я'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondNeutralOFormSingularCondition(const NounRecord& nounRecord)
|
bool SecondNeutralOFormSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.gender == NG_NEUTRAL && GetLastChar(nounRecord) == L'о';
|
return nounRecord.haveSingleForm && nounRecord.gender == NG_NEUTRAL && nounRecord.GetLastChar() == L'о';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SecondNeutralOFormPluralCondition(const NounRecord& nounRecord)
|
bool SecondNeutralOFormPluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.gender == NG_NEUTRAL && (
|
return nounRecord.haveMultipleForm && nounRecord.gender == NG_NEUTRAL && (
|
||||||
GetLastChar(nounRecord) == L'о' ||
|
nounRecord.GetLastChar() == L'о' ||
|
||||||
!nounRecord.haveSingleForm && GetLastChar(nounRecord) == L'а'
|
!nounRecord.haveSingleForm && nounRecord.GetLastChar() == L'а'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThirdFormInanimateSingularCondition(const NounRecord& nounRecord)
|
bool ThirdFormInanimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.gender == NG_FEMALE && nounRecord.canBeInanimate && GetLastChar(nounRecord) == L'ь';
|
return nounRecord.haveSingleForm && nounRecord.gender == NG_FEMALE && nounRecord.canBeInanimate && nounRecord.GetLastChar() == L'ь';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThirdFormAnimateSingularCondition(const NounRecord& nounRecord)
|
bool ThirdFormAnimateSingularCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveSingleForm && nounRecord.gender == NG_FEMALE && nounRecord.canBeAnimate && GetLastChar(nounRecord) == L'ь';
|
return nounRecord.haveSingleForm && nounRecord.gender == NG_FEMALE && nounRecord.canBeAnimate && nounRecord.GetLastChar() == L'ь';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ThirdFormInanimatePluralCondition(const NounRecord& nounRecord)
|
bool ThirdFormInanimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.gender == NG_FEMALE && nounRecord.canBeInanimate && (
|
return nounRecord.haveMultipleForm && nounRecord.gender == NG_FEMALE && nounRecord.canBeInanimate && (
|
||||||
GetLastChar(nounRecord) == L'ь' ||
|
nounRecord.GetLastChar() == L'ь' ||
|
||||||
!nounRecord.haveSingleForm && GetLastChar(nounRecord) == L'и'
|
!nounRecord.haveSingleForm && nounRecord.GetLastChar() == L'и'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThirdFormAnimatePluralCondition(const NounRecord& nounRecord)
|
bool ThirdFormAnimatePluralCondition(const NounRecord& nounRecord)
|
||||||
{
|
{
|
||||||
return nounRecord.haveMultipleForm && nounRecord.gender == NG_FEMALE && nounRecord.canBeAnimate && (
|
return nounRecord.haveMultipleForm && nounRecord.gender == NG_FEMALE && nounRecord.canBeAnimate && (
|
||||||
GetLastChar(nounRecord) == L'ь' ||
|
nounRecord.GetLastChar() == L'ь' ||
|
||||||
!nounRecord.haveSingleForm && GetLastChar(nounRecord) == L'и'
|
!nounRecord.haveSingleForm && nounRecord.GetLastChar() == L'и'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,7 +902,7 @@ bool NounScructIsAlreadyInArray(const NounStruct& nounStruct, const std::vector<
|
|||||||
for (auto& ns : arr)
|
for (auto& ns : arr)
|
||||||
{
|
{
|
||||||
if (ns.nounGrammaticalCase == nounStruct.nounGrammaticalCase &&
|
if (ns.nounGrammaticalCase == nounStruct.nounGrammaticalCase &&
|
||||||
ns.nounRecord.nominativeForm == nounStruct.nounRecord.nominativeForm)
|
ns.nounRecord.GetWord() == nounStruct.nounRecord.GetWord())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
namespace NN
|
namespace NN
|
||||||
{
|
{
|
||||||
|
|
||||||
struct NounRecord : public TranslationUnitSetMix
|
struct NounRecord : public TranslationUnitSetMix, public WordHolder
|
||||||
{
|
{
|
||||||
std::wstring nominativeForm;
|
|
||||||
NounGender gender;
|
NounGender gender;
|
||||||
|
|
||||||
bool haveSingleForm;
|
bool haveSingleForm;
|
||||||
@ -35,13 +35,10 @@ namespace NN
|
|||||||
|
|
||||||
std::set<std::wstring> precalculatedNominativePluralSet;
|
std::set<std::wstring> precalculatedNominativePluralSet;
|
||||||
|
|
||||||
|
|
||||||
NounRecord();
|
NounRecord();
|
||||||
NounRecord(std::wstring line);
|
NounRecord(std::wstring line);
|
||||||
|
|
||||||
bool operator<(const NounRecord& n) const
|
|
||||||
{
|
|
||||||
return nominativeForm < n.nominativeForm;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum NounDeclencion
|
enum NounDeclencion
|
||||||
@ -101,24 +98,8 @@ namespace NN
|
|||||||
DC_LOST_VOWEL_E
|
DC_LOST_VOWEL_E
|
||||||
} divisionCase;
|
} divisionCase;
|
||||||
|
|
||||||
bool operator<(const NounEndingDivision& other) const
|
bool operator<(const NounEndingDivision& other) const;
|
||||||
{
|
|
||||||
if (base != other.base)
|
|
||||||
{
|
|
||||||
return base < other.base;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ending != other.ending)
|
|
||||||
{
|
|
||||||
return ending < other.ending;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return divisionCase < other.divisionCase;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<std::wstring> GetAllNounEndingArr();
|
std::vector<std::wstring> GetAllNounEndingArr();
|
||||||
@ -142,31 +123,8 @@ namespace NN
|
|||||||
bool animated;
|
bool animated;
|
||||||
NounRecord nounRecord;
|
NounRecord nounRecord;
|
||||||
|
|
||||||
bool operator<(const NounStruct& other) const
|
bool operator<(const NounStruct& other) const;
|
||||||
{
|
|
||||||
if (nounGrammaticalCase != other.nounGrammaticalCase)
|
|
||||||
{
|
|
||||||
return nounGrammaticalCase < other.nounGrammaticalCase;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (nounCount != other.nounCount)
|
|
||||||
{
|
|
||||||
return nounCount < other.nounCount;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (animated != other.animated)
|
|
||||||
{
|
|
||||||
return animated < other.animated;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return nounRecord < other.nounRecord;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -177,9 +135,6 @@ namespace NN
|
|||||||
std::set<std::wstring> GetNounNoninative(std::wstring nounBase, NounDeclencion nounDeclencion, NounCount nounCount);
|
std::set<std::wstring> GetNounNoninative(std::wstring nounBase, NounDeclencion nounDeclencion, NounCount nounCount);
|
||||||
std::wstring GetNounNoninativeSpecialPluralA(std::wstring nounBase, NounDeclencion nounDeclencion);
|
std::wstring GetNounNoninativeSpecialPluralA(std::wstring nounBase, NounDeclencion nounDeclencion);
|
||||||
|
|
||||||
wchar_t GetLastChar(const NounRecord& nounRecord);
|
|
||||||
wchar_t GetPrevLastChar(const NounRecord& nounRecord);
|
|
||||||
|
|
||||||
void SetupDeclentionMap();
|
void SetupDeclentionMap();
|
||||||
|
|
||||||
bool NounFitsDeclention(NounRecord nounRecord, NounTuple nounTuple);
|
bool NounFitsDeclention(NounRecord nounRecord, NounTuple nounTuple);
|
||||||
|
@ -23,20 +23,20 @@ namespace OT
|
|||||||
|
|
||||||
boost::split_regex(lineArr, line, boost::wregex(L" "));
|
boost::split_regex(lineArr, line, boost::wregex(L" "));
|
||||||
|
|
||||||
word = lineArr[1];
|
SetWord(lineArr[1]);
|
||||||
|
|
||||||
type = lineArr[2];
|
type = lineArr[2];
|
||||||
|
|
||||||
FillTranslationUnit(lineArr, 3);
|
FillTranslationUnit(lineArr, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::set<OtherWordRecord> RecognizeWord(std::wstring word)
|
std::set<OtherWordRecord> RecognizeWord(std::wstring word)
|
||||||
{
|
{
|
||||||
std::set<OtherWordRecord> result;
|
std::set<OtherWordRecord> result;
|
||||||
|
|
||||||
for (auto& wordRecord : OtherWordRecordArr)
|
for (auto& wordRecord : OtherWordRecordArr)
|
||||||
{
|
{
|
||||||
if (wordRecord.word == word)
|
if (wordRecord.GetWord() == word)
|
||||||
{
|
{
|
||||||
result.insert(wordRecord);
|
result.insert(wordRecord);
|
||||||
}
|
}
|
||||||
|
@ -15,27 +15,14 @@
|
|||||||
namespace OT
|
namespace OT
|
||||||
{
|
{
|
||||||
|
|
||||||
struct OtherWordRecord : public TranslationUnitSetMix
|
struct OtherWordRecord : public TranslationUnitSetMix, public WordHolder
|
||||||
{
|
{
|
||||||
std::wstring word;
|
|
||||||
std::wstring type;
|
std::wstring type;
|
||||||
|
|
||||||
OtherWordRecord();
|
OtherWordRecord();
|
||||||
|
|
||||||
OtherWordRecord(std::wstring line);
|
OtherWordRecord(std::wstring line);
|
||||||
|
|
||||||
bool operator<(const OtherWordRecord& other) const
|
|
||||||
{
|
|
||||||
if (word != other.word)
|
|
||||||
{
|
|
||||||
return word < other.word;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return type < other.type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::vector<OtherWordRecord> OtherWordRecordArr;
|
extern std::vector<OtherWordRecord> OtherWordRecordArr;
|
||||||
|
@ -28,7 +28,7 @@ namespace PP
|
|||||||
|
|
||||||
boost::split_regex(lineArr, line, boost::wregex(L" "));
|
boost::split_regex(lineArr, line, boost::wregex(L" "));
|
||||||
|
|
||||||
word = lineArr[1];
|
SetWord(lineArr[1]);
|
||||||
|
|
||||||
availableForGenitive = lineArr[2] == L"1" ? true : false;
|
availableForGenitive = lineArr[2] == L"1" ? true : false;
|
||||||
availableForDative = lineArr[3] == L"1" ? true : false;
|
availableForDative = lineArr[3] == L"1" ? true : false;
|
||||||
@ -40,14 +40,13 @@ namespace PP
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::set<PrepositionRecord> RecognizeWord(std::wstring word)
|
std::set<PrepositionRecord> RecognizeWord(std::wstring word)
|
||||||
{
|
{
|
||||||
std::set<PrepositionRecord> result;
|
std::set<PrepositionRecord> result;
|
||||||
|
|
||||||
for (auto& wordRecord : PrepositionRecordArr)
|
for (auto& wordRecord : PrepositionRecordArr)
|
||||||
{
|
{
|
||||||
if (wordRecord.word == word)
|
if (wordRecord.GetWord() == word)
|
||||||
{
|
{
|
||||||
result.insert(wordRecord);
|
result.insert(wordRecord);
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
namespace PP
|
namespace PP
|
||||||
{
|
{
|
||||||
|
|
||||||
struct PrepositionRecord : public TranslationUnitSetMix
|
struct PrepositionRecord : public TranslationUnitSetMix, public WordHolder
|
||||||
{
|
{
|
||||||
std::wstring word;
|
|
||||||
|
|
||||||
bool availableForGenitive;
|
bool availableForGenitive;
|
||||||
bool availableForDative;
|
bool availableForDative;
|
||||||
@ -29,11 +28,6 @@ namespace PP
|
|||||||
|
|
||||||
PrepositionRecord(std::wstring line);
|
PrepositionRecord(std::wstring line);
|
||||||
|
|
||||||
bool operator<(const PrepositionRecord& other) const
|
|
||||||
{
|
|
||||||
return word < other.word;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::vector<PrepositionRecord> PrepositionRecordArr;
|
extern std::vector<PrepositionRecord> PrepositionRecordArr;
|
||||||
|
@ -31,7 +31,7 @@ namespace VB
|
|||||||
|
|
||||||
boost::split_regex(lineArr, line, boost::wregex(L" "));
|
boost::split_regex(lineArr, line, boost::wregex(L" "));
|
||||||
|
|
||||||
infinitive = lineArr[1];
|
SetWord(lineArr[1]);
|
||||||
|
|
||||||
canBePrefixed = lineArr[2] == L"1" ? true : false;
|
canBePrefixed = lineArr[2] == L"1" ? true : false;
|
||||||
canBeNotPrefixed = lineArr[3] == L"1" ? true : false;
|
canBeNotPrefixed = lineArr[3] == L"1" ? true : false;
|
||||||
@ -43,7 +43,24 @@ namespace VB
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VerbStruct::operator<(const VerbStruct& v) const
|
||||||
|
{
|
||||||
|
if (verbParams != v.verbParams)
|
||||||
|
{
|
||||||
|
return verbParams < v.verbParams;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (selfEnding != v.selfEnding)
|
||||||
|
{
|
||||||
|
return selfEnding < v.selfEnding;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return verbRecord < v.verbRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VerbParams WStringToVerbParams(std::wstring str)
|
VerbParams WStringToVerbParams(std::wstring str)
|
||||||
{
|
{
|
||||||
@ -195,7 +212,7 @@ namespace VB
|
|||||||
{
|
{
|
||||||
for (auto& verb : VerbRecordArr)
|
for (auto& verb : VerbRecordArr)
|
||||||
{
|
{
|
||||||
if (verb.infinitive == verbInfinitive)
|
if (verb.GetWord() == verbInfinitive)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -208,7 +225,7 @@ namespace VB
|
|||||||
{
|
{
|
||||||
for (auto& verb : VerbRecordArr)
|
for (auto& verb : VerbRecordArr)
|
||||||
{
|
{
|
||||||
if (verb.infinitive == verbInfinitive)
|
if (verb.GetWord() == verbInfinitive)
|
||||||
{
|
{
|
||||||
return verb;
|
return verb;
|
||||||
}
|
}
|
||||||
@ -303,6 +320,18 @@ namespace VB
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VerbEndingDivision::operator<(const VerbEndingDivision& other) const
|
||||||
|
{
|
||||||
|
if (base != other.base)
|
||||||
|
{
|
||||||
|
return base < other.base;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ending < other.ending;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::set<VerbEndingDivision> getPossibleVerbEndingDivisionSet(std::wstring verb)
|
std::set<VerbEndingDivision> getPossibleVerbEndingDivisionSet(std::wstring verb)
|
||||||
{
|
{
|
||||||
std::set<VerbEndingDivision> result;
|
std::set<VerbEndingDivision> result;
|
||||||
|
@ -13,9 +13,8 @@
|
|||||||
|
|
||||||
namespace VB
|
namespace VB
|
||||||
{
|
{
|
||||||
struct VerbRecord : public TranslationUnitSetMix
|
struct VerbRecord : public TranslationUnitSetMix, public WordHolder
|
||||||
{
|
{
|
||||||
std::wstring infinitive;
|
|
||||||
bool canBePrefixed;
|
bool canBePrefixed;
|
||||||
bool canBeNotPrefixed;
|
bool canBeNotPrefixed;
|
||||||
bool canBePerfect;
|
bool canBePerfect;
|
||||||
@ -25,11 +24,6 @@ namespace VB
|
|||||||
|
|
||||||
VerbRecord(std::wstring line);
|
VerbRecord(std::wstring line);
|
||||||
|
|
||||||
bool operator<(const VerbRecord& v) const
|
|
||||||
{
|
|
||||||
return infinitive < v.infinitive;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -90,24 +84,8 @@ namespace VB
|
|||||||
VerbRecord verbRecord;
|
VerbRecord verbRecord;
|
||||||
|
|
||||||
|
|
||||||
bool operator<(const VerbStruct& v) const
|
bool operator<(const VerbStruct& v) const;
|
||||||
{
|
|
||||||
if (verbParams != v.verbParams)
|
|
||||||
{
|
|
||||||
return verbParams < v.verbParams;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (selfEnding != v.selfEnding)
|
|
||||||
{
|
|
||||||
return selfEnding < v.selfEnding;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return verbRecord < v.verbRecord;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -128,17 +106,7 @@ namespace VB
|
|||||||
std::wstring base;
|
std::wstring base;
|
||||||
std::wstring ending;
|
std::wstring ending;
|
||||||
|
|
||||||
bool operator<(const VerbEndingDivision& other) const
|
bool operator<(const VerbEndingDivision& other) const;
|
||||||
{
|
|
||||||
if (base != other.base)
|
|
||||||
{
|
|
||||||
return base < other.base;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ending < other.ending;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user