private int cost; // transWordのcost //----------------------------------------------------------- // constructor public WordTable() { this.prev = null; this.next = null; this.word = ""; this.transWord = ""; this.charCategory = CharCategory.Null; this.posCategory = PosCategory.Null; this.sResult = null; this.divided = Divided.Non; this.cost = 100; // 未知語 }
//------------------------------------------------------- static private WordChain DivideCountableMain(WordTable wTable, PosCategory poscategory) { WordChain wc = null; StringDivider sd = new StringDivider(wTable.word); // 後から1文字ずつ落としつつ,検索。 string trans = ""; while (sd.eof() == false) { // 文字列を分割する HYAM.KJ_dict.Pair pair = sd.DivideBackward(); if (poscategory == PosCategory.Numeral) { trans = KJ_Filter.SearchNumeral(pair.head); } else { trans = KJ_Filter.SearchNumerative(pair.head); } if (trans != "") { WordTable wt_num = new WordTable(pair.head, trans); wt_num.posCategory = poscategory; wc = new WordChain(wt_num); if (pair.tail != "") { WordTable wt_tail = new WordTable(pair.tail); wc.Add(wt_tail); } return(wc); } } // end of while return(null); }
//------------------------------------------------------- // 語のchainを先頭から舐め、助詞(Postpositional Particle)を分解する。 static private WordTable ScanPPJp(WordChain wChain, WordTable wTable) { // 語を舐め、助詞を分解する。 if (wTable.IsTranslated() || wTable.IsDigit()) { // 翻訳済み または 数字ならなにもしない。 return(wTable); } // J-->K方向の場合、ハングルは // 前の語に依存するので訳語(ハングル)の設定は別途。 // 助詞である事の確定だけ試みる // 分離されたひらがなの助詞判定だけ PosCategory pp = CheckPos_Hira(wTable.word); if (PosCategory.PP == pp) { wTable.posCategory = pp; } // 漢字+ひらがなの形での助詞分離 if (wTable.charCategory == CharCategory.KanHira) { WordChain resultChain = DivideJapanesePP(wTable); if (resultChain != null) { wChain.Swap(wTable, resultChain); // 前の語は未翻訳なのでそれを返す wTable = resultChain.Head; } } return(wTable); }