private RelationalList AddRelatives(Index idx, int rel1, int rel2, RelationalList rellist) { /* If either of the new relatives are already in a relative group, * then add the other to the existing group (transitivity). * Otherwise create a new group and add these 2 senses to it. */ RelationalList rel, last = null; for (rel = rellist; rel != null; rel = rel.next) { if (rel.senses[rel1] || rel.senses[rel2]) { rel.senses[rel1] = rel.senses[rel2] = true; /* If part of another relative group, merge the groups */ for (RelationalList r = rellist; r != null; r = r.next) { if (r != rel && r.senses[rel1] || r.senses[rel2]) { rel.senses = rel.senses.Or(r.senses); } } return(rellist); } last = rel; } rel = new RelationalList(); rel.senses[rel1] = rel.senses[rel2] = true; if (rellist == null) { return(rel); } last.next = rel; return(rellist); }
private RelationalList FindVerbGroups(Index idx, RelationalList rellist) { int i, j, k; /* Read all senses */ for (i = 0; i < idx.offs.Length; i++) { SynonymSet synset = new SynonymSet(idx.offs[i], pos, idx.wd, this, i, netData); /* Look for VERBGROUP ptr(s) for this sense. If found, * create group for senses, or add to existing group. */ for (j = 0; j < synset.ptrs.Length; j++) { Pointer p = synset.ptrs[j]; if (p.ptp.Mnemonic == "VERBGROUP") { /* Need to find sense number for ptr offset */ for (k = 0; k < idx.offs.Length; k++) { if (p.off == idx.offs[k]) { rellist = AddRelatives(idx, i, k, rellist); break; } } } } } return(rellist); }
// TDMS - relatives - synonyms of verb - grouped by similarity of meaning private void Relatives(Index idx) { RelationalList rellist = null; switch (pos.Key) { case "verb": rellist = FindVerbGroups(idx, rellist); DoRelList(idx, rellist); break; } }
private void DoRelList(Index idx, RelationalList rellist) { int i; bool flag; SynonymSet synptr; BitSet outsenses = new BitSet(300); prflag = true; for (RelationalList rel = rellist; rel != null; rel = rel.next) { flag = false; for (i = 0; i < idx.offs.Length; i++) { if (rel.senses[i] && !outsenses[i]) { flag = true; synptr = new SynonymSet(idx.offs[i], pos, "", this, i, netData); synptr.Strsns(i + 1); synptr.TracePtrs(PointerType.Of("HYPERPTR"), pos, 0); synptr.frames.Clear(); // TDMS 03 Jul 2006 - frames get added in wordnet.cs after filtering // TDMS 11 Oct 2005 - build hierarchical results senses.Add(synptr); outsenses[i] = true; } } if (flag) { buf += "--------------\n"; } } for (i = 0; i < idx.offs.Length; i++) { if (!outsenses[i]) { synptr = new SynonymSet(idx.offs[i], pos, "", this, i, netData); synptr.Strsns(i + 1); synptr.TracePtrs(PointerType.Of("HYPERPTR"), pos, 0); synptr.frames.Clear(); // TDMS 03 Jul 2006 - frames get added in wordnet.cs after filtering // TDMS 11 Oct 2005 - build hierarchical results senses.Add(synptr); buf += "---------------\n"; } } }
public RelationalList(RelationalList n) { next = n; }