Exemplo n.º 1
0
		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();
		}
Exemplo n.º 2
0
        /* find the example sentence references in the example sentence index file */
        bool findExample()
        {
            bool         retval = false;
            StreamReader fp     = new StreamReader(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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
		public void CopyTo(Lexeme[] array, int index)
		{
			List.CopyTo(array, index);
		}
Exemplo n.º 5
0
		public int IndexOf(Lexeme item)
		{
			return List.IndexOf(item);
		}
Exemplo n.º 6
0
		public bool Contains(Lexeme item)
		{
			return List.Contains(item);
		}
Exemplo n.º 7
0
		public void Remove(Lexeme item)
		{
			List.Remove(item);
		}
Exemplo n.º 8
0
		public void Insert(int index, Lexeme item)
		{
			List.Insert(index, item);
		}
Exemplo n.º 9
0
		public int Add(Lexeme item)
		{
			return List.Add(item);
		}
Exemplo n.º 10
0
 public int IndexOf(Lexeme item)
 {
     return(List.IndexOf(item));
 }
Exemplo n.º 11
0
 public bool Contains(Lexeme item)
 {
     return(List.Contains(item));
 }
Exemplo n.º 12
0
 public void Remove(Lexeme item)
 {
     List.Remove(item);
 }
Exemplo n.º 13
0
 public void Insert(int index, Lexeme item)
 {
     List.Insert(index, item);
 }
Exemplo n.º 14
0
 public int Add(Lexeme item)
 {
     return(List.Add(item));
 }
Exemplo n.º 15
0
		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);
		}