Esempio n. 1
0
        /// <summary>
        /// Fill all the child nodes.  This is done to allow recursive child calls.
        /// </summary>
        /// <param name="ssarray">Search Sense Array</param>
        /// <param name="parentnode">Parent which the child is going to attach</param>
        private void fillTreeChild(Wnlib.SynSetList ssarray, TreeNode parentnode)
        {
            TreeNode childnode = null;

            //Wnlib.SynSet ss = default(Wnlib.SynSet);

            foreach (Wnlib.SynSet ss in ssarray)
            {
                // define a new child node
                childnode = newTreeNode(ss);

                parentnode.Nodes.Add(childnode);

                // increase the depth of the tree via recursion
                if ((ss.senses != null))
                {
                    fillTreeChild(ss.senses, childnode);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Iterates and formats all of the children of the given top-level Search
        /// object for a given Part Of Speech.
        /// </summary>
        /// <param name="ssarray">The SynSetList for a given Part Of Speech</param>
        /// <returns></returns>
        private string FormatWN(Wnlib.SynSetList ssarray)
        {
            string retstr = "";

            //Wnlib.SynSet ss = default(Wnlib.SynSet);
            //Wnlib.Lexeme lx = default(Wnlib.Lexeme);

            foreach (Wnlib.SynSet ss in ssarray)
            {
                retstr += "<li>";

                foreach (Wnlib.Lexeme lx in ss.words)
                {
                    retstr += FormatLexeme(lx.word) + ", ";
                }

                // remove last comma
                retstr = Strings.Mid(retstr, 1, retstr.Length - 2);

                retstr += ": ";

                // show the definition
                retstr += FormatDefn(ss.defn);

                // recursive call to self for all children
                if ((ss.senses != null))
                {
                    retstr += "<ul>";
                    retstr += FormatWN(ss.senses);
                    retstr += "</ul>";
                }

                retstr += "</li>";
            }

            return(retstr);
        }