function fullW = convertHalf2Full(word)
idx1 = hex2dec('FF61') < double(word);
idx2 = (double(word) < hex2dec('FFA0'));
idx = idx1 & idx2;
word(idx) = half2full_Katakana( word(idx) );
word = erase(word, "゛");
word = erase(word, "゜");
idx1 = hex2dec('FF01') < double(word);
idx2 = (double(word) < hex2dec('FF5F'));
idx = idx1 & idx2;
word(idx) = full2half_EN( word(idx) );
fullW = word;
end
function halfW = full2half_EN(fullW)
halfW = char(fullW - 65248);
end
function fullW = half2full_Katakana(halfW)
filename = 'KatakanaFullHalf.xlsx';
Katakana = importKatakanaFile(filename);
for i=1:length(halfW)
idx = contains(Katakana.Half, halfW(i));
halfW(i) = Katakana.Full(idx);
end
idx_daku = findstr(halfW, "゛");
idx_handaku = findstr(halfW, "゜");
halfW(idx_daku-1) = char( double( halfW(idx_daku-1) ) +1 );
halfW(idx_handaku-1) = char( double( halfW(idx_handaku-1) ) +2 );
fullW = halfW;
end
>> a = '私はタマゴとMILKとスムージーとプリンを朝ごはんに食べる.1234';
>> fullW = convertHalf2Full(a)
fullW =
'私はタマゴとMILKとスムージーとプリンを朝ごはんに食べる.1234'