Scroll to navigation

CANNALIB(3) Library Functions Manual CANNALIB(3)


CannaLib_intro — Kana-to-Kanji Conversion Library Intro


Canna provides the following three libraries:

High-level libraries

From application programs, high-level libraries are available without considering Kana-to-Kanji Conversion. Processes such as selecting candidates (including candidate list display) are executed by the Kana-to-Kanji Conversion system. Only fixed character strings are passed to the application. If the Kana-to-Kanji Conversion front end is being used for TTY input, the read (cooked mode) system call in terminal input is regarded as a high-level library. In this case, scanf, which uses it, is also regarded as a higo-level library. The Japanese version of Athena Widget (Text Wideget) in the X Window System is a more typical library that is regarded as a high-level library.

User interface libraries

Responding to one-character or one-key input, user interface libraries return various kinds of information. They include the unfixed character string, fixed character string, marked segment position, status dispaly character string, and candidate list character string. The libraries at this level do not provide the detailed functions involving dictionary maintenance or learning control. There is a little remaining room of divising the display fields although rough lines for Japanese input user interface are restricted. It is recommended that application interfaces at this level be used for an application that desires to obtain keys in raw mode in the TTY. Also, it is recommended that they be used for an application that desires to input and display graphics and characters in a single window.

Dictionary access libraries

Dictionary access libraries are used to control dictionary access or candidate selection directly. Kana-to-Kanji Conversion libraries at this level provide various function interfaces. They include starting the use of Kana-to-Kanji Conversion system, converting the reading into Kanji, changing the splitting of sentence-segment, fetching Next or Previous Candidate, controlling dictionary learning, and maintaining dictionaries. Dictionary access libraries are used to construct a user interface or high-level library. It is recommended that they not be used by ordinary users.

Canna provides three header files and three libraries. Their outlines are listed below:

Header files
Used to input or output Japanese data with X.
Used to input or output TTY-level Japanese data.
Used to use a dictionary access library.
Japanese version of Athena Widget Xaw. The application program does not need to consider Kana-to-Kanji Conversion.
Used to process Japanese data with X. When using XLookupKanjiString or XDrawKanjiString, you must link this library.
Kernel for Japanese data input

Library link and header file include must be done as follows, depending on the function you use:

Athena Widget
libXnw, libXn, libcanna
XLookupKanjiString, XKanjiControl
libXn, libcanna
jrKanjiString, jrKanjiControl
Dictionary access library

Conversion context

Canna enables you to perform two or more Kana-to-Kanji Conversion processes simultaneously. Conversion contextsare used to control management of the respective Kana-to-Kanji Conversion processes. The internal data needed for Kana-to-Kanji Conversion is secured in each context.

The application identifies each conversion context by the context number. It is an integer equal to or larger than 0, and used as the first parameter of any Kana-to-Kanji Conversion function.

Immediately after dictionary access library RkInitialize(3) initializes Kana-to-Kanji Conversion, there is only the standard context, which has the context number 0. It can be used by any application that uses only one context.

Outline of Successive Segment Conversion:

Successive Segment Conversion analyzes the specified Hiragana string, and splits it into a few elements called sentence segments, or Bunsetsu. An example of analysis is shown below:


Each function provided by the dictionary access library's Successive Segment Conversion may either modify the result of this analysis or obtain the analysis information. It assumes a two-dimensional candidate address.

Segment numbers 0, 1, ..., N-1 are assigned leftward to the N segments that have been analyzed. The currently marked candidate is called the current candidate.

For example, ``KANAWO'' may be specified as a candidate having Segment Number 0 and Candidate Number 0. The library instead assumes current segment and candidate in the context to simplify the parameters.


uilib(3) - User Interface Library

diclib(3) - Dictionary Access Library