private void StrAnt(string tail, AdjSynSetType attype, int definition) { int i, wdcnt; bool first = true; if (WordNetOption.Opt("-o").flag) { search.buf += "(" + hereiam + ") "; } search.prlexid = WordNetOption.Opt("-a").flag; if (search.prlexid) { search.buf += "<" + netData.lexfiles[fnum] + "> "; search.prlexid = true; } /* 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 (WordNetOption.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 strAnt(string tail, AdjSynSetType attype, int definition) { int i, wdcnt; bool first = true; if (WNOpt.opt("-o").flag) { search.buf += " <Synset offset:" + hereiam + "> "; } if (WNOpt.opt("-a").flag) { search.buf += " <i><font color='green'>" + WNDB.lexfiles[fnum] + "</font></i> "; 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 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; } search.buf += tail; }
/// <summary> /// Trace adjective antonyms. /// </summary> internal void traceAdjAnt() { SynSet newsynptr; int i, j; AdjSynSetType anttype = AdjSynSetType.DirectAnt; SynSet simptr, antptr; string similar = " => "; /* This search is only applicable for ADJ synsets which have * either direct or indirect antonyms (not valid for pertainyms). */ if (sstype == AdjSynSetType.DirectAnt || sstype == AdjSynSetType.IndirectAnt) { strsns(sense + 1); search.buf += "\n"; /* if indirect, get cluster head */ if (sstype == AdjSynSetType.IndirectAnt) { anttype = AdjSynSetType.IndirectAnt; i = 0; while (ptrs[i].ptp.Ident != SIMPTR) { i++; } newsynptr = new SynSet(ptrs[i].off, PartOfSpeech.of("adj"), this); } else { newsynptr = this; } /* find antonyms - if direct, make sure that the antonym * ptr we're looking at is from this word */ for (i = 0; i < newsynptr.ptrs.Length; i++) { if (newsynptr.ptrs[i].ptp.Ident == ANTPTR && // TDMS 11 JUL 2006 // mnemonic=="ANTPTR" && ((anttype == AdjSynSetType.DirectAnt && newsynptr.ptrs[i].sce == newsynptr.whichword) || anttype == AdjSynSetType.IndirectAnt)) { /* read the antonym's synset and print it. if a * direct antonym, print it's satellites. */ antptr = new SynSet(newsynptr.ptrs[i].off, PartOfSpeech.of("adj"), this); search.wordsFrom(antptr); // TDMS 6 Oct 2005 - build hierarchical results if (this.senses == null) { this.senses = new SynSetList(); } //TODO: check the ptrs reference antptr.thisptr = newsynptr.ptrs[i]; // TDMS 17 Nov 2005 - add this pointer type this.senses.Add(antptr); if (anttype == AdjSynSetType.DirectAnt) { antptr.str("", "\n", 1, 0, 1, 1); for (j = 0; j < antptr.ptrs.Length; j++) { if (antptr.ptrs[j].ptp.Ident == SIMPTR) // TDMS 11 JUL 2006 - changed to INT //.mnemonic=="SIMPTR") { simptr = new SynSet(antptr.ptrs[j].off, PartOfSpeech.of("adj"), this); search.wordsFrom(simptr); simptr.str(similar, "\n", 1, 0, 0, 1); // TDMS 6 Oct 2005 - build hierarchical results if (antptr.senses == null) { antptr.senses = new SynSetList(); } antptr.senses.Add(simptr); } } } else { antptr.strAnt("\n", anttype, 1); } } } } }
void Parse(string s, PartOfSpeech fpos, string word) { int j; StrTok st = new StrTok(s); int off = int.Parse(st.next()); fnum = int.Parse(st.next()); string f = st.next(); PartOfSpeech pos = PartOfSpeech.of(f); if (pos.clss == "SATELLITE") { sstype = AdjSynSetType.IndirectAnt; } int wcnt = int.Parse(st.next(), NumberStyles.HexNumber); words = new Lexeme[wcnt]; for (j = 0; j < wcnt; j++) { words[j] = new Lexeme(); words[j].word = st.next(); words[j].uniq = int.Parse(st.next(), NumberStyles.HexNumber); // Thanh Dao 7 Nov 2005 - Added missing word sense values int ss = getsearchsense(j + 1); words[j].wnsns = ss; if (words[j].word.ToLower() == word) { whichword = j + 1; } } int pcnt = int.Parse(st.next()); ptrs = new Pointer[pcnt]; for (j = 0; j < pcnt; j++) { string p = st.next(); ptrs[j] = new Pointer(p); if (fpos.name == "adj" && sstype == AdjSynSetType.DontKnow) { if (ptrs[j].ptp.Ident == ANTPTR) // TDMS 11 JUL 2006 - change comparison to int //.mnemonic=="ANTPTR") { sstype = AdjSynSetType.DirectAnt; } else if (ptrs[j].ptp.Ident == PERTPTR) // TDMS 11 JUL 2006 - change comparison to int //mnemonic=="PERTPTR") { sstype = AdjSynSetType.Pertainym; } } ptrs[j].off = int.Parse(st.next()); ptrs[j].pos = PartOfSpeech.of(st.next()); int sx = int.Parse(st.next(), NumberStyles.HexNumber); ptrs[j].sce = sx >> 8; ptrs[j].dst = sx & 0xff; } f = st.next(); if (f != "|") { int fcnt = int.Parse(f); for (j = 0; j < fcnt; j++) { f = st.next(); // + Frame fr = Frame.frame(int.Parse(st.next())); frames.Add(new SynSetFrame(fr, int.Parse(st.next(), NumberStyles.HexNumber))); } f = st.next(); } defn = s.Substring(s.IndexOf('|') + 1); }
private void Parse(string s, PartOfSpeech fpos, string word) { int j; string[] st = s.Split(new char[0], StringSplitOptions.RemoveEmptyEntries); int stI = 0; int off = int.Parse(st[stI++]); fnum = int.Parse(st[stI++]); string f = st[stI++]; PartOfSpeech pos = PartOfSpeech.Of(f); if (pos.Clss == "SATELLITE") { sstype = AdjSynSetType.IndirectAnt; } int wcnt = int.Parse(st[stI++], NumberStyles.HexNumber); words = new Lexeme[wcnt]; for (j = 0; j < wcnt; j++) { words[j] = new Lexeme { word = st[stI++], uniq = int.Parse(st[stI++], NumberStyles.HexNumber) }; // Thanh Dao 7 Nov 2005 - Added missing word sense values int ss = Getsearchsense(j + 1); words[j].wnsns = ss; if (words[j].word.ToLower() == word) { whichword = j + 1; } } int pcnt = int.Parse(st[stI++]); ptrs = new Pointer[pcnt]; for (j = 0; j < pcnt; j++) { string p = st[stI++]; ptrs[j] = new Pointer(p); if (fpos.Key == "adj" && sstype == AdjSynSetType.DontKnow) { if (ptrs[j].ptp.Ident == ANTPTR) // TDMS 11 JUL 2006 - change comparison to int //.mnemonic=="ANTPTR") { sstype = AdjSynSetType.DirectAnt; } else if (ptrs[j].ptp.Ident == PERTPTR) // TDMS 11 JUL 2006 - change comparison to int //mnemonic=="PERTPTR") { sstype = AdjSynSetType.Pertainym; } } ptrs[j].off = int.Parse(st[stI++]); ptrs[j].pos = PartOfSpeech.Of(st[stI++]); int sx = int.Parse(st[stI++], NumberStyles.HexNumber); ptrs[j].sce = sx >> 8; ptrs[j].dst = sx & 0xff; } f = st[stI++]; if (f != "|") { int fcnt = int.Parse(f); for (j = 0; j < fcnt; j++) { f = st[stI++]; // + Usage fr = Usage.Frame(int.Parse(st[stI++])); frames.Add(new SynSetFrame(fr, int.Parse(st[stI++], NumberStyles.HexNumber))); } f = st[stI++]; } defn = s.Substring(s.IndexOf('|') + 1); }
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 Parse(string s, PartOfSpeech fpos, string word) { int j; StrTok st = new StrTok(s); int off = int.Parse(st.next()); fnum = int.Parse(st.next()); string f = st.next(); PartOfSpeech pos = PartOfSpeech.of(f); if (pos.clss == "SATELLITE") sstype = AdjSynSetType.IndirectAnt; int wcnt = int.Parse(st.next(), NumberStyles.HexNumber); words = new Lexeme[wcnt]; for (j = 0; j < wcnt; j++) { words[j] = new Lexeme(); words[j].word = st.next(); words[j].uniq = int.Parse(st.next(), NumberStyles.HexNumber); // Thanh Dao 7 Nov 2005 - Added missing word sense values int ss = getsearchsense(j + 1); words[j].wnsns = ss; if (words[j].word.ToLower() == word) whichword = j + 1; } int pcnt = int.Parse(st.next()); ptrs = new Pointer[pcnt]; for (j = 0; j < pcnt; j++) { string p = st.next(); ptrs[j] = new Pointer(p); if (fpos.name == "adj" && sstype == AdjSynSetType.DontKnow) { if (ptrs[j].ptp.ident == ANTPTR) // TDMS 11 JUL 2006 - change comparison to int //.mnemonic=="ANTPTR") sstype = AdjSynSetType.DirectAnt; else if (ptrs[j].ptp.ident == PERTPTR) // TDMS 11 JUL 2006 - change comparison to int //mnemonic=="PERTPTR") sstype = AdjSynSetType.Pertainym; } ptrs[j].off = int.Parse(st.next()); ptrs[j].pos = PartOfSpeech.of(st.next()); int sx = int.Parse(st.next(), NumberStyles.HexNumber); ptrs[j].sce = sx >> 8; ptrs[j].dst = sx & 0xff; } f = st.next(); if (f != "|") { int fcnt = int.Parse(f); for (j = 0; j < fcnt; j++) { f = st.next(); // + Frame fr = Frame.frame(int.Parse(st.next())); frames.Add(new SynSetFrame(fr, int.Parse(st.next(), NumberStyles.HexNumber))); } f = st.next(); } defn = s.Substring(s.IndexOf('|') + 1); }