Esempio n. 1
0
        public static SearchSet operator+(SearchSet a, SearchSet b)
        {
            SearchSet r = new SearchSet(a);

            r.b = a.b.Or(b.b);
            return(r);
        }
Esempio n. 2
0
        public static SearchSet operator+(SearchSet a, PointerType p)
        {
            SearchSet r = new SearchSet(a);

            r.b[p.ident] = true;
            return(r);
        }
Esempio n. 3
0
        public static SearchSet operator+(SearchSet a, string s)
        {
            SearchSet r = new SearchSet(a);

            r.b[PointerType.of(s).ident] = true;
            return(r);
        }
Esempio n. 4
0
 internal SearchSet(SearchSet s)
 {
     b = new BitSet(s.b);
 }
Esempio n. 5
0
        // TDMS 16 July 2006 - removed this method.
        // Method removed because if called externally
        // WNDBPart was not correctly constructed.
        // Calling is_defined(string searchstr,PartOfSpeech fpos)
        // correctly constructs WNDBPart.

/*
 *      private static SearchSet is_defined(string word,string p)
 *              {
 *          Console.WriteLine("is_defined string, string");
 *                      return is_defined(word,PartOfSpeech.of(p));
 *              }
 */

        /// <summary>
        /// Determines if a word is defined in the WordNet database and returns
        /// all possible searches of the word.
        /// </summary>
        /// <example> This sample displays a message stating whether the
        /// word "car" exists as the part of speech "noun".
        /// <code>
        /// Wnlib.WNCommon.path = "C:\Program Files\WordNet\2.1\dict\"
        /// Dim wrd As String = "car"
        /// Dim POS As String = "noun"
        /// Dim b As Boolean = Wnlib.WNDB.is_defined(wrd, Wnlib.PartOfSpeech.of(POS)).NonEmpty.ToString
        ///
        /// If b Then
        ///     MessageBox.Show("The word " & wrd & " exists as a " & POS & ".")
        /// Else
        ///     MessageBox.Show("The word " & wrd & " does not exist as a " & POS & ".")
        /// End If
        /// </code>
        /// </example>
        /// <param name="searchstr">The word to search for</param>
        /// <param name="fpos">Part of Speech (noun, verb, adjective, adverb)</param>
        /// <returns>A SearchSet or null if the word does not exist in the dictionary</returns>
        public static SearchSet is_defined(string searchstr, PartOfSpeech fpos)
        {
            Indexes ixs = new Indexes(searchstr, fpos);
            Index   index;
            int     i;
            int     CLASS    = 22;                      /* - */
            int     LASTTYPE = CLASS;

            Search    s      = new Search(searchstr, fpos, new SearchType(false, "FREQ"), 0);
            SearchSet retval = new SearchSet();

            while ((index = ixs.next()) != null)
            {
                retval = retval + "SIMPTR" + "FREQ" + "SYNS" + "WNGREP" + "OVERVIEW";     // added WNGREP - TDMS
                for (i = 0; i < index.ptruse.Length; i++)
                {
                    PointerType pt = index.ptruse[i];
//					retval=retval+pt;

                    // WN2.1 - TDMS
                    if (pt.ident <= LASTTYPE)
                    {
                        retval = retval + pt;
                    }
                    else if (pt.mnemonic == "INSTANCE")
                    {
                        retval = retval + "HYPERPTR";
                    }
                    else if (pt.mnemonic == "INSTANCES")
                    {
                        retval = retval + "HYPOPTR";
                    }

                    // WN2.1 - TDMS
                    if (pt.mnemonic == "SIMPTR")
                    {
                        retval = retval + "ANTPTR";
                    }

                    if (fpos.name == "noun")
                    {
                        /* set generic HOLONYM and/or MERONYM bit if necessary */
                        if (pt >= "ISMEMBERPTR" && pt <= "ISPARTPTR")
                        {
                            retval = retval + "HOLONYM";
                        }
                        else if (pt >= "HASMEMBERPTR" && pt <= "HASPARTPTR")
                        {
                            retval = retval + "MERONYM";
                        }
                    }
// WN2.1 - TDMS					else if (fpos.name=="adj" && pt.mnemonic=="SIMPTR")
//						retval=retval+"ANTPTR";
                }
                if (fpos.name == "noun")
                {
                    retval = retval + "RELATIVES";
                    if (index.HasHoloMero("HMERONYM", s))
                    {
                        retval = retval + "HMERONYM";
                    }
                    if (index.HasHoloMero("HHOLONYM", s))
                    {
                        retval = retval + "HHOLONYM";
                    }
                    if (retval["HYPERPTR"])
                    {
                        retval = retval + "COORDS";
                    }
                }
                else if (fpos.name == "verb")
                {
                    retval = retval + "RELATIVES" + "FRAMES";               // added frames - TDMS
                }
            }
            return(retval);
        }