Решение проблемы с девнагари данда (দাঁড়ি)

Я разрабатываю проблему, которая сможет преобразовать строки unicode(бенгальский) в слова. Он хранит строки на основе разделителей, таких как ',', '?' и т. д. Но проблема в том, что моя программа работает для любого другого бангла-символа, кроме «।» (Девнагари данда). Что я могу сделать, чтобы решить эту проблему? Код приведен ниже:

      #include <codecvt>
#include <locale>
#include <fcntl.h>
#include<uchar.h>
using namespace std;

bool isDari(wchar_t c)
{
    //std::locale::global(std::locale(""));
    wchar_t ch = L'\u0964';
    if (c == ch)
    return 1;
return 0;
}

bool isPunctuation(wchar_t c)
{
    //std::locale::global(std::locale(""));
    if(isDari(c))
        return 1;
    else if(c == L' ')
        return 1; 
    else if (c ==  L'\r' || c ==  L'\n')
        return 1;
    else if (c == L',')
        return 1;
    else if (c == L'?')
        return 1;    
return 0;
}

void tokeniser(vector<wstring> s)
{

    //std::locale::global(std::locale(""));
    wstring str,temp=L"";
    wfstream f1,f2;
    /*f1.imbue(utf16_locale);
    f2.imbue(utf16_locale);
    _setmode(_fileno(stdout), _O_U16TEXT);*/
   
    f1.open("read.txt");
    f2.open("write.txt");

    if(!f1 || !f2)
        cout << "File not found!" << endl;
    else
    {
        while(getline(f1,str))
        {
            //getline(f1,str);
            int j=0;
            for(int i=0;i<str.size();i++)
                {
                    if(isPunctuation(str[i]))
                    {
                    if(temp.size()>0)
                        {
                            s.push_back(temp);
                            temp = L"";
                        }
                    }
                    else
                    {
                    temp.push_back(str[i]);
                //cout << "Found delimeter\n";
                    }
                }
            s.push_back(temp);
        }
        
    for(int i=0;i<s.size();i++)
    f2 << s[i] << endl;
    }
}

int main()
{
    std::vector<wstring> store;
    tokeniser(store);
}

Возможно, стоит упомянуть, что мой код показывает эту проблему на vscode, где я использую windows-gcc-x64, c++ 17, но отлично работает на onlinegdb.

0 ответов

Другие вопросы по тегам