[[韓日ミニ辞典開発歴]]に戻る

#contents
*요の分岐処理 [#n6d4d7f0]

最初に,文字列が"요"で終わる場合の分岐処理を書きます&br;

 case 0: #母音終わり&br;
 switch ($last_spel) {&br;
  case "가": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_ga($morph, $last_morph, "", "");&br;
    break;&br;
  case "게": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_ge($morph, $last_morph, "", "");&br;
    break;&br;
  case "고": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_go($morph, $last_morph, "", "");&br;
    break;&br;
  case "과": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_gwa($morph, $last_morph, "", "");&br;
    break;&br;
  case "도": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_do($morph, $last_morph, "", "");&br;
    break;&br;
  case "에": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_qe($morph, $last_morph, "", "");&br;
    break;&br;
  case "와": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_qwa($morph, $last_morph, "", "");&br;
    break;&br;
  case "요": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_qyo($morph, $last_morph, "", "");&br;
    break;&br;
  case "의": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_qyi($morph, $last_morph, "", "");&br;
    break;&br;
  case "이": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_qi($morph, $last_morph, "", "");&br;
    break;&br;
  }&br;
  break;&br;
 case 4: #N終わり&br;
 switch($last_spel) {&br;
  case "는": &br;
    $last_morph = substr($morph, $len_w-6, 3);&br;
    $found = Analyze_nyn($morph, $last_morph, "", "");&br;
    break;&br;
  case "던": &br;
{以下略}&br;

*요の形態素解析処理 [#x45eee3b]
요の前が「아,어,해」の3通りの場合に分けて処理を行います。&br;
아であれば,その前の母音が陽母音か否かを調べます。&br;
어であれば,その前の母音が陰母音か否かを調べます。&br;
해であれば,해を하に変えます。&br;

#------------------------#&br;
#  qyoの解析形態素解析   #&br;
#------------------------#&br;
function Analyze_qyo($morph, $last_morph, $x, $y) {#utf-8code&br;
$found="";&br;
global $flag;&br;
global $script;&br;
global $pastSet;&br;
$ending="(略式丁寧体語尾=平叙文・疑問文・勧誘文・命令文)";&br;
  $l_m=strlen($morph);&br;
  $stem = substr($morph, 0, $l_m-3); #語幹の切り出し&br;
  if ($last_morph=="아"){&br;
    $last_stem = substr($morph, $l_m-6, 3);&br;
    $last_Scode = substr(Uni_conv($last_stem),0,5)-44031;&br;
    $last_Scode = substr(Uni_conv($last_stem),0,5)-44032;&br;
    $VowCons_code = $last_Scode % 28;&br;
    $Vow_code = (($last_Scode - $VowCons_code) % 588 ) /28 ; #母音の種類&br;
      if ($Vow_code==0||$Vow_code==2||$Vow_code==8){&br;
        $found+=1;&br;
        $keyword = mb_convert_encoding($stem."다", 'UTF-8', 'auto');&br;
        print "【解析".$found."】 <a href=\"$script?key=$keyword\">".$stem."</a>(陽語幹用言)+";&br;
        print "아요".$ending."<br>";&br;
      } else {&br;
        print "<font color=red>入力間違いの可能性があります:".$stem."+아요【陽母音と陰母音または縮約形】</font><br>\n";&br;
      }&br;
    } elseif ($last_morph=="어") { #-어요&br;
      $last_stem = substr($morph, $l_m-6, 3);&br;
      $last_Scode = substr(Uni_conv($last_stem),0,5)-44031;&br;
      $last_Scode = substr(Uni_conv($last_stem),0,5)-44032;&br;
      $VowCons_code = $last_Scode % 28;&br;
      $Vow_code = (($last_Scode - $VowCons_code) % 588 ) /28 ; #母音の種類&br;
      if ($Vow_code<>0&&$Vow_code<>2&&$Vow_code<>8){&br;
        $found+=1;&br;
        $keyword = mb_convert_encoding($stem."다", 'UTF-8', 'auto');&br;
        print "【解析".$found."】 <a href=\"$script?key=$keyword\">".$stem."</a>(陰語幹用言)+";&br;
        print "어요".$ending."<br>";&br;
      } else {	&br;
        print "<font color=red>入力間違いの可能性があります:".$stem."+어요【陽母音と陰母音または縮約形】</font><br>\n";&br;
      }&br;
    } elseif ($last_morph=="해") { #-해요&br;
      $newStem=$stem."하";&br;
      $found+=1;&br;
      $keyword = mb_convert_encoding($newStem."다", 'UTF-8', 'auto');&br;
      print "【解析".$found."】 <a href=\"$script?key=$keyword\">".$newStem."</a>(하語幹用言)+";&br;
      print "여요".$ending."<br>";&br;
    }&br;
  return $found;&br;
}&br;

[[韓日ミニ辞典開発歴]]に戻る

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS