alphacep / alphacep/vosk-api

Accent Problem result "FTVoskRecognizer.GetResult" in French compilation Delphi11.2 for Android

Đang mở
#1,755 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Jupyter Notebook
Star
15.1k
Fork
1.8k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hello,
On Windows 11/Delphi 11.2/Android12 , I have an accent problem when returning pansichar from "FTVoskRecognizer.GetResult" in French: ("é"="A@", "ç"="ç", etc....).
(with arm64-v8a/libvosk.so V0.3.45)
On raspi5/Debian12 and Windows11, there's no problem.
I can't find a solution (problem ansi,utf8,unicode, but in the library.so, in my program ?).
Do you have any ideas?
Thanks.

Unit vosk_apiandroid.pas:
`....
const CST_vosk_recognizer_result_nom='vosk_recognizer_result';
var vosk_recognizer_result_lib : function(recognizer: PVoskRecognizer): PAnsiChar; cdecl;
function vosk_recognizer_result(recognizer: PVoskRecognizer): PAnsiChar;
...`
`function vosk_recognizer_result(recognizer: PVoskRecognizer): PAnsiChar;
begin
result:=nil;
@vosk_recognizer_result_lib := GetProcAddress(SOHandle_vosk, PWideChar(CST_vosk_recognizer_result_nom)); // using Posix function: dlsym(....), dladdr(...)...
if Assigned(vosk_recognizer_result_lib) then
begin
result:=vosk_recognizer_result_lib(recognizer);
end
else raise exception.create('vosk_apiandroid: fonction "'+CST_vosk_recognizer_result_nom+'" non assignee');
end;
.....`

Unit voskRecognizer.pas:
`function TVoskRecognizer.GetResult(): PansiChar;
begin
Result := vosk_recognizer_result(FRecognizer);
end;`

unit Mainform:
`procedure Tform1.For_WaveJaudio_Loopexec(Vtab:TSmallIntDynArray;vTabCount:integer);//tbytes;vTabCount:integer);
var Vfinal:integer;
VTexte:Ansistring;
VPHRASETMP:string;
begin
if FTVoskRecognizer=nil
then for_message('For_WaveJaudio_Loopexec:FTVoskRecognizer=nil')
else begin
//for_message('For_WaveJaudio_Loopexec:vTabCount='+inttostr(vTabCount));
Vfinal := FTVoskRecognizer.AcceptWaveform(PSmallInt(Vtab), vTabCount);//AudioArray.length);//length(LBuffer));
case Vfinal of
1 :begin
for_message('For_WaveJaudio_Loopexec:éteindre, ça va général fil à la patte'); //<=View screen accents OK!
vtexte:=FTVoskRecognizer.GetResult;
for_message('For_WaveJaudio_Loopexec:vtext avt accents="'+vtexte+'"'); //Errors accents problem
vtexte:=String_sansaccents(vtexte);
for_message('For_WaveJaudio_Loopexec:vtext APRES accents="'+vtexte+'"');
VPHRASETMP:=Json_parserExtract_text(vtexte);
if VPHRASETMP<>'' then
begin
if FPhraseDetect=''
then FPhraseDetect:=VPHRASETMP
else FPhraseDetect:=FPhraseDetect+' '+VPHRASETMP;
if FInputmic_verbose
then for_message_verbose(FInputmic_verbose,'PHRASE ENCOURS="'+FPhraseDetect+'"','');
else begin
if FinputMic_avecTTSEcran
then for_message('PHRASE ENCOURS="'+FPhraseDetect+'"');
end;
For_Phrase_traiterStr(false);//TRUE);
end;
end;
0 :begin
//vtexte:=Json_parserExtract(FTVoskRecognizer.GetPartialResult,'partial_result');
vtexte:=FTVoskRecognizer.GetPartialResult;
for_message_verbose(FInputMIC_verbose,vtexte,'');
end;
-1 :for_message('exception vosk_recognizer_accept_waveform');
end;
end;
end;`

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.