AFAIK, Marathi uses same script as Hindi. In that you can't easily tell which language is used.
Easier way to detect language if your text is written using Unicode is by checking the character range. If the character range is in between the range for Hindi, you can assume it is Hindi. But you need to scan till the end and if all the characters are in Hindi, the word is written in Hindi. Your algorithm should also consider zero-width joiner and non joiners (ZWJ & ZWNJ) while scanning the input. I have done an implementation of language detection. You can find code here[^]. It is written in C but the concepts are same for any language.
Last Visit: 31-Dec-99 19:00 Last Update: 27-Jan-15 1:03