[Freewnn-users 325] Re: romkan ファンクションの仕方 (Using romkan functions)

Back to archive index
ishik****@ubin***** ishik****@ubin*****
2019年 3月 25日 (月) 12:50:15 JST


(I am sorry that I needed to post twice since I failed to use the original
short-hand address with which I am registered to the mailing list and thus
Alex may receive this e-mail three times. But here it goes.)

Dear Alex,

The last time you wrote early in 2018, you seem to read English, so I am
writing in English here.

I hope you will receive a definite answer from someone in the know.

I am giving just an observation regarding roman conversion.

In my environment where I use freewnn under linux (I have a few, and I used
to run a version of solaris where the commercial version of Wnn[6-8]? was
running. But I ditched solaris.),
it seems that roman input to hiragana or katakana string conversion is
handled OUTSIDE
Wnn: That is, the conversion is done BEFORE the string is sent to Wnn.

E.g.: I use two front ends to talk to Wnn server. One is from within Emacs
editor, and the other is kinput2-wnn front end for X based programs that
uses XIM protocol.

Let me explain the input behavior of two frontends. Well, actually one is
the behavior in a dedicated editor.
The other is a general-purpose input frontend under X.

Emacs: I use an input mode called 'egg'. This is rather old. I am not sure
how many people use it. But old timers like me still use it. I know my
friends from college days are still using it for sure.

Anyway, in this submode for text input inside Emacs, roman letter keystrokes
are captured and converted automatically into Hiragana strings which are
subsequently passed to Wnn for conversion.
Now, Wnn may return a series of (sub) strings, candidates for bunsetsu
conversion, which *MAY* include Katakana characters.
For example, there seems to be an entry, (たわー, タワー)in Wnn dictionary that
I use,
so if I type tokyotawa- to Emacs, it is automatically converted to
|とうきょうたわー| on the fly WITHIN Emacs.
The pair of vertical bar automatically appears  when I type a roman letter
for the first time within 'egg' input mode, and the keystrokes are echoed
back inside the pair of vertical bars and automatically converted to hiragana.
Inside this 'egg' input mode (not to be confused with modern packaging mode
called by the same name),
SPACE key signals the conversion request, so when I hit SPACE after I see
|とうきょうたわー|, the conversion engine Wnn is consulted and I get |東京
タワー|. Note the space between two bunsetsus, 東京 and タワー.
First  I can choose the next alternative for とうきょう part. 
I can hit SPACE to choose the next alternative repeatedly.
Once I am satisfied, I move the cursor to タワー part.
Then I can choose the alternative  for the string タワー part. Finally, when I
am satisfied I hit [ENTER].
Now the vertical bars that surrounds 東京タワー disappears automatically.

I *CAN* request the conversion of hirakana strings to katakana explicitly
INSIDE emacs.
This is done by hitting ESC-K within emacs when I see |とうきょうたわー|. This
will become |トウキョウタワー|.

(This conversion can be used within Emacs when it runs as character-only
editor WITHOUT X windows)

kinput2-wnn: kinput2 is a frontend that sits between an X11 application and
Wnn server and requires X windows to run. It uses XIM.
kinput2-wnn is a slightly modified version that groks configuration file
that allows  very similar keystroke sequences that are used in Emacs's egg
input mode.
The configuration feature is very capable and I understand that there are
many flavors of input style for hiragana/katakana/roman input.

I am using the following input style: first roman input, which is converted
to hiragana string (done within knput2-wnn), and then converted to
kana-kanji string by Wnn.
But I understand direct input of hiragana using Japanese keyboard is
possible by properly configuring kinput2-wnn.
(Correct me if I am wrong here.)

NOTE: there is a bug in keyevent handling of mozilla firefox/thunderbird,
and the following steps that worked before (until September 2017) will not
work until firefox 68 will be released. (It was fixed early this month.) I
can find the relevant bugzilla entry if you need it.
Only mozilla software was affected and other X-based app can be made to
accept Japanese input using kinput2-wnn.

