Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
        public int getsearchsense(int which)
        {
            int    i;
            string wdbuf = words[which - 1].word.Replace(' ', '_').ToLower();
            Index  idx   = Index.lookup(wdbuf, pos);

            if (idx != null)
            {
                for (i = 0; i < idx.SynsetOffsets.Length; i++)
                {
                    if (idx.SynsetOffsets[i] == hereiam)
                    {
                        return(i + 1);
                    }
                }
            }
            return(0);
        }