@Test(groups = "emnlp2013")
public void unary() throws IOException {
UnaryLexicon.opts.unaryLexiconFilePath =
"lib/fb_data/6/unaryInfoStringAndAlignment.txt";
UnaryLexicon unary = new UnaryLexicon();
boolean existsAlignment = false, existsStringMatch=false;
double popularity=0.0;
double intersection=0.0;
List<UnaryLexicalEntry> entries = unary.lookupEntries("continent");
LogInfo.logs("Num of entries: %s",entries.size());
for(UnaryLexicalEntry entry: entries) {
if(entry.formula.toString().equals("(fb:type.object.type fb:location.continent)")) {
if(entry.source==EntrySource.ALIGNMENT) {
existsAlignment=true;
intersection = entry.alignmentScores.get(UnaryLexicon.INTERSECTION);
}
else if(entry.source==EntrySource.STRING_MATCH) {
existsStringMatch=true;
popularity = entry.popularity;
}
}
}
assertEquals(true,existsAlignment);
assertEquals(true,existsStringMatch);
assertEquals(7.0, popularity, 0.0001);
assertEquals(5.0, intersection, 0.0001);
existsAlignment = false;
existsStringMatch=false;
popularity=0.0;
intersection=0.0;
entries = unary.lookupEntries("lawyer");
for(UnaryLexicalEntry entry: entries) {
if(entry.formula.toString().equals("(fb:people.person.profession fb:en.attorney)")) {
if(entry.source==EntrySource.ALIGNMENT) {
existsAlignment=true;
intersection = entry.alignmentScores.get(UnaryLexicon.INTERSECTION);