--
You received this message because you are subscribed to the Google Groups "HyperGraphDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hypergraphdb...@googlegroups.com.
To post to this group, send email to hyperg...@googlegroups.com.
Visit this group at https://groups.google.com/group/hypergraphdb.
For more options, visit https://groups.google.com/d/optout.
Dear Boris ,
public double getJiangConrathSimilarity(HGHandle s1, HGHandle s2)
{
Set<HGHandle> lcsSet = getAllLeastCommonSubsumers(s1, s2);
double ics = 0.0;
for (HGHandle h : lcsSet)
ics = Math.max(ics, getInformationContent(h));
return 1.0 -(getInformationContent(s1) + getInformationContent(s2) - 2.0*ics)/2.0;
}
On Oct 29, 2017, at 1:04 PM, Mohanad abu baker <mohan...@gmail.com> wrote:
The problem is how to get a handle for an atom. Lets say I want to compare the similarity for two words from WordNet Db, and I loaded the WordNet Using HyperGraphDB.
String wordnetDB = "c:/hypergraphdb1";
HyperGraph graph = HGEnvironment.get(wordnetDB);
WNGraph wngraph = new WNGraph(graph);
HGHandle flagLemma = wngraph.findWord("flag");
HGHandle swagLemma = wngraph.findWord("swag");
double h;
SemTools x = new SemTools(graph);
h= x.getJiangConrathSimilarity(flagLemma, swagLemma);
The error is :
Exception in thread "main" java.lang.ClassCastException: org.hypergraphdb.app.wordnet.data.Word cannot be cast to org.hypergraphdb.app.wordnet.data.SynsetLink
at org.hypergraphdb.app.wordnet.SemTools.getInformationContent(SemTools.java:121)
at org.hypergraphdb.app.wordnet.SemTools.getJiangConrathSimilarity(SemTools.java:429)
at org.hypergraphdb.app.wordnet.conrathtest.main(conrathtest.java:41)
Regards,
WNGraph wngraph = new WNGraph(graph);
HGHandle LoveLemma = wngraph.findWord("love");
HGHandle RomanceLemma = wngraph.findWord("Romance");
String LoveVar= graph.get(LoveLemma).toString();
String RomanceVar= graph.get(RomanceLemma).toString();
List<HGHandle> syn = wngraph.getNounSenses(LoveLemma);
List<HGHandle> syn2 = wngraph.getNounSenses(RomanceLemma);
double SimilarityMeasure;
SemTools SemObject = new SemTools(graph);
SimilarityMeasure= SemObject.getJiangConrathSimilarity(syn.get(0), (syn2.get(0)));
System.out.println(h);
I get Similarity Result. But I want to ask you is this code ok?
Is there any other code is better than this code to get getJiangConrathSimilarity measure? If Yes please write it here.
Regards,
Muhanad
String wordnetDB = "c:/hypergraphdb1";
HyperGraph graph = HGEnvironment.get(wordnetDB);
WNGraph wngraph = new WNGraph(graph);
HGHandle synset1 = wngraph.findWord("calendar");
HGHandle synset2 = wngraph.findWord("transpose");
List<HGHandle> syn1 = wngraph.getNounSenses(synset1);
List<HGHandle> syn2 = wngraph.getNounSenses(synset2);
SemTools SemInstance= new SemTools(graph);
Set<HGHandle> Root= SemInstance.getAllLeastCommonSubsumers(syn1.get(1),syn2.get(1));
for(HGHandle r: Root)
System.out.println(graph.get(r));
The above code, it will return one parent because we specify one synset for table and one synset for array.
How can we send all the handles for the synset "table" and also the synset "array" to return the closet parents?
Regards,
Muhanad