差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
最新のリビジョン両方とも次のリビジョン
dokuwiki:localize [2007/07/29 12:14] osamudokuwiki:localize [2007/07/31 15:31] osamu
行 72: 行 72:
 ^D</code> ^D</code>
 のように、入力した文字が分かち書きされて表示されればOK。 のように、入力した文字が分かち書きされて表示されればOK。
 +
  
  
行 163: 行 164:
 また、indexer.phpにwordlen()という関数があるが、これも同じくアジア圏の文字は1文字1単語とみなす処理が入っているので また、indexer.phpにwordlen()という関数があるが、これも同じくアジア圏の文字は1文字1単語とみなす処理が入っているので
 <code php> <code php>
-    if(preg_match('/'.IDX_ASIAN2.'/u',$w)) +function wordlen($w){ 
-        $l += ord($w) - 0xE1;  // Lead bytes from 0xE2-0xEF+    // $l = strlen($w); 
 + 
 +    $l = utf8_strlen($w); 
 + 
 +    //// If left alone, all chinese "words" will get put into w3.idx 
 +    //// So the "length" of a "word" is faked 
 +    //if(preg_match('/'.IDX_ASIAN2.'/u',$w)) 
 +    //    $l += ord($w) - 0xE1;  // Lead bytes from 0xE2-0xEF 
 + 
 +    return $l; 
 +}
 </code> </code>
-の2行もコメントアウトする+と変更
  
 +それから、同じくindexer.php の idx_getIndexWordsSorted() 関数の中に、
 +<code php>
 +        if ($wlen < 3 && $wild == 0 && !is_numeric($xword)) continue;
 +</code>
 +という部分があるが、このままだと3文字より短い単語を検索できない。英語などではそれでもよいのだが、日本語の場合1~2文字の単語も検索できないと困るので、これを
 +<code php>
 +        if (preg_match('/[^0-9A-Za-z]/u', $string) && $wlen < 3 && $wild == 0 && !is_numeric($xword)) continue;
 +</code>
 +と書き換える。
 //2005-12-8 - Mecabのプロセスがハングアップして残ってしまうのを避けるために''stream_set_blocking()''を追加//\\  //2005-12-8 - Mecabのプロセスがハングアップして残ってしまうのを避けるために''stream_set_blocking()''を追加//\\ 
 //2007-7-29 - DokuWikiの最近のバージョンにあわせて、修正箇所の説明を変更// //2007-7-29 - DokuWikiの最近のバージョンにあわせて、修正箇所の説明を変更//
dokuwiki/localize.txt · 最終更新: 2007/07/31 15:36 by osamu
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0