io.github.nicheapplab.tcodeengine

Generates Japanese characters from key strokes defined by T-Code

Batch vs Interactive engine

BatchEngine provides batched conversion into Japanese. Prefix key strokes should be handled outside of the library.

InteractiveEngine, on the other hand, will handle prefix key strokes and inflex specification internally. It is suitable for IMEs implementation.

Attributes

Members list

Type members

Classlikes

Converts key strokes into Japanese characters by using zip archived dictionary file.

Converts key strokes into Japanese characters by using zip archived dictionary file.

scala> import io.github.nicheapplab.tcodeengine._
scala> val engine = new ArchivedBatchEngine with QwertyLayout
scala> engine.convert("hgjdkdhgjdhgjgjd;gjdkd;gjdja;g")
val res0: String = "で、ので、では、を、のを、とを"

Attributes

Supertypes
trait Strokes
trait BatchEngine
class Object
trait Matchable
class Any
Show all
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
trait Strokes
class Object
trait Matchable
class Any
Show all
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
trait ArchivedStrokes extends Strokes

Attributes

Supertypes
trait Strokes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
trait Strokes
class Object
trait Matchable
class Any
Self type
abstract trait BatchEngine

BatchEngine provides batched conversion into Japanese. Prefix key strokes should be handled outside of the library. It has two subclasses:

BatchEngine provides batched conversion into Japanese. Prefix key strokes should be handled outside of the library. It has two subclasses:

Both of them uses Layout type for its self annotation. Currently QwertyLayout and DvorakLayout are supported.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type
trait Combinator(val strokes: Strokes)

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
abstract trait CombinatorDictionary

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait DvorakLayout extends Layout

Provides validation of Dvorak key stroke for T-Code

Provides validation of Dvorak key stroke for T-Code

Attributes

Companion
object
Supertypes
trait Layout
class Object
trait Matchable
class Any
object DvorakLayout

Defines the keyboard layout of DvorakLayout

Defines the keyboard layout of DvorakLayout

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
abstract class InteractiveEngine extends Strokes

Abstract class of InteractiveEngine, which generates Japanese characters step by step, interacting the user with its method calls.

Abstract class of InteractiveEngine, which generates Japanese characters step by step, interacting the user with its method calls.

It has two subclasses:

Both of them uses Layout type for its self annotation. Currently QwertyLayout and DvorakLayout are supported.

Prefix key strokes should be included in the input key strokes. In the following example, "fj" indicates entering Mixed Conversion mode (as "△", internally). In this mode, user can feed kanji and hiragana mixed input and generates conversion candidates through convert() function.

scala> import io.github.nicheapplab.tcodeengine._
scala> val ie = new ArchivedInteractiveEngine with QwertyLayout
scala> "fjyijstt".foreach(ie.put(_))
scala> ie.inflexRight()
scala> ie.convert()
scala> ie.selectCandidate(0)
scala> ie.commit()
val res0: String = "記者"

To use kanji composition, type the prefix "jf" to enter Composition mode (as "▲", internally). Composition mode can be nested as well as inside of Mixed Conversion mode. In the following example, after typing "fjjfpw.v", its internal buffer will be "△▲木目". By calling InteractiveEngine.convert(), "相" will be generated and "▲" will be consumed. The internal buffer will be "△相". Then typing ".d" ("つ") and "dt"("ぐ") will make the internal buffer to "△相つぐ". InteractiveEngine.inflexLeft() makes it to "△相つ|ぐ", which indicates "ぐ " is the inflex for the conversion. InteractiveEngine.convert() generates InteractiveEngine.candidates buffer. Then the user can choose the desired candidate with its index of the buffer, such as ie.selectCandidates(3). This will clear the candidates buffer and put the converted text "相次ぐ" into outputBuffer. To extract text from outputBuffer, call InteractiveEngine.commit().

scala> "fjjfpw.v".foreach(ie.put(_))
scala> ie.convert()
scala> ".ddt".foreach(ie.put(_))
scala> ie.inflexLeft()
scala> ie.convert()
scala> ie.selectCandidates(0)
scala> "fjjeux".foreach(ie.put(_))
scala> ie.inflexRight()
scala> ie.convert()
scala> ie.selectCandidate(3)
scala> "kgjwjc".foreach(ie.put(_))
scala> ie.commit()
val res0: String = "相次ぐ火事により"

