internal void seealso() { /* Find all SEEALSO pointers from the searchword and print the * word or synset pointed to. */ string prefix; // = " Also See-> "; //WN3.0 added updated wording for verb see also if (pos.name == "verb") { prefix = " Phrasal Verb-> "; } else { prefix = " Also See-> "; } for (int i = 0; i < ptrs.Length; i++) { Pointer p = ptrs[i]; if (p.ptp.Ident == SEEALSOPTR && (p.sce == 0 || (p.sce == whichword))) { SynSet cursyn = new SynSet(p.off, p.pos, "", this); bool svwnsnsflag = WnOpt.Opt("-s").Flag; WnOpt.Opt("-s").Flag = true; cursyn.str(prefix, "", 0, (p.dst == 0) ? 0 : p.dst, 0, 0); prefix = "; "; } } }
internal void strAnt(PartOfSpeech pos, int wdnum, string head, string tail) { int i, j, wdoff; /* Go through all the pointers looking for anotnyms from the word * indicated by wdnum. When found, print all the antonym's * antonym pointers which point back to wdnum. */ for (i = 0; i < ptrs.Length; i++) { Pointer pt = ptrs[i]; if (pt.ptp.Ident == ANTPTR && pt.sce == wdnum) { SynSet psyn = new SynSet(pt.off, pos, this); for (j = 0; j < psyn.ptrs.Length; j++) { Pointer ppt = psyn.ptrs[j]; if (ppt.ptp.Ident == ANTPTR && ppt.dst == wdnum && ppt.off == hereiam) { wdoff = ppt.sce > 0 ? ppt.sce - 1 : 0; search.buf += head; /* Construct buffer containing formatted antonym, * then add it onto end of return buffer */ search.buf += deadjify(psyn.words[wdoff].word); /* Print additional lexicographer information and * WordNet sense number as indicated by flags */ isDirty = true; // TDMS 19 July 2006 - attempt to tie the logic which // populates buf to the logic that defines whether the // synset is populated with relevant information if (search.prlexid && psyn.words[wdoff].uniq != 0) { search.buf += psyn.words[wdoff].uniq; } int s = getsearchsense(wdoff + 1); psyn.words[wdoff].wnsns = s; if (WnOpt.Opt("-s").Flag) { search.buf += "#" + s; isDirty = true; // TDMS 19 July 2006 - attempt to tie the logic which // populates buf to the logic that defines whether the // synset is populated with relevant information } search.buf += tail; } } } } }
void strAnt(string tail, AdjSynSetType attype, int definition) { int i, wdcnt; bool first = true; if (WnOpt.Opt("-o").Flag) { search.buf += "(" + hereiam + ") "; } if (WnOpt.Opt("-a").Flag) { search.buf += "<" + WNDB.lexfiles[fnum] + "> "; search.prlexid = true; } else { search.prlexid = false; } /* print antonyms from cluster head (of indirect ant) */ search.buf += "INDIRECT (VIA "; for (i = 0, wdcnt = words.Length; i < wdcnt; i++) { if (first) { strAnt(PartOfSpeech.of("adj"), i + 1, "", ", "); first = false; } else { strAnt(PartOfSpeech.of("adj"), i + 1, ", ", ", "); } } search.buf += ") -> "; /* now print synonyms from cluster head (of indirect ant) */ for (i = 0, wdcnt = words.Length; i < wdcnt; i++) { catword(i, 0, 0); if (i < wdcnt - 1) { search.buf += ", "; } } if (WnOpt.Opt("-g").Flag&& defn != null && definition != 0) { search.buf += " -- " + defn; isDirty = true; // TDMS 19 July 2006 - attempt to tie the logic which // populates buf to the logic that defines whether the // synset is populated with relevant information } search.buf += tail; }
void strsense(int sense) { /* Append lexicographer filename after Sense # if flag is set. */ if (WnOpt.Opt("-a").Flag) { search.buf += "\nSense " + sense + " in file \"" + WNDB.lexfiles[fnum] + "\"\n"; } else { search.buf += "\nSense " + sense + "\n"; } isDirty = true; // TDMS 19 July 2006 - attempt to tie the logic which // populates buf to the logic that defines whether the // synset is populated with relevant information }
internal void str(string head, string tail, int definition, int wdnum, int antflag, int markerflag) { int i, wdcnt; search.buf += head; /* Precede synset with additional information as indicated * by flags */ if (WnOpt.Opt("-o").Flag) { search.buf += "(" + hereiam + ") "; } if (WnOpt.Opt("-a").Flag) { search.buf += "<" + WNDB.lexfiles[fnum] + "> "; search.prlexid = true; } else { search.prlexid = false; } if (wdnum > 0) { catword(wdnum - 1, markerflag, antflag); } else { for (i = 0, wdcnt = words.Length; i < wdcnt; i++) { catword(i, markerflag, antflag); if (i < wdcnt - 1) { search.buf += ", "; } } } if (definition != 0 && WnOpt.Opt("-g").Flag&& defn != null) { search.buf += " -- " + defn; isDirty = true; // TDMS 19 July 2006 - attempt to tie the logic which // populates buf to the logic that defines whether the // synset is populated with relevant information } search.buf += tail; }
void catword(int wdnum, int adjmarker, int antflag) { search.buf += deadjify(words[wdnum].word); /* Print additional lexicographer information and WordNet sense * number as indicated by flags */ if (words[wdnum].uniq != 0) { search.buf += "" + words[wdnum].uniq; isDirty = true; // TDMS 19 July 2006 - attempt to tie the logic which // populates buf to the logic that defines whether the // synset is populated with relevant information } int s = getsearchsense(wdnum + 1); words[wdnum].wnsns = s; if (WnOpt.Opt("-s").Flag) { search.buf += "#" + s; isDirty = true; // TDMS 19 July 2006 - attempt to tie the logic which // populates buf to the logic that defines whether the // synset is populated with relevant information } /* For adjectives, append adjective marker if present, and * print antonym if flag is passed */ if (pos.name == "adj") { if (adjmarker > 0) { search.buf += "" + adj_marker.mark; isDirty = true; // TDMS 19 July 2006 - attempt to tie the logic which // populates buf to the logic that defines whether the // synset is populated with relevant information } if (antflag > 0) { strAnt(PartOfSpeech.of("adj"), wdnum + 1, "(vs. ", ")"); } } }
void WNOverview() { Index idx; //senses = new ArrayList(); senses = new SynSetList(); Indexes ixs = new Indexes(word, pos); while ((idx = ixs.next()) != null) { buf += "\n"; /* Print synset for each sense. If requested, precede * synset with synset offset and/or lexical file information.*/ for (int sens = 0; sens < idx.SynsetOffsets.Length; sens++) { for (int j = 0; j < senses.Count; j++) { SynSet ss = (SynSet)senses[j]; if (ss.hereiam == idx.SynsetOffsets[sens]) { goto skipit; } } SynSet cursyn = new SynSet(idx, sens, this); bool svdflag = WnOpt.Opt("-g").Flag; WnOpt.Opt("-g").Flag = true; bool svaflag = WnOpt.Opt("-a").Flag; WnOpt.Opt("-a").Flag = WnOpt.Opt("-A").Flag; bool svoflag = WnOpt.Opt("-o").Flag; WnOpt.Opt("-o").Flag = WnOpt.Opt("-O").Flag; cursyn.str("" + (sens + 1) + ". ", "\n", 1, 0, 0, 0); WnOpt.Opt("-g").Flag = svdflag; WnOpt.Opt("-a").Flag = svaflag; WnOpt.Opt("-o").Flag = svoflag; wordsFrom(cursyn); cursyn.frames.Clear(); // TDMS 03 Jul 2006 - frames get added in wordnet.cs after filtering senses.Add(cursyn); skipit: ; } /* Print sense summary message */ if (senses.Count > 0) { taggedSenses = 0; if (senses.Count == 1) { buf += "\nThe " + pos.name + " " + idx.Wd + " has 1 sense"; } else { buf += "\nThe " + pos.name + " " + idx.Wd + " has " + senses.Count + " senses"; } if (idx.TaggedSensesCount > 0) { taggedSenses = idx.TaggedSensesCount; buf += " (first " + idx.TaggedSensesCount + " from tagged texts)\n"; } else { buf += " (no senses from tagged texts)\n"; } } } }