Subject: bug#5990: 23.1; Cannot type the word 買います

From: Naohiro Aota <[email-masked]>
Date: Tue, 31 Aug 2021 15:13:09 +0900

On Thu, Aug 26, 2021 at 09:21:12PM +0200, Lars Ingebrigtsen wrote:
> Alex <[email-masked]> writes:
> 
> >> If there are significant updates, we can import a new version for the
> >> next release, I think.
> >
> > I can't say anything on that front, but I tried updating the Japanese
> > dictionary to the latest version using skkdic-convert in
> > lisp/international/ja-dic-cnv.el and it still gave the "wrong" results for
> > 買います.

Background: I'm Japanese.

> In Emacs 28, I'm getting:
>

These are still all valid (possible) kanji conversion for "kaimasu".

> 魔居間す

(This looks strange. I guess there are some mistakes for this one.)

> 加居間す
> 過居間す
> 可居間す

All these can be read as "ka" (加, 過, 可) + "ima" (居間) + "su" (す).

> かいます

The implementation of leim's kanji conversion is so simple as
follow. In short, it just find the longest match from the dictionary
even if it is strange (for Japanese) or not.

  (setq kkc-current-key (string-to-vector kkc-original-kana))
  (setq kkc-length-head (length kkc-current-key))
  (unwind-protect
      ...
	(while (not (kkc-lookup-key kkc-length-head nil first))
	  (setq kkc-length-head (1- kkc-length-head)
		first nil))

So, we get the longest conversion of "kaimasu" as "kaima" as above.

To get "買います", we need explicitly set the conversion length to 2
with C-o/C-i. It can be reproduced in a code like this:

(let ((kkc-current-key "かいます"))
  (kkc-lookup-key 2)
  kkc-current-conversions)
(1 "買い" "書い" "描い" "飼い" "画い" "欠い" "掻い" "嗅い" "交い" "畫い" "缺い" ...)
;;  `-- Here, we have the "買います" result
   
(let ((kkc-current-key "かいます"))
  (kkc-lookup-key 3)
  kkc-current-conversions)
(1 "垣間" "加居間" "過居間" "可居間")

> So I'm not getting 買います here, either.
> 
> But I guess we're just using whatever is in:
> 
> http://openlab.ring.gr.jp/skk/skk/dic/SKK-JISYO.L
> 
> (Our version was updated earlier this year.)  So is this something that
> we can fix on our side, or is it just what this dictionary says?  

Well, other IM like mozc is much more intelligent to prefer "買います"
than the above three conversions because "買います" is plausible.

IMHO, implementing such complex algorithm is out of scope for leim. It
still can be a "rescue" tool even with the simple algorithm if you can
set a proper conversion length. And, we anyway use other IM like mozc,
SKK, tc.el.

Thanks,

> -- 
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
> 
> 
>