how to determine what language a c# string is written in? is there any C# method to take a string an

  • Thread starter Thread starter DR
  • Start date Start date
D

DR

how to determine what language a c# string is written in? is there any C#
method to take a string and return what language it is in? e.g. english,
hindi, spanish, etc.
 
how to determine what language a c# string is written in? is there any C#
method to take a string and return what language it is in? e.g. english,
hindi, spanish, etc.

There is nothing standard in C#, .NET, Win32, whatever.

And there is no 100% reliable method to do that.
In what language is "chat"? Is is English, or French (cat)?
The longer the text, the better the chances, but nothing can be 100%
reliable.


But there are some decent statistical methods.

Here are some links (or Google for language identification algorithm):
http://people.csail.mit.edu/hazen//publications/masters_thesis.pdf
http://complingone.georgetown.edu/~langid/acq_info.html
http://search.cpan.org/dist/Text-Language-Guess/
 
I think he was asking about the run-time langauge and not 'speaking
language'. If that's the case, OP can get the current culture and language
from the thread of execution. That would work for local applications. If the
string is remoted from another appdomain, you can find the executing thread
as well.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
 
Alvin Bruney said:
I think he was asking about the run-time langauge and not 'speaking
language'. If that's the case, OP can get the current culture and language
from the thread of execution. That would work for local applications. If
the string is remoted from another appdomain, you can find the executing
thread as well.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------





The last sentence in the OP leads me, as well as Mihal, to believe that the
OP'er is asking about spoken language (where the e.g. part is 'english,
hindi, spanish, etc.').

:)

Mythran
 
Back
Top