In my set up, I hit control-SPACE (configurable) to enter Japanese input
mode by means of Kinput2-wnn.
I can basically type tokyoutawa- and obtain とうきょうたわー as I type the roman
string.
Then you hit SPACE to signal the conversion to obtain 東京タワー and get a
highlighted (reversed) substring of 東京 on the display. The highlighting
indicates that it is the target of conversion. I can hit SPACE
(configurable) to select different alternative conversion string.
Again, please note that the たわー to タワー conversion is done by Wnn because
there is an entry (たわー、タワー)in the dictionary.
I am using a configuration file for Emacs's Egg-like input behavior.
So, in my setup, I can request the conversion to Katakana explicitly by
hitting ESC-k just as in Emacs.
After I hit tokyotawa- to obtain とーきょーたわー, I can hit ESC-k  to obtain
トーキョータワー.

This is my observation. (The details are omitted for simplicity.)

It may be that the romanization feature of Wnn server may not be tested
extensively since many input frontends find it easier or more flexible than
to talk to Wnn server.

Well, again, I hope someone in the know will chime in, but this romanization
feature may not be used by many due to the reason I mentioned above.

Chiaki

PS: Of course, the majority of linux users use other Japanese input methods
according to some statistical data
gathered by mozilla foundation. But I think kinput2(-wnn) users are still
there until they perish due to old age :-)




On 2019年03月25日 03:02, Alex Taylor wrote:
> 皆さん、こんにちは。
>
> (可笑しい日本語のこと、大変失礼します。)
>
> 私は今、Wnn の romkan
> というファンクションを使ってみます。だいたいローマ字からひらがなに変換できます。しかし、他の入力モード(全角、半角のカタカナなど)を使うことがわかりません。 f-_-;
>
> 下記のコードで変換のことをしています。
> (フル・ソース:http://altsan.org/programming/test_romkan.tar.gz)
>
> ========================================================================
>     rc = romkan_init( rk_file, 0x08, 0, *next_char, *byte_count );
>     // ...
>     i = 0;
>     do {
>         ltr = romkan_getc();
>         if ( ltr && is_HON( ltr )) {
>             if ( i > (len - 1)) {
>                 len += 16;
>                 output_str = (char *) realloc( output_str, len );
>             }
>             output_str[i++] = (char)(ltr & 0xFF);
>             if ( verbose ) printf("value: %X\n", ltr );
>         }
>
>     } while (( verbose || ltr ) && ( ltr != LTREOF ));
>
>     printf("Converted %d bytes: %s\n", i, output_str );
> ========================================================================
>
> 例えば input_str というのは "Watashinonamaehanakanodesu." の場合、 結果は
>
> Converted 28 bytes: わたしのなまえはなかのです。
>
> ということですが、何方様がどうやってカタカナに変換できるのをわかりますか。
>
> romkan の設定ファイル (rk/mode など)にインクルードされた 2A_CTRL
> というファイルには
>
> (unless esc)'\x81'    (switch katakana)
> (unless esc)'\x82'    (switch zenkaku)
> (unless esc)'\x83'    (switch romkan)
>
> が入っています。そのように '\x81' (またはオクタルで '\201')を input_str
> に入れるとカタカナモードに変わると思いましたが、そのことではなさそうです。 ;_;
>
>
> 例えば上記の string に名を「テーラ」にしたいから、
> "Watashinonamaeha\201te-ra-\201desu."
> を使ってみましたが、まだ全て平仮名になりました。
> Converted 28 bytes: わたしのなまえはてーらーです。
>
> しかし、 '\x83' (オクタル '\203')を入れると、ローマ字仮名変換が 2A_CTRL
> に書いてあること通りオフになります。
> "Watashinonamaeha\203te-ra-\203desu." -->
> Converted 28 bytes: わたしのなまえはte-ra-です。
>
> 慌てています。(-_-)
>
> 何方が、カタカナに入力できることをしっていますか?
>
> どうもありがとうございます。
>



freewnn-users メーリングリストの案内
Back to archive index