Attributes

Supertypes
trait Strokes
class Object
trait Matchable
class Any
Known subtypes
Self type
abstract trait Layout

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
abstract trait MixedConverterDictionary

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait QwertyLayout extends Layout

Provides validation of Qwerty keys stroke for T-Code

Provides validation of Qwerty keys stroke for T-Code

Attributes

Companion
object
Supertypes
trait Layout
class Object
trait Matchable
class Any
object QwertyLayout

Defines the keyboard layout of QwertyLayout

Defines the keyboard layout of QwertyLayout

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
class SQLiteBatchEngine(jdbc_prefix: String, tcode_tbl_path: String, mazegaki_path: String, bushu_path: String) extends BatchEngine, SQLiteStrokes

Converts key strokes into Japanese characters by using dictionaries stored in SQLite database files. These files locates in the specified locations and are created from zip archivve file for the first time.

Converts key strokes into Japanese characters by using dictionaries stored in SQLite database files. These files locates in the specified locations and are created from zip archivve file for the first time.

scala> import io.github.nicheapplab.tcodeengine._
scala> val (tcode_tbl_path, mazegaki_path, bushu_path) = ...
scala> val jdbc_prefix = "jdbc:sqlite"
scala> val engine = new SQLiteBatchEngine(jdbc_prefix, tcode_tbl_path, mazegaki_path, bushu_path) with QwertyLayout
scala> engine.convert("hgjdkdhgjdhgjgjd;gjdkd;gjdja;g")
val res0: String = "で、ので、では、を、のを、とを"

Attributes

Supertypes
trait Strokes
trait BatchEngine
class Object
trait Matchable
class Any
Show all
Self type
trait SQLiteCombinatorDictionary(jdbc_prefix: String, bushu_path: String) extends CombinatorDictionary

Attributes

Supertypes
class Object
trait Matchable
class Any
class SQLiteInteractiveEngine(jdbc_prefix: String, tcode_tbl_path: String, mazegaki_path: String, bushu_path: String) extends InteractiveEngine, SQLiteStrokes

To use SQLite databases as dictionaries, it must be provided with file path for the database files. If any of the database files don't exist, the missing database file will be created from zip archived dictionary.

To use SQLite databases as dictionaries, it must be provided with file path for the database files. If any of the database files don't exist, the missing database file will be created from zip archived dictionary.

scala> import io.github.nicheapplab.tcodeengine._

scala> val tcode_tbl_path = System.getProperty("java.io.tempdir") ++ "/.t-code-engine/tcode_tbl.db"
scala> val mazegaki_path = System.getProperty("java.io.tempdir") ++ "/.t-code-engine/mazegaki.db"
scala> val bushu_path = System.getProperty("java.io.tempdir") ++ "/.t-code-engine/bushu.db"
scala> val jdbc_prefix = "jdbc:sqlite"
scala> val ie = new SQLiteInteractiveEngine(jdbc_prefix, tcode_tbl_path, mazegaki_path, bushu_path) with QwertyLayout
scala> "fjyijstt".foreach(ie.put(_))
scala> ie.inflexRight()
scala> ie.convert()
scala> ie.selectCandidate(0)
scala> ie.commit()
val res0: String = "記者"

Attributes

Supertypes
trait Strokes
class Object
trait Matchable
class Any
Show all
Self type
trait SQLiteMixedConverterDictionary(jdbc_prefix: String, mazegaki_path: String) extends MixedConverterDictionary

Attributes

Supertypes
class Object
trait Matchable
class Any
trait SQLiteStrokes(jdbc_prefix: String, dbPath: String) extends Strokes

Attributes

Supertypes
trait Strokes
class Object
trait Matchable
class Any
Known subtypes
abstract trait Strokes

Provides the map of Qwerty two-keys-stroke to Japanese character

Provides the map of Qwerty two-keys-stroke to Japanese character

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes