Exemplo n.º 1
0
        // HTS_Model_get_index: get index of tree and PDF
        public void GetIndex(int state_index, string tString, ref int tree_index, ref int pdf_index)
        {
            HTS_Tree    tree;
            HTS_Pattern pattern;
            bool        find;

            tree_index = 2;
            pdf_index  = 1;

            if (this.tree == null)
            {
                return;
            }

            find = false;
            for (tree = this.tree; tree != null; tree = tree.next)
            {
                if (tree.state == state_index)
                {
                    pattern = tree.head;
                    if (pattern == null)
                    {
                        find = true;
                    }

                    for ( ; pattern != null; pattern = pattern.next)
                    {
                        if (HTS_Misc.PatternMatch(tString, pattern.word) == true)
                        {
                            find = true;
                            break;
                        }
                    }

                    if (find == true)
                    {
                        break;
                    }
                }
                tree_index++;
            }

            if (tree != null)
            {
                pdf_index = tree.SearchNode(tString);
            }
            else
            {
                pdf_index = this.tree.SearchNode(tString);
            }
        }
Exemplo n.º 2
0
        // HTS_Question_match: check given string match given question
        public bool Match(string tString)
        {
            HTS_Pattern tPattern;

            for (tPattern = m_Head; tPattern != null; tPattern = tPattern.next)
            {
                if (HTS_Misc.PatternMatch(tString, tPattern.word) == true)
                {
                    return(true);
                }
            }

            return(false);
        }