Page Index Toggle Pages: 1 Send TopicPrint
Sticky Topic Version 2 beta (Read 372 times)
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 2300
Joined: Oct 19th, 2005
Version 2 beta
Jun 3rd, 2020 at 6:16am
Print Post  
Version 2 of Virtual Keyboard for Java adds support for IME mode and CJK languages -

General IME mode
The component now supports general IME mode that maps raw input sequence to dictionary entries. The keyboard collects clicked characters in a staging area and shows the matching entries as suggestions. Users can either click a suggestion button to send its content as input, or click the space key to send the first suggestion.
To enable IME mode, call the LoadImeTable method, specifying the language for which to load IME table and the dictionary file path. The table file format contains one line per entry, with three tab delimited values: raw input, translation, frequency. For example, a hypothetical IME table that translates chemical formulas to compound's common name could look like this:

Code
Select All
c3h8o	Propan-2-ol	2
c3h8o	Propanol	4
h2o	Water	1
c3h8o	Methoxyethane	1
c3h8o	Propan-1-ol	3
c2h6	Ethane	1
c3h7br	1-bromopropane	3
c3h7br	2-bromopropane	2
....
vkb.loadImeTable(
    new Locale("en", "US"), "chemical.txt"); 



and suggestions for the partial input "c3h" will look like this:



Chinese
The component can parse IME tables from the Linux Ibus project to implement various Chinese transliteration systems. For example you can load following tables for respectively mainland China's simplified Chinese, Taiwan's traditional Chinese and Hong-Kong's Cangjie input methods: Pinyin, Zhuyin, Cangjie.

The following image shows the Zhuyin input method:


Japanese
If current language is Japanese, the keyboard renders Hiragana characters. In addition, LoadImeTable can parse tables from Google's mozc project to convert Hiragana to Kanji. To enable this mode, specify path to a directory containing the 10 dictionary files from following link:
https://github.com/google/mozc/tree/master/src/data/dictionary_oss

This image demonstrates Hiragana to Kanji conversion:


Korean
The keyboard renders Hangul letters when current language is Korean, and automatically enables IME mode that converts letter sequences to Hangul syllabic blocks according to Unicode rules:



If anyone is interested in trying the beta version, please download this archive containing updated jar file:
https://mindfusion.eu/_beta/vkjava2.zip

Note that the open source Chinese and Japanese dictionaries have licensing terms of their own - some are in the public domain, some include attribution / no warranty clauses, some are LGPL. For licensing terms, check comments in respective dictionary files or license sections of their parent project. If there is enough interest, we will consider providing built-in dictionaries on MindFusion's standard licensing terms for next releases.

Any comments, questions and general feedback are welcome.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint