001: package net.sf.crispy.sample.wortschatz;
002:
003: import java.util.List;
004: import java.util.Properties;
005:
006: import net.sf.crispy.IServiceManager;
007: import net.sf.crispy.Property;
008: import net.sf.crispy.interceptor.StopWatchInterceptor;
009: import net.sf.crispy.sample.wortschatz.service.Frequencies;
010: import net.sf.crispy.sample.wortschatz.service.Sentences;
011: import net.sf.crispy.sample.wortschatz.service.Similarity;
012: import net.sf.crispy.sample.wortschatz.service.Synonyms;
013: import net.sf.crispy.sample.wortschatz.service.Thesaurus;
014: import net.sf.crispy.sample.wortschatz.service.Wordforms;
015:
016: public class Run {
017:
018: public static void main(String[] args) {
019:
020: Properties prop = new Properties();
021: prop.put(Property.INTERCEPTOR_CLASS, StopWatchInterceptor.class
022: .getName());
023:
024: IServiceManager manager = new WortschatzServiceManager(prop);
025: StopWatchInterceptor stopWatch = (StopWatchInterceptor) manager
026: .getInterceptorByPos(0);
027:
028: Thesaurus thesaurus = (Thesaurus) manager
029: .createService(Thesaurus.class);
030: System.out.println("PING: " + thesaurus.ping());
031:
032: List lvResultList = thesaurus.execute("frei", 5)
033: .getResultList();
034: System.out.println("- Thesaurus -");
035: System.out.println(lvResultList);
036: System.out.println("StopTime: "
037: + stopWatch.getStopTimeInvokeMethod() + "\n");
038:
039: Wordforms wordform = (Wordforms) manager
040: .createService(Wordforms.class);
041: System.out.println("- Wordforms -");
042: System.out.println(wordform.execute("leer", 2).getResultList());
043: System.out.println("StopTime: "
044: + stopWatch.getStopTimeInvokeMethod() + "\n");
045:
046: Similarity similarity = (Similarity) manager
047: .createService(Similarity.class);
048: System.out.println("- Similarity -");
049: System.out.println(similarity.execute("leer", 2)
050: .getResultList());
051: System.out.println("StopTime: "
052: + stopWatch.getStopTimeInvokeMethod() + "\n");
053:
054: Sentences sentences = (Sentences) manager
055: .createService(Sentences.class);
056: System.out.println("- Sentences -");
057: System.out
058: .println(sentences.execute("leer", 2).getResultList());
059: System.out.println("StopTime: "
060: + stopWatch.getStopTimeInvokeMethod() + "\n");
061:
062: Frequencies frequencies = (Frequencies) manager
063: .createService(Frequencies.class);
064: System.out.println("- Frequencies -");
065: System.out.println(frequencies.execute("leer").getResultList());
066: System.out.println("StopTime: "
067: + stopWatch.getStopTimeInvokeMethod() + "\n");
068:
069: Synonyms synonyms = (Synonyms) manager
070: .createService(Synonyms.class);
071: System.out.println("- Synonyms -");
072: System.out.println(synonyms.execute("leer", 2).getResultList());
073: System.out.println("StopTime: "
074: + stopWatch.getStopTimeInvokeMethod() + "\n");
075: }
076: /*
077: PING: Webservice "Thesaurus" is ready.
078: - Thesaurus -
079: 0 frei
080: 1 leer
081: 2 brach
082: 3 trinken
083: 4 leeren
084: StopTime: 191
085:
086: - Wordforms -
087: 0 leer
088: 1 leeren
089: StopTime: 191
090:
091: - Synonyms -
092: 0 blanko
093: 1 leer
094: StopTime: 191
095:
096:
097:
098: - Similarity -
099: 0 leer unbewohnt 12
100: 1 leer in Flammen 11
101: StopTime: 191
102:
103: - Sentences -
104: 0 40676325 Die Flieger fliegen, aber sie sind halb leer.
105: 1 40676322 Er sagt, es sei noch nie so leer gewesen.
106: StopTime: 191
107:
108: - Frequencies -
109: 0 18865 10
110: StopTime: 191
111:
112: */
113: }
|