void getExample(string off, string wd) { StreamReader fp = WNDB.GetStreamReader(WNDB.path + "SENTS.VRB"); string line = WNDB.binSearch(off, fp); line = line.Substring(line.IndexOf(' ') + 1); search.buf += " EX: " + line.Replace("%s", wd); fp.Close(); 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 }
static Exceptions() { IDictionaryEnumerator d = PartOfSpeech.parts.GetEnumerator(); while (d.MoveNext()) { PartOfSpeech p = (PartOfSpeech)(d.Value); if (!excfps.ContainsKey(p.key)) { excfps[p.key] = WNDB.GetStreamReader(WNDB.ExcFile(p)); } } }
public SemCor(Lexeme lex, int hereiam) { // left-pad the integer with 0's into a string string key = hereiam.ToString("d8") + " " + lex.wnsns; StreamReader indexFile = WNDB.GetStreamReader(WNDB.path + @"\index.sense"); // locate our word and key via a binary search string semline = WNDB.binSearchSemCor(key, lex.word, indexFile); string[] lexinfo = semline.Split(' '); semcor = Convert.ToInt16(lexinfo[lexinfo.GetUpperBound(0)]); // TDMS 18 Nov 2005 - added file close indexFile.Close(); }
/* find the example sentence references in the example sentence index file */ bool findExample() { bool retval = false; StreamReader fp = WNDB.GetStreamReader(WNDB.path + "SENTIDX.VRB"); int wdnum = whichword - 1; Lexeme lx = words[wdnum]; string tbuf = lx.word + "%" + pos.ident + ":" + fnum + ":" + lx.uniq + "::"; string str = WNDB.binSearch(tbuf, fp); if (str != null) { str = str.Substring(lx.word.Length + 11); StrTok st = new StrTok(str, ' ', ',', '\n'); string offset; while ((offset = st.next()) != null) { getExample(offset, lx.word); retval = true; } } fp.Close(); return(retval); }