scone.util
Class LanguageAnalyzer

java.lang.Object
  extended by scone.util.LanguageAnalyzer

public class LanguageAnalyzer
extends java.lang.Object

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

LanguageAnalyzer

public LanguageAnalyzer()
creates a new LanguageAnalyzer

Method Detail

main

public static void main(java.lang.String[] args)
test - method


putLang

public void putLang(java.lang.String lang,
                    java.lang.String key)
adds a new keyword to a language.
Adds the language if it is new.

No keyword may belong to more than one language!
This class is optimized for short keywords.

Parameters:
lang - the language
key - the keyword, case insensitive.

countWord

public void countWord(java.lang.String word)
counts how many times a word occurs

Parameters:
word - the word to count

getLanguage

public java.lang.String getLanguage()
returns the language which had the most hits

Returns:
the language