$language.detect Tries to detect the language and encoding of a string |
Usage |
<hash> language.detect(<text: string>) |
Description |
Tries to detect the language and encoding of the string specified
as [text]. The accuracy of the detection mainly depends on the length
of the supplied text. Good results can be achieved with some thousands
characters. This command is exported by the language module. |
Examples |
%dati = $language.detect("I'm a lord and I speak perfect English."); if(%dati{"error"} != "")echo "Language detection failed: " %dati{"error"}; %count = %dati{"matchcount"}; for(%i=0;%i<%count;%i++) { echo "LANGUAGE " %i " : " %dati{"matches"}[%i]{"language"}; echo "ENCODING " %i " : " %dati{"matches"}[%i]{"encoding"}; echo "SCORE " %i " : "%dati{"matches"}[%i]{"score"}; } echo "ACCURACY: " %dati{"accuracy"}; |