Search in sources :

Example 1 with WordSim

use of edu.illinois.cs.cogcomp.sim.WordSim in project cogcomp-nlp by CogComp.

the class WordSimTest method testParagram.

@Test
public void testParagram() throws Exception {
    WordSim ws = new WordSim(rm_, "paragram");
    MetricResponse m1 = ws.compare("word", "sentence", "paragram");
    MetricResponse m2 = ws.compare("word", "wife", "paragram");
    assertTrue(m1.score > m2.score);
}
Also used : WordSim(edu.illinois.cs.cogcomp.sim.WordSim) MetricResponse(edu.illinois.cs.cogcomp.sim.MetricResponse) Test(org.junit.Test)

Example 2 with WordSim

use of edu.illinois.cs.cogcomp.sim.WordSim in project cogcomp-nlp by CogComp.

the class WordSimTest method testWordNet.

@Test
public void testWordNet() {
    WordSim ws = new WordSim(rm_, "wordnet");
    MetricResponse m1 = ws.compare("word", "sentence", "wordnet");
    MetricResponse m2 = ws.compare("word", "wife", "wordnet");
    assertTrue(m1.score > m2.score);
}
Also used : WordSim(edu.illinois.cs.cogcomp.sim.WordSim) MetricResponse(edu.illinois.cs.cogcomp.sim.MetricResponse) Test(org.junit.Test)

Example 3 with WordSim

use of edu.illinois.cs.cogcomp.sim.WordSim in project cogcomp-nlp by CogComp.

the class WordComparator method configure.

/**
 * reads parameters from configuration file named by m_propertiesFile loads
 * stopwords, sets xmlrpc client if appropriate
 *
 * @throws IllegalArgumentException
 * @throws IOException
 */
protected void configure(ResourceManager rm_) throws IllegalArgumentException, IOException {
    // boolean useWordSim = rm_.getBoolean(Constants.USE_WORDSIM); // if
    // false, use WNSim (older
    // package)
    entailmentThreshold = rm_.getDouble(SimConfigurator.WORD_ENTAILMENT_THRESHOLD.key);
    computeSimpleScore = rm_.getBoolean(SimConfigurator.USE_SIMPLE_SCORE.key);
    String wordComparator = rm_.getString(SimConfigurator.WORD_METRIC);
    wordSim = new WordSim(rm_, wordComparator);
}
Also used : WordSim(edu.illinois.cs.cogcomp.sim.WordSim)

Aggregations

WordSim (edu.illinois.cs.cogcomp.sim.WordSim)3 MetricResponse (edu.illinois.cs.cogcomp.sim.MetricResponse)2 Test (org.junit.Test)2