Esempio n. 1
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. 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, SearchSet b)
        {
            SearchSet r = new SearchSet(a)
            {
                b = a.b.Or(b.b)
            };

            return(r);
        }
Esempio n. 4
0
        /// <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>
        /// WNCommon.path = "C:\Program Files\WordNet\2.1\dict\"
        /// Dim wrd As String = "car"
        /// Dim POS As String = "noun"
        /// Dim b As Boolean = WNDB.is_defined(wrd, PartOfSpeech.of(POS)).NonEmpty.ToString
        ///
        /// If b Then
        ///     MessageBox.Show("The word " &amp; wrd &amp; " exists as a " &amp; POS &amp; ".")
        /// Else
        ///     MessageBox.Show("The word " &amp; wrd &amp; " does not exist as a " &amp; POS &amp; ".")
        /// 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 SearchSet Is_defined(string searchstr, PartOfSpeech fpos)
        {
            Indexes ixs = new Indexes(searchstr, fpos, this);
            Index   index;
            int     i;
            int     CLASS    = 22; /* - */
            int     LASTTYPE = CLASS;

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

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

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

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

                    if (fpos.Key == "noun")
                    {
                        /* set generic HOLONYM and/or MERONYM bit if necessary */
                        if (pt >= "ISMEMBERPTR" && pt <= "ISPARTPTR")
                        {
                            retval += "HOLONYM";
                        }
                        else if (pt >= "HASMEMBERPTR" && pt <= "HASPARTPTR")
                        {
                            retval += "MERONYM";
                        }
                    }
                }

                if (fpos?.Key == "noun")
                {
                    retval += "RELATIVES";
                    if (index.HasHoloMero("HMERONYM", s))
                    {
                        retval += "HMERONYM";
                    }

                    if (index.HasHoloMero("HHOLONYM", s))
                    {
                        retval += "HHOLONYM";
                    }

                    if (retval["HYPERPTR"])
                    {
                        retval += "COORDS";
                    }
                }
                else if (fpos?.Key == "verb")
                {
                    retval = retval + "RELATIVES" + "FRAMES"; // added frames - TDMS
                }
            }
            return(retval);
        }
Esempio n. 5
0
 internal SearchSet(SearchSet s)
 {
     b = new BitSet(s.b);
 }