How to get a list of synonyms for a given sense?

44 views
Skip to first unread message

Tristan Miller

unread,
Apr 19, 2012, 11:31:55 AM4/19/12
to uby-...@googlegroups.com
Dear all,

I need to write a method which returns all the synonym lemma forms for an
arbitrary sense. As I understand it, there are two ways synonymy can be
encoded for Uby senses:

1. If the Sense is part of a Synset, you can find all the Sense's synonyms
implicitly by calling getSenses() on its parent Synset.

2. The Sense may have explicitly stored synonym relations which can be
found by calling getSenseRelations() on the Sense.

So with this in mind I wrote the following:

public static Set<String> getSynonymLemmas(Sense sense)
{
Set<String> synonyms = new HashSet<String>();

// First thing to check: Are we part of a synset? If so, we can
// find the synonyms through the synset.
Synset synset = sense.getSynset();
if (synset != null) {
for (Sense s : synset.getSenses()) {
synonyms.add(s.getLexicalEntry().getLemmaForm());
}
}

// Second thing to check: See if we have any sense relations of type
// "SYNONYM":
for (SenseRelation senseRelation : sense.getSenseRelations()) {
if (senseRelation.getRelName().equals("SYNONYM")
&& senseRelation.getTargetFormRepresentation() != null) {
synonyms.add(senseRelation.getTargetFormRepresentation()
.getWrittenForm());
}
}

return synonyms;
}

My question is whether the part of the method labelled "Second thing to
check" -- and specifically the test on getRelName() -- is correct. That
is, is it guaranteed that for all SenseRelations from all lexical resources
which provide sense relations, the value of getRelName() will be "SYNONYM"
if and only if the sense relation is synonymy? Is there a master list of
relation names I should be referring to?

Regards,
Tristan

--
Tristan Miller, Doctoral Researcher | Tel: +49 6151 16 6166
Ubiquitous Knowledge Processing Lab | Fax: +49 6151 16 5455
Department of Computer Science | mil...@ukp.informatik.tu-darmstadt.de
Technische Universität Darmstadt | http://www.ukp.tu-darmstadt.de/

signature.asc

Michael Matuschek

unread,
Apr 20, 2012, 5:41:36 AM4/20/12
to uby-...@googlegroups.com
Hi Tristan,

unfortunately, there is no "master list" for relation names I could refer you to. As the different resources have many different ways of using relations, we are currently just using Strings. We have discussed using an Enum or something like that, but we haven't quite figured out what is the best way to do it. But you're right that we should have a list to be checked somewhere.

For your synonym problem, using the Synset is indeed the way to go if it exists - which is the case for WordNet and OmegaWiki. The "SYNONYM" relation is currently only used for the Wiktionaries.

To demonstrate what is our problem here: Wikipedia redirects are also "kind of synonyms" but not quite. They have their own relation type "redirect", and if you consider them useful for your scenario, you have to query for them explicitly.

Hope that helps, and thanks for keeping us on our toes,

Michael
Reply all
Reply to author
Forward
0 new messages