2008/9/29 shahrzad khorrami [EMAIL PROTECTED]:
hi all,
is there any function to return us the lanuage of a word in the sentence?
for example : My name is شهرزاد .
when it sees شهرزاد notice that is a persian language.
As others have said, you can check what unicode block the characters are from.
For segments of text that are a little longer (one or two sentences),
you can use n-gram based language identification, which can sometimes
be spookily accurate. If you want to give that a go, there's a Pear
package called Text::LanguageDetect which will do that
[http://pear.php.net/package/Text_LanguageDetect]. It doesn't have
trigrams for Persian in the lang.dat, but I don't imagine it would be
too hard to add them, if that's what you need.
-robin