private void Initialize() { this.head = null; this.next = null; this.root = null; this.state = 0; }
private void Initialize() { this.vector_length = 0; this.num_windows = 0; this.is_msd = false; this.ntree = 0; this.npdf = null; this.pdf = null; this.tree = null; this.question = null; }
// 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); } }
// HTS_Model_load_tree: load trees private bool LoadTree(HTS_File fp) { string tToken; HTS_Question question, last_question; HTS_Tree tree, last_tree; int state; // check if (fp == null) { ntree = 1; return(true); } ntree = 0; last_question = null; last_tree = null; while (fp.Eof() == false) { tToken = fp.GetPatternToken(); // parse questions if (tToken == "QS") { question = new HTS_Question(); if (question.Load(fp) == false) { Debug.LogError("Question Load falied"); question = null; Initialize(); return(false); } if (this.question != null) { last_question.next = question; } else { this.question = question; } question.next = null; last_question = question; } else { // tToken が "QE" の場合に更新される事は無いので排他で良い // parse trees state = GetStateNum(tToken); if (state != 0) { tree = new HTS_Tree(); tree.state = state; tree.ParsePattern(tToken); if (tree.Load(fp, this.question) == false) { Debug.LogError("Tree Load falied"); tree = null; Initialize(); return(false); } if (this.tree != null) { last_tree.next = tree; } else { this.tree = tree; } tree.next = null; last_tree = tree; this.ntree++; } else { Debug.LogWarning("Bad:" + tToken); } } } // No Tree information in tree file if (this.tree == null) { this.ntree = 1; } return(true); }