예제 #1
0
        //------------------------------------------------------------
        // 分割した場合の最後に来ない語はtrue
        //    AABBCC のCCに来ない語はture
        //    조사한の한は連体(ひとつの)ではない。  etc
        public static bool NotTrail(DocumentData doc)
        {
            string pos = doc.GetPos();

            if (pos == "adj.adnominal")
            {
                return(true);
            }


            return(false);
        }
예제 #2
0
        //---------------------------------------------------------
        // 非分割の語で使わないものは外す
        public static bool NotFullWord(DocumentData doc)
        {
            if (doc.GetPos() == "noun.partial")
            {
                return(true);
            }

            //  string src = doc.GetSrc();
            //  if( src == "hyam(verb.hada.parts)") // 動詞の活用語尾
            //  {
            //      return true;
            //  }
            //  표시하기도 했다 のように離れている語尾を翻訳できなくなる
            //  ので判定しない。

            return(false);
        }
예제 #3
0
        //------------------------------------------------------------
        // 表示用品詞情報作成
        private String MakePosString(DocumentData sd)
        {
            string pos = "";

            // posタグの調査
            if (this.inputIsHangul)
            {
                pos = sd.GetData("pos1");
            }
            else
            {
                pos = sd.GetData("pos2");
            }
            if (pos == "")
            {
                // pos1 or pos2がないなら posで探す
                pos = sd.GetPos();
            }
            if (pos != "")
            {
                // posタグを詳細表示にする
                string posName = Pos.Name(pos);

                if (posName != "")
                {
                    string conjugation = "";
                    if (inputIsHangul)
                    {
                        conjugation = sd.GetData("conju1");
                    }
                    else
                    {
                        conjugation = sd.GetData("conju2");
                    }
                    if (conjugation != "")
                    {
                        posName = posName + " " + conjugation;
                    }

                    return(posName);
                }
            }


            return(pos);
        }
예제 #4
0
        //----------------------------------------------------------------------
        // 1つの語のデータの表示 (通常のKJ_dict用)
        //
        private string DisplayResult(string searchword, DocumentData sd)
        {
            StringBuilder rtn_str = new StringBuilder();

            rtn_str.Length = 0;

            string key_from  = ""; // 検索語
            string key_to    = "";
            string word_from = "";
            string word_to   = "";
            string detail    = "";
            string ex        = "";
            string cost      = "";
            string src       = "";
            string pos       = "";   // 品詞情報、格変化 (暫定)

            String indent = "";

            // 入力がハングルならfromがkey1(ハングル)
            // 入力が漢字・ひらがな・カタカナならfromがkey2(日本語)
            //
            // 入力が数字・英語の場合は,OSに依存。
            //    ・OSが"ja-JP"ならfromがkey1(ハングル)
            //    ・OSが"ja-JP"以外ならfromがkey2(日本語)
            if (this.inputIsHangul)
            {
                key_from  = sd.GetData("key1");
                key_to    = sd.GetData("key2");
                word_from = sd.GetData("word1");
                word_to   = sd.GetData("word2");
                ex        = sd.GetData("ex1");
                cost      = sd.GetData("cost2");
            }
            else
            {
                key_from  = sd.GetData("key2");   // Jp
                key_to    = sd.GetData("key1");   // Kr
                word_from = sd.GetData("word2");
                word_to   = sd.GetData("word1");
                ex        = sd.GetData("ex2");
                cost      = sd.GetData("cost1");
            }


            // 表示の見た目を整える。インデントつけたり、括弧をつけたり。

            // 入力語の表示

            rtn_str.Append(key_from);
            if (word_from != "")
            {
                // 詳細情報は以下の場合だけ
                // ・韓国OSのとき
                //   または
                // ・デバッグ情報表示時
                if (this.cultureName == "ko-KR" ||
                    CodeCheck.IsKanji(word_from) ||
                    Setting.debugInfo)
                {
                    // 詳細情報。ハングルの旧漢字、日本語の読み
                    rtn_str.Append("  〔 " + word_from + " 〕");
                }
            }
            rtn_str.Append("\n");


            // K-->Jの時の入力ハングルのカナ表記の表示
            if (this.Setting.withPronunciation)
            {
                if (this.inputIsHangul)
                {
                    if (this.Setting.PronunciationType == 1)
                    {
                        string kana = Hangul.Hangul2Kana(key_from);
                        rtn_str.Append(" (" + kana + ")\n");
                    }
                    else
                    {
                        rtn_str.Append(indent + " (" +
                                       sd.GetData("pronun1") + ")\n");
                    }
                }
            }


            // もしあれば品詞情報
            pos = MakePosString(sd);
            if (pos != null && pos != "")
            {
                rtn_str.Append(indent + "【 " + pos + " 】\n");
            }

            // もしあれば原形表示
            string root = "";

            if (inputIsHangul)
            {
                root = sd.GetData("root1");
            }
            else
            {
                root = sd.GetData("root2");
            }
            if (root != "")
            {
                string rootname = Pos.conjugationName("conjugation_root");
                rtn_str.Append(indent + "〔(" + rootname + ") "
                               + root + "〕\n");
            }

            // 結果の表示
            rtn_str.Append(indent + key_to);


            // 詳細情報は以下の場合だけ
            // ・韓国OSのとき
            //   または
            // ・デバッグ情報表示時
            if (word_to != "")
            {
                if (this.cultureName == "ko-KR" ||
                    CodeCheck.IsKanji(word_to) ||
                    Setting.debugInfo)
                {
                    rtn_str.Append(" 〔 " + word_to + " 〕");
                    // 詳細情報。ハングルの旧漢字、日本語の読み
                }
            }
            rtn_str.Append("\n");

            // J-->Kの時の結果ハングルのカナ表記の表示
            if (this.Setting.withPronunciation)
            {
                // 表示の設定がされているときだけ
                if (!this.inputIsHangul)
                {
                    if (this.Setting.PronunciationType == 1)
                    {
                        string kana = Hangul.Hangul2Kana(key_to);
                        rtn_str.Append(indent + " (" + kana + ")\n");
                    }
                    else
                    {
                        rtn_str.Append(indent + " (" +
                                       sd.GetData("pronun1") + ")\n");
                    }
                }
            }

            // その他付加情報
            detail = MakeDetailString(sd);
            if (detail != null && detail != "")
            {
                rtn_str.Append(indent + "( " + detail + " )\n");
            }
            if (ex != "")
            {
                rtn_str.Append(indent + "Ex. " + ex + "\n");
            }


            // 「デバッグ情報表示」 を選んだ場合
            if (Setting.debugInfo)
            {
                src = sd.GetData("src");
                if (src != "")
                {
                    rtn_str.Append(indent + "src:" + src + "\n");
                }
                if (cost != "")
                {
                    rtn_str.Append(indent + "cost:" + cost + "\n");
                }
                string pos2 = sd.GetPos(); // posの生データ
                if (pos2 != "")
                {
                    rtn_str.Append(indent + "pos:" + pos2 + "\n");
                }
            }

            rtn_str.Append("\n");

            prev_keyword = key_from;   // 記憶

            return(rtn_str.ToString());
        }