129 lines
2.2 KiB
C++
129 lines
2.2 KiB
C++
#include "grammarCase.h"
|
|
|
|
#include <iostream>
|
|
|
|
NounCount WStringToNounCount(std::wstring str)
|
|
{
|
|
if (str == L"NC_SINGULAR")
|
|
{
|
|
return NC_SINGULAR;
|
|
}
|
|
if (str == L"NC_PLURAL")
|
|
{
|
|
return NC_PLURAL;
|
|
}
|
|
|
|
std::cout << "Error in WStringToNounCount!" << std::endl;
|
|
return NC_SINGULAR;
|
|
}
|
|
|
|
std::wstring NounCountToWString(NounCount nounCount)
|
|
{
|
|
if (nounCount == NC_SINGULAR)
|
|
{
|
|
return L"NC_SINGULAR";
|
|
}
|
|
if (nounCount == NC_PLURAL)
|
|
{
|
|
return L"NC_PLURAL";
|
|
}
|
|
|
|
std::cout << "Error in NounCountToWString!" << std::endl;
|
|
return L"";
|
|
}
|
|
|
|
|
|
std::wstring NounGrammaticalCaseToWString(NounGrammaticalCase nounGrammaticalCase)
|
|
{
|
|
switch (nounGrammaticalCase)
|
|
{
|
|
case NGC_P1_NOMINATIVE: return L"NGC_P1_NOMINATIVE";
|
|
case NGC_P2_GENITIVE: return L"NGC_P2_GENITIVE";
|
|
case NGC_P3_DATIVE: return L"NGC_P3_DATIVE";
|
|
case NGC_P4_ACCUSATIVE: return L"NGC_P4_ACCUSATIVE";
|
|
case NGC_P5_INSTRUMENTAL: return L"NGC_P5_INSTRUMENTAL";
|
|
case NGC_P6_PREPOSITIONAL: return L"NGC_P6_PREPOSITIONAL";
|
|
}
|
|
|
|
return L"";
|
|
}
|
|
|
|
NounGrammaticalCase WStringToNounGrammaticalCase(std::wstring str)
|
|
{
|
|
|
|
if (str == L"NGC_P1_NOMINATIVE")
|
|
{
|
|
return NGC_P1_NOMINATIVE;
|
|
}
|
|
if (str == L"NGC_P2_GENITIVE")
|
|
{
|
|
return NGC_P2_GENITIVE;
|
|
}
|
|
if (str == L"NGC_P3_DATIVE")
|
|
{
|
|
return NGC_P3_DATIVE;
|
|
}
|
|
if (str == L"NGC_P4_ACCUSATIVE")
|
|
{
|
|
return NGC_P4_ACCUSATIVE;
|
|
}
|
|
if (str == L"NGC_P5_INSTRUMENTAL")
|
|
{
|
|
return NGC_P5_INSTRUMENTAL;
|
|
}
|
|
if (str == L"NGC_P6_PREPOSITIONAL")
|
|
{
|
|
return NGC_P6_PREPOSITIONAL;
|
|
}
|
|
|
|
std::cout << "Error in WStringToNounGrammaticalCase!" << std::endl;
|
|
return NGC_P1_NOMINATIVE;
|
|
}
|
|
|
|
|
|
|
|
|
|
bool charIsConsolant(wchar_t c) //except é
|
|
{
|
|
std::wstring consolants = L"öêíãøùçõôâïðëäæ÷ñìòá";
|
|
|
|
for (wchar_t ic : consolants)
|
|
{
|
|
if (c == ic)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
bool charIsVowel(wchar_t c)
|
|
{
|
|
std::wstring vovels = L"àîóûýÿ¸þèå";
|
|
|
|
for (wchar_t ic : vovels)
|
|
{
|
|
if (c == ic)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
std::wstring i_form_consolants = L"ãõêæø÷ù";
|
|
std::wstring u_form_consolants = L"áïäòâôçñíìëðö";
|
|
|
|
bool charIsIFormConsolant(wchar_t c)
|
|
{
|
|
return i_form_consolants.find(c) != i_form_consolants.npos;
|
|
}
|
|
|
|
bool charIsUFormConsolant(wchar_t c)
|
|
{
|
|
return u_form_consolants.find(c) != i_form_consolants.npos;
|
|
}
|