|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectscone.util.LanguageAnalyzer
public class LanguageAnalyzer
tries to find out the language of a list of words.
Currently supports, English, German and Spanish.
example:
la=new LanguageAnalyzer();
la.countWord("My");
la.countWord("name");
la.countWord("is");
la.countWord("Volkert");
System.out.println(la.getLanguage()); //will print "en"
| Constructor Summary | |
|---|---|
LanguageAnalyzer()
creates a new LanguageAnalyzer |
|
| Method Summary | |
|---|---|
void |
countWord(java.lang.String word)
counts how many times a word occurs |
java.lang.String |
getLanguage()
returns the language which had the most hits |
static void |
main(java.lang.String[] args)
test - method |
void |
putLang(java.lang.String lang,
java.lang.String key)
adds a new keyword to a language. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LanguageAnalyzer()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
public void putLang(java.lang.String lang,
java.lang.String key)
No keyword may belong to more than one language!
This class is optimized for short keywords.
lang - the languagekey - the keyword, case insensitive.public void countWord(java.lang.String word)
word - the word to countpublic java.lang.String getLanguage()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||