Exemple #1
0
 public Search(string w, bool doMorphs, PartOfSpeech p, SearchType s, int sn, WordNetData netdata)
     : this(w, p, s, sn, netdata)
 {
     if (p != null)
     {
         Do_search(doMorphs);
     }
 }
Exemple #2
0
 internal Search(string w, PartOfSpeech p, SearchType s, int sn, WordNetData netdata)
 {
     netData    = netdata;
     word       = w;
     pos        = p;
     sch        = s;
     whichsense = sn;
 }
Exemple #3
0
        public Exceptions(string word, PartOfSpeech pos, WordNetData netdata)
        {
            netData = netdata;

            line = netData.BinSearch(word, (StreamReader)excfps[pos.Key]);
            if (line != null)
            {
                endlp = line.IndexOf(' ');
            }
        }
Exemple #4
0
        public SemanticCorrelation(Lexeme lex, int hereiam, WordNetData netdata) : this(netdata)
        {
            // left-pad the integer with 0's into a string
            string key = hereiam.ToString("d8") + " " + lex.wnsns;

            using (StreamReader indexFile = netData.GetStreamReader(netData.path + @"\index.sense"))
            {
                // locate our word and key via a binary search
                string[] lexinfo = netData.BinSearchSemCor(key, lex.word, indexFile).Split(' ');

                semcor = Convert.ToInt16(lexinfo[lexinfo.GetUpperBound(0)]);
            }
        }
Exemple #5
0
        public Exceptions(WordNetData netdata)
        {
            netData = netdata;
            IDictionaryEnumerator d = PartOfSpeech.parts.GetEnumerator();

            while (d.MoveNext())
            {
                PartOfSpeech p = (PartOfSpeech)d.Value;
                if (!excfps.ContainsKey(p.Key))
                {
                    excfps[p.Key] = netData.GetStreamReader(netData.ExcFile(p));
                }
            }
        }
Exemple #6
0
        public Morph(string s, PartOfSpeech p, WordNetData netdata)
        {
            netData = netdata;

            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;
        }
Exemple #7
0
        // 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 Index(string word, PartOfSpeech partOfSpeech, WordNetData netdata)
        {
            netData = netdata;
            int j;

            if (word == "" || (!char.IsLetter(word[0]) && !char.IsNumber(word[0])))
            {
                return;
            }

            string line = netData.BinSearch(word, partOfSpeech);

            if (line == null)
            {
                return;
            }

            string[] st = line.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);

            if (st.Length >= 6)
            {
                int stI = 0;
                wd        = st[stI++];                  /* the word */
                pos       = PartOfSpeech.Of(st[stI++]); /* the part of speech */
                sense_cnt = int.Parse(st[stI++]);       /* collins count */

                int ptruse_cnt = int.Parse(st[stI++]);  /* number of pointers types */
                ptruse = new PointerType[ptruse_cnt];
                for (j = 0; j < ptruse_cnt; j++)
                {
                    ptruse[j] = PointerType.Of(st[stI++]);
                }

                int off_cnt = int.Parse(st[stI++]);
                offs         = new int[off_cnt];
                tagsense_cnt = int.Parse(st[stI++]);
                for (j = 0; j < off_cnt; j++)
                {
                    offs[j] = int.Parse(st[stI++]);
                }
            }
        }
Exemple #8
0
 public SynonymSet(WordNetData netdata)
 {
     netData = netdata;
 }
Exemple #9
0
 /*--------
  * Methods
  *--------*/
 public Lexicon(WordNetData netdata)
 {
     netData = netdata;
 }
Exemple #10
0
 public Search(string theWord, bool doMorphs, string thePartOfSpeech, string theSearchType, int sn, WordNetData netdata)
     : this(theWord, doMorphs, PartOfSpeech.Of(thePartOfSpeech), new SearchType(theSearchType), sn, netdata)
 {
 }
Exemple #11
0
 public SynonymSet(Index idx, int sens, Search sch, WordNetData netdata)
     : this(idx.offs[sens], idx.pos, idx.wd, sch, sens, netdata)
 {
 }
Exemple #12
0
 public SemanticCorrelation(WordNetData netdata)
 {
     netData = netdata;
 }
Exemple #13
0
 public Exceptions(string word, string p, WordNetData netdata)
     : this(word, PartOfSpeech.Of(p), netdata)
 {
 }
Exemple #14
0
 public WordNetEngine(string dictPath)
 {
     netData = new WordNetData(dictPath);
 }
Exemple #15
0
 public SynonymSet(int offset, PartOfSpeech p, string wd, Search sch, int sens, WordNetData netdata) : this(netdata)
 {
     pos     = p;
     hereiam = offset;
     search  = sch;
     sense   = sens;
     StreamReader f = netdata.Data(p);
     f.DiscardBufferedData();
     f.BaseStream.Position = offset;
     string rec = f.ReadLine();
     if (!rec.StartsWith(offset.ToString("D8")))
     {
         Console.WriteLine("Error reading " + p.Key + " file! " + offset + ": " + rec);
         netData.Reopen(p);
         f = netData.Data(p);
         f.DiscardBufferedData();
         f.BaseStream.Position = offset;
         rec = f.ReadLine();
     }
     Parse(rec, pos, wd);
 }
Exemple #16
0
 public SynonymSet(int off, PartOfSpeech p, string wd, SynonymSet fr, WordNetData netdata)
     : this(off, p, wd, fr.search, fr.sense, netdata)
 {
 }
Exemple #17
0
        /* 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.
         */

        public Index(WordNetData netdata)
        {
            netData = netdata;
        }
Exemple #18
0
 public SynonymSet(int off, PartOfSpeech p, SynonymSet fr, WordNetData netdata)
     : this(off, p, "", fr, netdata)
 {
 }
Exemple #19
0
 public Morph(string s, string p, WordNetData netdata)
     : this(s, PartOfSpeech.Of(p), netdata)
 {
 }