internal static ArrayList wngrep(string wordPassed, PartOfSpeech pos) { ArrayList r = new ArrayList(); MemoryStream ms = index(pos); StreamReader inputFile = new StreamReader(ms); //= index(pos); inputFile.BaseStream.Seek(0L, SeekOrigin.Begin); inputFile.DiscardBufferedData(); string word = wordPassed.Replace(" ", "_"); string line; while ((line = inputFile.ReadLine()) != null) { int lineLen = line.IndexOf(' '); line = line.Substring(0, lineLen); try { if (line.IndexOf(word) >= 0) { r.Add(line.Replace("_", " ")); } } catch { } } return(r); }
/// <summary> /// Trace meronyms. /// </summary> /// <param name="pbase"></param> /// <param name="fpos"></param> /// <param name="depth"></param> void traceInherit(PointerType pbase, PartOfSpeech fpos, int depth) { for (int i = 0; i < ptrs.Length; i++) { Pointer pt = ptrs[i]; if (pt.ptp.ident == HYPERPTR && (pt.sce == 0 || pt.sce == whichword)) { spaces("TRACEI", depth); SynSet cursyn = new SynSet(pt.off, pt.pos, this); search.wordsFrom(cursyn); cursyn.str("=> ", "\n", 1, 0, 0, 1); // TDMS 6 Oct 2005 - build hierarchical results // TODO: verify this if (this.senses == null) { this.senses = new SynSetList(); } cursyn.thisptr = pt; // TDMS 17 Nov 2005 - add this pointer type // TODO: This is adding senses incorrectly this.senses.Add(cursyn); cursyn.tracePtrs(pbase, PartOfSpeech.of("noun"), depth); cursyn.tracePtrs(pbase + 1, PartOfSpeech.of("noun"), depth); cursyn.tracePtrs(pbase + 2, PartOfSpeech.of("noun"), depth); if (depth > 0) { depth = depthcheck(depth); cursyn.traceInherit(pbase, cursyn.pos, depth + 1); } } } search.trunc(); }
internal Search(string w, PartOfSpeech p, SearchType s, int sn) { word = w; pos = p; sch = s; whichsense = sn; }
public Indexes(string str, PartOfSpeech pos) { string[] strings = new string[stringscount]; str = str.ToLower(); strings[0] = str; strings[1] = str.Replace('_', '-'); strings[2] = str.Replace('-', '_'); strings[3] = str.Replace("-", "").Replace("_", ""); strings[4] = str.Replace(".", ""); // TDMS - 14 Aug 2005 - added two more possibilities // to allow for spaces to be transformed // an example is a search for "11 plus", without this // transformation no result would be found strings[5] = str.Replace(' ', '-'); strings[6] = str.Replace(' ', '_'); offsets[0] = Index.lookup(str, pos); // TDMS - 14 Aug 2005 - changed 5 to 7 to allow for two // new possibilities for (int i = 1; i < stringscount; i++) { if (str != strings[i]) { offsets[i] = Index.lookup(strings[i], pos); } } fpos = pos; }
} // for serialization public SynSet(int off, PartOfSpeech p, string wd, Search sch, int sens) { pos = p; hereiam = off; search = sch; sense = sens; StreamReader f = WNDB.data(p); f.DiscardBufferedData(); //f.BaseStream.Seek(off,SeekOrigin.Begin); f.BaseStream.Position = off; string rec = f.ReadLine(); //string str; if (!rec.StartsWith(off.ToString("D8"))) { Console.WriteLine("Error reading " + p.name + " file! " + off + ": " + rec); WNDB.reopen(p); f = WNDB.data(p); f.DiscardBufferedData(); // f.BaseStream.Seek(off,SeekOrigin.Begin); f.BaseStream.Position = off; rec = f.ReadLine(); //if (!rec.StartsWith(off.ToString("D8"))) // str = ""; //else // Console.WriteLine("Recovered..."); } Parse(rec, pos, wd); }
public Search(string w, bool doMorphs, PartOfSpeech p, SearchType s, int sn) : this(w, p, s, sn) { if (p != null) { do_search(doMorphs); } }
public static void reopen(PartOfSpeech p) { WNDBpart w = WNDBpart.of(p); w.index.Close(); w.data.Close(); w.index = new StreamReader(IndexFile(p)); w.data = new StreamReader(DataFile(p)); }
static Exceptions() { excfps = new StreamReader[PartOfSpeech.parts.Count]; IDictionaryEnumerator d = PartOfSpeech.parts.GetEnumerator(); while (d.MoveNext()) { PartOfSpeech p = (PartOfSpeech)(d.Value); excfps[p.ident] = new StreamReader(WNDB.ExcFile(p)); } }
/// <summary> /// Performs a search based on the parameters setup /// in the Search constructor. /// </summary> /// <param name="m">Specify if morphs should be searched</param> /// <param name="p">The Part Of Speech to perform the search on</param> public void do_search(bool m, string p) { if (parts == null) { parts = new Hashtable(); } Search s = new Search(word, PartOfSpeech.of(p), sch, whichsense); s.do_search(m); parts[p] = s; buf += s.buf; }
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; }
/// <summary> /// Trace coordinate terms. /// </summary> /// <param name="ptp"></param> /// <param name="fpos"></param> /// <param name="depth"></param> internal void traceCoords(PointerType ptp, PartOfSpeech fpos, int depth) { for (int i = 0; i < ptrs.Length; i++) { Pointer pt = ptrs[i]; /* WN2.0 * if (pt.ptp.mnemonic=="HYPERPTR" && * (pt.sce==0 || * pt.sce==whichword)) */ // WN2.1 if statement change - TDMS if ((pt.ptp.ident == HYPERPTR || pt.ptp.ident == INSTANCE) && ((pt.sce == 0) || (pt.sce == whichword))) { if (!search.prflag) { strsns(sense + 1); search.prflag = true; } spaces("TRACEC", depth); SynSet cursyn = new SynSet(pt.off, pt.pos, this); search.wordsFrom(cursyn); cursyn.str("-> ", "\n", 1, 0, 0, 1); cursyn.tracePtrs(ptp, cursyn.pos, depth); // TDMS 6 Oct 2005 - build hierarchical results if (this.senses == null) { this.senses = new SynSetList(); } cursyn.thisptr = pt; // TDMS 17 Nov 2005 - add this pointer type this.senses.Add(cursyn); if (depth > 0) { depth = depthcheck(depth); cursyn.traceCoords(ptp, cursyn.pos, depth + 1); // TDMS 6 Oct 2005 - build hierarchical results // TODO: verify this if (this.senses == null) { this.senses = new SynSetList(); } cursyn.thisptr = pt; // TDMS 17 Nov 2005 - add this pointer type this.senses.Add(cursyn); } } } }
public MorphStr(string s, PartOfSpeech p) { string origstr = s; pos = p; if (pos.clss == "SATELLITE") { pos = PartOfSpeech.of("adj"); } /* Assume string hasnt had spaces substitued with _ */ str = origstr.Replace(' ', '_').ToLower(); searchstr = ""; cnt = str.Split('_').Length; svprep = 0; firsttime = true; }
public static MemoryStream index(PartOfSpeech p) //StreamReader index(PartOfSpeech p) { if (laststr == ((System.IO.FileStream)(WNDBpart.of(p).index.BaseStream)).Name) { return(ms); //WNDBpart.of(p).index; } else { laststr = ((System.IO.FileStream)(WNDBpart.of(p).index.BaseStream)).Name; StreamReader fs = WNDBpart.of(p).index; fs.BaseStream.Position = 0; Byte[] b = System.Text.Encoding.Unicode.GetBytes(fs.ReadToEnd()); ms = new MemoryStream(b); return(ms); //WNDBpart.of(p).index; } }
public Exceptions(string word, PartOfSpeech pos) { if (laststr != ((System.IO.FileStream)(excfps[pos.ident].BaseStream)).Name) { laststr = ((System.IO.FileStream)(excfps[pos.ident].BaseStream)).Name; StreamReader fs = excfps[pos.ident]; Byte[] b = System.Text.Encoding.Unicode.GetBytes(fs.ReadToEnd()); excfps[pos.ident].BaseStream.Seek(0, SeekOrigin.Begin); exc = new MemoryStream(b); } line = WNDB.binSearch(word, exc); //excfps[pos.ident]); if (line != null) { endlp = line.IndexOf(' '); } }
Opt(string a, string m, string p, int h, string b) { arg = a; if (m[0] == '-') { sch = new SearchType(true, m.Substring(1)); } else { sch = new SearchType(false, m); } pos = PartOfSpeech.of(p.ToLower()); helpx = h; label = b; id = opts.Count; opts.Add(this); }
public WNDBpart(PartOfSpeech p) { try { Console.WriteLine("WNDBpart"); index = new StreamReader(WNDB.IndexFile(p)); data = new StreamReader(WNDB.DataFile(p)); fps[p] = this; } catch { MessageBox.Show("Bad dict path"); // TODO: handle bad dict path // ignore errors - as the user is locating the dictionary location // wordnet classes are trying to instantiate based on an incorrect dict path } }
/* From search.c: * Find word in index file and return parsed entry in data structure. * Input word must be exact match of string in database. */ // From the WordNet Manual (http://wordnet.princeton.edu/man/wnsearch.3WN.html) // index_lookup() finds searchstr in the index file for pos and returns a pointer // to the parsed entry in an Index data structure. searchstr must exactly match the // form of the word (lower case only, hyphens and underscores in the same places) in // the index file. NULL is returned if a match is not found. public static Index lookup(string word, PartOfSpeech pos) { int j; if (word == "") { return(null); } // TDMS 14 Aug 2005 - changed to allow for numbers as well // because the database contains searches that can start with // numerals //if (!char.IsLetter(word[0])) if (!char.IsLetter(word[0]) && !char.IsNumber(word[0])) { return(null); } string line = WNDB.binSearch(word, pos); if (line == null) { return(null); } Index idx = new Index(); StrTok st = new StrTok(line); idx.wd = st.next(); /* the word */ idx.pos = PartOfSpeech.of(st.next()); /* the part of speech */ idx.sense_cnt = int.Parse(st.next()); /* collins count */ int ptruse_cnt = int.Parse(st.next()); /* number of pointers types */ idx.ptruse = new PointerType[ptruse_cnt]; for (j = 0; j < ptruse_cnt; j++) { idx.ptruse[j] = PointerType.of(st.next()); } int off_cnt = int.Parse(st.next()); idx.offs = new int[off_cnt]; idx.tagsense_cnt = int.Parse(st.next()); for (j = 0; j < off_cnt; j++) { idx.offs[j] = int.Parse(st.next()); } return(idx); }
public static PartOfSpeech of(PartsOfSpeech f) { if (f == PartsOfSpeech.Noun) { return(PartOfSpeech.of("noun")); } if (f == PartsOfSpeech.Verb) { return(PartOfSpeech.of("verb")); } if (f == PartsOfSpeech.Adj) { return(PartOfSpeech.of("adj")); } if (f == PartsOfSpeech.Adv) { return(PartOfSpeech.of("adv")); } return(null); // unknown or not unique }
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. ", ")"); } } }
/* Find a preposition in the verb string and return its * corresponding word number. */ int hasprep(string s, int wdcnt) { int i, wdnum; int pos = 0; for (wdnum = 2; wdnum <= wdcnt; wdnum++) { pos = s.IndexOf('_'); for (pos++, i = 0; i < prepositions.Length; i++) { int len = prepositions[i].Length; if (len <= s.Length - pos && s.Substring(pos, len) == prepositions[i] && (len == s.Length - pos || s[pos + len] == '_')) { return(wdnum); } } // return 0; TDMS 8 Feb 2006 - this always returned zero if the first iteration did not return a result // Removed the return to allow the outer loop to run correctly } return(0); }
public bool HasHoloMero(PointerType p, Search search) { PointerType pbase; if (p.mnemonic == "HMERONYM") { pbase = PointerType.of("HASMEMBERPTR"); } else { pbase = PointerType.of("ISMEMBERPTR"); } for (int i = 0; i < offs.Length; i++) { SynSet s = new SynSet(offs[i], PartOfSpeech.of("noun"), "", search, 0); if (s.has(pbase) || s.has(pbase + 1) || s.has(pbase + 2)) { return(true); } } return(false); }
internal void partsAll(PointerType ptp) { int hasptr = 0; PointerType ptrbase = PointerType.of((ptp.ident == HMERONYM)?"HASMEMBERPTR":"ISMEMBERPTR"); /* First, print out the MEMBER, STUFF, PART info for this synset */ for (int i = 0; i < 3; i++) { if (has(ptrbase + i)) { tracePtrs(ptrbase + i, PartOfSpeech.of("noun"), i); hasptr++; } } /* Print out MEMBER, STUFF, PART info for hypernyms on * HMERONYM search only */ if (hasptr > 0 && ptp.ident == HMERONYM) { search.mark(); traceInherit(ptrbase, PartOfSpeech.of("noun"), 1); } }
/// <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); } } } } }
internal void tracePtrs(PointerType ptp, PartOfSpeech p, int depth) { tracePtrs(new SearchType(false, ptp), p, depth); }
public Search(string w, bool doMorphs, string p, string s, int sn) : this(w, doMorphs, PartOfSpeech.of(p), new SearchType(s), sn) { }
/// <summary> /// Traces pointer hierarchy. /// </summary> /// <param name="stp"></param> /// <param name="fpos"></param> /// <param name="depth"></param> internal void tracePtrs(SearchType stp, PartOfSpeech fpos, int depth) { int i; SynSet cursyn; PointerType ptp = stp.ptp; string prefix; int realptr; // WN2.1 for (i = 0; i < ptrs.Length; i++) { Pointer pt = ptrs[i]; // following if statement is WN2.1 - TDMS if ((ptp.ident == HYPERPTR && (pt.ptp.ident == HYPERPTR || pt.ptp.ident == INSTANCE)) || (ptp.ident == HYPOPTR && (pt.ptp.ident == HYPOPTR || pt.ptp.ident == INSTANCES)) || ((pt.ptp == ptp) && ((pt.sce == 0) || (pt.sce == whichword)))) { realptr = pt.ptp.ident; /* WN2.1 deal with INSTANCE */ if (!search.prflag) // print sense number and synset { strsns(sense + 1); } search.prflag = true; spaces("TRACEP", depth + (stp.rec?2:0)); // switch (ptp.mnemonic) // TDMS 11 JUL 2006 - changed switch to ident switch (pt.ptp.mnemonic) // TDMS - WN2.1 MOD switch (pt.ptp.ident) // TDMS 11 JUL 2006 - changed switch to ident { case PERTPTR: if (fpos.name == "adv") // TDMS "adverb") { prefix = "Derived from " + pt.pos.name + " "; } else { prefix = "Pertains to " + pt.pos.name + " "; } break; case ANTPTR: // TDMS 26/8/05 if (fpos.name == "adj") //TODO: which adjective will fall into the below? { prefix = "Antonym of "; } else { prefix = ""; } break; case PPLPTR: prefix = "Participle of verb"; break; case INSTANCE: prefix = "INSTANCE OF=> "; break; case INSTANCES: prefix = "HAS INSTANCE=> "; break; case HASMEMBERPTR: prefix = " HAS MEMBER: "; break; case HASSTUFFPTR: prefix = " HAS SUBSTANCE: "; break; case HASPARTPTR: prefix = " HAS PART: "; break; case ISMEMBERPTR: prefix = " MEMBER OF: "; break; case ISSTUFFPTR: // TDMS 26/8/05 prefix = " SUBSTANCE OF: "; break; case ISPARTPTR: // TDMS 26/8/05 prefix = " PART OF: "; break; default: prefix = "=> "; break; } /* Read synset pointed to */ cursyn = new SynSet(pt.off, pt.pos, this); search.wordsFrom(cursyn); // TDMS 6 Oct 2005 - build hierarchical results if (this.senses == null) { this.senses = new SynSetList(); } cursyn.thisptr = pt; // TDMS 17 Nov 2005 - add this pointer type this.senses.Add(cursyn); /* For Pertainyms and Participles pointing to a specific * sense, indicate the sense then retrieve the synset * pointed to and other info as determined by type. * Otherwise, just print the synset pointed to. */ if ((ptp.ident == PERTPTR || ptp.ident == PPLPTR) && pt.dst != 0) { string tbuf = " (Sense " + cursyn.getsearchsense(pt.dst) + ")"; cursyn.str(prefix, tbuf, 0, pt.dst, 0, 1); if (ptp.ident == PPLPTR) // adj pointing to verb { cursyn.str(" =>", "\n", 1, 0, 1, 1); cursyn.tracePtrs(PointerType.of("HYPERPTR"), cursyn.pos, 0); } else if (fpos.name == "adverb") // adverb pointing to adjective { cursyn.str(" =>", "\n", 0, 0, (pos.clss == "SATELLITE")?0:1, 1); // cursyn.traceptrs(HYPERPTR,pos,0); } else // adjective pointing to noun { cursyn.str(" =>", "\n", 1, 0, 1, 1); cursyn.tracePtrs(PointerType.of("HYPERPTR"), pos, 0); } } else { cursyn.str(prefix, "\n", 1, 0, 1, 1); } /* For HOLONYMS and MERONYMS, keep track of last one * printed in buffer so results can be truncated later. */ if (ptp.ident >= PointerType.of("ISMEMBERPTR").ident&& ptp.ident <= PointerType.of("HASPARTPTR").ident) { search.mark(); } if (depth > 0) { depth = cursyn.depthcheck(depth); cursyn.tracePtrs(ptp, cursyn.pos, depth + 1); } } } }
public MorphStr(string s, string p) : this(s, PartOfSpeech.of(p)) { }
string morphprep(string s) { string excWord, lastwd = null; int i, offset, cnt, rest, last; string word, end, retval; /* Assume that the verb is the first word in the phrase. Strip it * off, check for validity, then try various morphs with the * rest of the phrase tacked on, trying to find a match. */ rest = s.IndexOf('_'); last = s.LastIndexOf('_'); end = ""; if (rest != last) { // more than 2 words lastwd = morphword(s.Substring(last + 1)); if (lastwd != null) { end = s.Substring(rest, last - rest + 1) + lastwd; } } word = s.Substring(0, rest); for (i = 0; i < word.Length; i++) { if (!char.IsLetterOrDigit(word[i])) { return(null); } } offset = offsets[PartOfSpeech.of("verb").ident]; cnt = cnts[PartOfSpeech.of("verb").ident]; /* First try to find the verb in the exception list */ Exceptions e = new Exceptions(word, PartOfSpeech.of("verb")); while ((excWord = e.next()) != null && excWord != word) { retval = excWord + s.Substring(rest); if (WNDB.is_defined(retval, PartOfSpeech.of("verb")).NonEmpty) { return(retval); } else if (lastwd != null) { retval = excWord + end; if (WNDB.is_defined(retval, PartOfSpeech.of("verb")).NonEmpty) { return(retval); } } } for (i = 0; i < cnt; i++) { if ((excWord = wordbase(word, i + offset)) != null && excWord != word) // ending is different { retval = excWord + s.Substring(rest); if (WNDB.is_defined(retval, PartOfSpeech.of("verb")).NonEmpty) { return(retval); } else if (lastwd != null) { retval = excWord + end; if (WNDB.is_defined(retval, PartOfSpeech.of("verb")).NonEmpty) { return(retval); } } } } retval = word + s.Substring(rest); if (s != retval) { return(retval); } if (lastwd != null) { retval = word + end; if (s != retval) { return(retval); } } return(null); }
public Exceptions(string word, string p) : this(word, PartOfSpeech.of(p)) { }