コード例 #1
0
ファイル: Search.cs プロジェクト: envis10n/Warrens
        /// <summary>
        /// Performs a search based on the parameters setup
        /// in the Search constructor.
        /// </summary>
        /// <param name="doMorphs">Specifies whether to perform a search on morphs.
        /// This parameter is retrieved in the first
        /// call from do_search(bool m, string p).  If morph searching is specified
        /// and a morph is found, then on a recursive call to this method
        /// morphing will be turned off to prevent unnecessary morph searching.</param>
        internal void Do_search(bool doMorphs)
        {
            Findtheinfo();
            if (buf.Length > 0)
            {
                buf = "\n" + sch.Label + " of " + pos.Key + " " + word + "\n" + buf;
            }

            if (!doMorphs)
            {
                return;
            }

            morphs = new Hashtable();
            Morph  st = new Morph(word, pos, netData);
            string morphword;

            // if there are morphs then perform iterative searches
            // on each morph, filling the morph tree in the search
            // object.
            while ((morphword = st.Next()) != null)
            {
                Search s = new Search(morphword, pos, sch, whichsense, netData);
                s.Do_search(false);

                // Fill the morphlist - eg. if verb relations of 'drunk' are requested, none are directly
                // found, but the morph 'drink' will have results.  The morph hashtable will be populated
                // into the search results and should be iterated instead of the returned synset if the
                // morphs are non-empty
                morphs[morphword] = s;
                buf += s.buf;
            }
        }