     [file front.txi not included]

This is the reference manual for the KText program.

Overview of KTEXT
*****************

This section briefly describes what KTEXT does, places KTEXT in its computational context, lists technical specifications of the program, and gives information on use and support of the program.

What does KTEXT do?
===================

KTEXT is a text processing program that uses the PC-KIMMO parser (see below about PC-KIMMO).  KTEXT operates in two modes: analysis and synthesis.  In analysis mode, KTEXT reads a text from a disk file, parses each word, and writes the results to a new disk file.  This new file is in the form of a structured text file where each word of the original text is represented as a database record composed of several fields.  Each word record contains a field for the original word, a field for the underlying or lexical form of the word, and a field for the gloss string.  For example, if the text in the input file contains the word beginning (to use an English example), KTEXT's output file will have a record of this format:

     \a be`gin +ING
     \d be`gin-+ING
     \cat V
     \fd ing
     \w beginning

This record consists of five fields, each tagged with a backslash code. (The particular choice of field markers and the order of fields in a record is due to the fact that KTEXT uses the same text-handling routines as an existing program called AMPLE (Weber et al., 1988).  This has the advantage that KTEXT's output is compatible with that program, but the disadvantage that the record structure is perhaps not consistent with terminology already established for PC-KIMMO.  It should also be noted that the quasi-database design of KTEXT's output is used by many other programs developed by SIL International.)  The first field, tagged with \a for analysis, contains the gloss string for the word.  The second field, tagged with \d for (morpheme) decomposition, contains the underlying or lexical form of the word. The third field, tagged with \cat for category, contains the grammatical category of the word.  The fourth field, tagged with \fd for feature descriptions, contains a list of feature abbreviations associated with the word, and the fourth field, tagged with \w for word, contains the original word.  The word pictures (which can be analyzed as either a verb or a noun) demonstrates how KTEXT handles multiple parses:

     \a %2%`picture +3SG%`picture +PL%
     \d %2%`picture-+s%`picture-+s%
     \cat %2%V%N%
     \fd %d%s%-3sg pl%
     \w pictures

Percent signs (or some other designated character) separate the multiple results in the \a, \d, \cat, and \fd fields, with a number indicating how many results were found.

A word record also saves any capitalization or punctuation associated with the original word.  For example, if a sentence begins ``Obviously, this hypothesis...'', KTEXT will output the first word like this:

     \a `obvious +AVR1
     \d `obvious-+ly
     \cat AV
     \w obviously
     \c 1
     \n ,

The \w field contains the original word without capitalization or the following comma.  The \c field contains the number 1 which indicates that the first letter of the original word is upper case.  The \n field contains the comma that follows the original word.  The purpose of retaining the capitalization and punctuation of the original text is, of course, to enable one to recover the original text from KTEXT's output file.

In synthesis mode, KTEXT takes an analysis file compatible with that produced by KTEXT in analysis mode and produces an orthographic text file comparable to the original.

Placing KTEXT in its context
============================

KTEXT can only be understood by describing two other programs: PC-KIMMO and CARLA.  First, we will take a look at PC-KIMMO.

KTEXT is intended to be used with PC-KIMMO (though it is a stand-alone program).  PC-KIMMO is a program for doing computational phonology and morphology.  It is typically used to build morphological parsers for natural language processing systems.  PC-KIMMO is described in the book PC-KIMMO: a two-level processor for morphological analysis by Evan L. Antworth, published by the Summer Institute of Linguistics (1990). The PC-KIMMO software is available for MS-DOS and Windows (IBM PCs and compatibles), Macintosh, and UNIX.  The book (including software) is available for $23.00 (plus postage) from:

         International Academic Bookstore
         7500 W. Camp Wisdom Road
         Dallas TX, 75236
         U.S.A.

         phone: 972/708-7404
         fax:   972/708-7433

The KTEXT program which this document describes will be of very little use to you without the PC-KIMMO program and book.  The remainder of this document assumes that you are familiar with PC-KIMMO.

PC-KIMMO was deliberately designed to be reuseable.  The core of PC-KIMMO is a library of functions such as load rules, load lexicon, generate, and recognize.  The PC-KIMMO program supplied on the release diskette is just a user shell built around these basic functions.  This shell provides an environment for developing and testing sets of rules and lexicons.  Since the shell is a development environment, it has very little built-in data processing capability.  But because PC-KIMMO is modular and portable, you can write your own data processing program that uses PC-KIMMO's function library.  KTEXT is an example of how to use PC-KIMMO to create a new natural language processing program.  KTEXT is a text processing program that uses PC-KIMMO to do morphological parsing.

KTEXT is also closely related to a system called CARLA, which stands for Computer Assisted Related Language Adaptation.  CARLA is a type of machine translation system designed to work between closely related languages.  CARLA is based on the Analysis Transfer Synthesis (ATS) paradigm of adaptation.  This paradigm involves three stages:

 1. Analysis.  The text to be adapted is converted to an abstract representation, composed of units (in our case, words and morphemes) which are defined in source language dictionaries.  (No attempt is made to represent the meaning of the text, only the units that comprise the text.)

 2. Transfer.  Given known, systematic differences between the source and target languages, the result of Analysis is converted to an abstract representation of what it should be for the target language, using units defined in target language dictionaries.

 3. Synthesis. Given information about the target language, the abstract representation resulting from Transfer is converted to a concrete, textual form.

When used in analysis mode, KTEXT performs the Analysis task.  In the original CARLA system, analysis is done by a program called AMPLE (Weber et al. 1988), which is also a morphological parser designed to process text.  KTEXT was created by replacing AMPLE's parsing engine with the PC-KIMMO parser.  Thus KTEXT has the same text-handling mechanisms as AMPLE and produces output similar or even identical to AMPLE.  The advantages of this design are (1) we were able to develop KTEXT very quickly and easily since it involved very little new code, and (2) existing programs that use AMPLE's output format can also use KTEXT's output.  The disadvantage of basing KTEXT on AMPLE is that the format of the output file is perhaps not consistent with terminology already established for PC-KIMMO.

When KTEXT is used in synthesis mode, it performs the Synthesis task. In the original CARLA system, synthesis is done by a program called STAMP (Weber et al. 1990).  However, STAMP also performs the Transfer task; KTEXT does not have this capability.

Technical specifications
========================

KTEXT runs under four operating systems:

  * MS-DOS (IBM PC compatibles with a 386 or higher processor)

  * Microsoft Windows

  * UNIX

  * Apple Macintosh

KTEXT does not require any graphics capability.  It handles eight-bit characters (such as the IBM PC extended character set or the Windows ANSI character set).  The Windows and Macintosh versions have the same user interface as the MS-DOS and UNIX versions, namely a batch-processing, command-line interface.  In other words, a GUI version does not exist.

The MS-DOS executable requires a 386 or newer CPU and a DPMI server.  This has the advantage of allowing the program to use as much memory as necessary without constraining it to the archaic 640K limit.  (DPMI is provided automatically by Windows.  A free DPMI server is distributed with the MS-DOS executable.)

The program is written in C and is very portable.  The Macintosh version was compiled with the Metrowerks C compiler. The sources available at URL ftp://ftp.sil.org/software/unix/ktext-*.zip can be compiled for any of the four target platforms.

Program status
==============

KTEXT was developed by Stephen McConnel and Evan Antworth of SIL International.  Several qualifications apply to its use and support:

 1. This software, source code and executable program, is copyrighted by SIL International.  You may use this software at no cost.  You are granted the right to distribute this software to others, provided that all files are included in unmodified form and that you charge no fee (except cost of media).  This software is intended for academic or other personal use only, and may not be distributed or used for commercial profit without express permission of SIL International.

 2. This software represents work in progress and bears no warranty, either expressed or implied, of its fitness for any particular purpose.

 3. In releasing this software, SIL International is making no commitment to maintain it.  It is, however, committed to forwarding user feedback to the software's authors who may or may not choose to develop the software further.

Bug reports, wish lists, requests for support, and positive feedback should be directed to Evan Antworth at this address:

         Stephen McConnel
         Language Software Development
         SIL International
         7500 W. Camp Wisdom Road
         Dallas, TX  75236
         phone: 972/708-7361
         email: Stephen_McConnel@sil.org

Examples of using KTEXT
***********************

Using KTEXT to analyze a text
=============================

Typically, the steps involved in using KTEXT to analyze texts are:

 1. Collect a corpus of language data suitable for phonological and morphological analysis (typically paradigms of words).

 2. Do phonological and morphological analysis on the data.

 3. Use the PC-KIMMO shell to develop a rules file, lexicon, and grammar file that encode your phonological and morphological analyses and to test them against your corpus of data.

 4. Select a text and keyboard it.

 5. Set up the additional control files required for KTEXT analysis.

 6. Use the rules, lexicon, and grammar you developed to process the text with KTEXT in analysis mode.

 7. Edit KTEXT's output file to remove multiple parses.

 8. Use the edited file as input to some other program.

To demonstrate how to use KTEXT to process a text in analysis, we will use Englex, a morphological grammar of English for PC-KIMMO, and analyze a paragraph of Alice's Adventures in Wonderland, by Lewis Caroll.  The first paragraph of the text is shown in figure 1.

     Figure 1. Excerpt from Alice

     \id Alice.txt - Lewis Carroll's Alice's Adventures in Wonderland

     \ti Down the Rabbit-Hole
     \p
     Alice was beginning to get very tired of sitting by her sister
     on the bank and of having nothing to do: once or twice she had
     peeped into the book her sister was reading, but it had no pictures
     or conversations in it, "and what is the use of a book," thought Alice,
     "without pictures or conversations?"
     \p
     So she was considering, in her own mind (as well as she could, for
     the hot day made her feel very sleepy and stupid), whether the pleasure
     of making a daisy-chain would be worth the trouble of getting up and
     picking the daisies, when suddenly a White Rabbit with pink eyes ran
     close by her.

The text was keyboarded using a very simple system of document markup that tags parts of the document with backslash codes.  The \it tag identifies the text; the \ti tag indicates the title of the story; and the \p tag indicates the beginning of a paragraph. The next step is to process the text with KTEXT in analysis mode.  Run the KTEXT application with these command line options:

     ktext -x ana.ctl -i alice.txt -o alice.ana -l ana.log

where ana.ctl is the analysis control file, alice.txt is the input text file, alice.ana is the output analysis file, and alice.log is the analysis log file.  The following display will appear on the screen:

     KTEXT (analyze/synthesize words using PC-Kimmo functions)
     Version 2.0b11 (November 1, 1996), Copyright 1996 SIL
     Beta test version compiled Nov  7 1996 15:11:16
     with PC-Kimmo functions version 2.1b7 (November 6, 1996)
       and PC-PATR functions version 0.99b0 (November 7, 1996)
     For 386 CPU (or better) under MS-DOS [compiled with DJGPP 2.1/GNU C 2.7]

       affix.lex                          255 entries
       noun.lex                         10461 entries
       verb.lex                          4215 entries
       adjectiv.lex                      3345 entries
       adverb.lex                         400 entries
       minor.lex                          379 entries
       proper.lex                        1057 entries
       abbrev.lex                         127 entries
       technica.lex                       813 entries
       natural.lex                        435 entries
       foreign.lex                         88 entries

     5...2.2..2  ..22.2.2..  2.222.2.22  ..22.2.222  22..22.22.
     2..23.22..  2.2.22.225  2..2...22.  ......2...  4.22.2..4.  100
     ...2..2..2  2.222

Each dot represents one word successfully processed.  Multiple analyses of a word are indicated by numbers; thus the first word down received five analyses.  When the program is done, it will return you to the operating system prompt.  A fragment of the resulting output file is shown in figure 2.

     Figure 2  Output of KTEXT

     \a	%5%`down%`down%`down%`down%`down%
     \d	%5%`down%`down%`down%`down%`down%
     \cat	%5%AV%V%AJ%N%PP%
     \fd	%5%%vbase%%sg%%
     \w	down
     \c	1

     \a	the
     \d	the
     \cat	DT
     \w	the

     \a	`rabbit - `hole
     \d	`rabbit---`hole
     \cat	N
     \fd	sg
     \w	rabbit-hole
     \c	516
     \n	\n

One obvious way to continue is to reassemble the text in interlinear format.  That is, we could write a program that would take the data structures shown in figure 2 and create a new file where the text is stored in interlinear format.  The resulting interlinear text is shown in figure 3.  An interlinear text editor like IT (IT (pronounced ``eye-tee'') is an interlinear text editor that maintains the vertical alignment of the interlinear lines of text and uses a lexicon to semi-automatically gloss the text.  See Simons and Versaw (1991) and Simons and Thomson (1988).) could then be used to add more lines of annotations to the text.

     Figure 3  An English example of interlinear text format

     Down	the	Rabbit	-	Hole
     `down	the	`rabbit	-	`hole
     PP	DT	N	-	N

Interlinear translation is a time-honored format for presenting analyzed vernacular texts.  An interlinear text consists of a baseline text and one or more lines of annotations that are vertically aligned with the baseline.  In the text shown in figure 3, the first line is the baseline text.  The second line provides the lexical form of each original word, including morpheme breaks.  The third line gives the category or part-of-speech of each word.

Another way to proceed would be to take the output of KTEXT as shown in figure 2 and format it directly for printing.  In other words, there would be no disk file of interlinear text corresponding to figure 3; rather, the interlinear text is created on the fly as it is prepared for printing.  Fortunately, the software required to print interlinear text is now available.  As a complement to the IT program, a system for formatting interlinear text for typesetting has recently been developed (see Kew and McConnel, 1991).  Called ITF, for Interlinear Text Formatter, (ITF was developed by the Academic Computing Department of the Summer Institute of Linguistics. It runs under MS-DOS, UNIX, and the Apple Macintosh.)  it is a set of TeX (TeX is a typesetting language developed by Donald Knuth (see Knuth, 1986).) macros that can format an arbitrary number of aligning annotations with up to two freeform (nonaligning) annotations. While ITF is primarily intended to format the data files produced by IT (similar to the interlinear text shown in figure 3), an auxiliary program provided with ITF accepts the output of the KTEXT program.  The final printed result of the formatting process is shown in figure 4. (The plain text version of this
documentation does not include figure 4, since it is
an image of typeset output.)  It should be noted that this is just one of many formats that ITF can produce.  Because ITF is built on a full-featured typesetting system, virtually all aspects of the formatting detail can be customized, including half a dozen different schemes for laying out the freeform annotations relative to the interlinear text.

Figure 4. Output of ITF

[ This figure is not available in INFO documentation. ]

Using KTEXT to synthesize a text
================================

Normally, in an adaptation project, the text is adapted from a source language to a target language via a Transfer component.  For the purpose of this example, we will use English as both the source and target language, thus obviating the need for a Transfer component.  If the synthesis operation produces a text which is identical to the original text, then we have proved the efficacy of the system.

Typically, the steps involved in using KTEXT in synthesis mode are:

 1. Collect a corpus of language data suitable for phonological and morphological analysis (typically paradigms of words).

 2. Do phonological and morphological analysis on the data.

 3. Use the PC-KIMMO shell to develop a rules file and a lexicon file that encode your phonological and morphological analyses and to test them against your corpus of data.

 4. Set up the control files required by KTEXT for synthesis mode.  Using the rules and lexicon you developed, use KTEXT in synthesis mode to process an analyzed text.

To synthesize the original text from the analysis file, run the KTEXT application with these command line options:

     ktext -s -x syn.ctl -i alice.ana -o alice.syn -l syn.log

where syn.ctl is the synthesis control file, alice.ana is the input analysis file, alice.syn is the synthesized output text file, and syn.log is the synthesis log file.  The following display will appear on the screen:

     KTEXT (analyze/synthesize words using PC-Kimmo functions)
     Version 2.0b11 (November 1, 1996), Copyright 1996 SIL
     Beta test version compiled Nov  7 1996 15:11:16
     with PC-Kimmo functions version 2.1b7 (November 6, 1996)
       and PC-PATR functions version 0.99b0 (November 7, 1996)
     For 386 CPU (or better) under MS-DOS [compiled with DJGPP 2.1/GNU C 2.7]

       affix.lex                          255 entries
       noun.lex                         10461 entries
       verb.lex                          4215 entries
       adjectiv.lex                      3345 entries
       adverb.lex                         400 entries
       minor.lex                          379 entries
       proper.lex                        1057 entries
       abbrev.lex                         127 entries
       technica.lex                       813 entries
       natural.lex                        435 entries
       foreign.lex                         88 entries
     .......... .......... .......... .......... ..........
     .......... .......... .......... .......... ..........  100
     .......... .....

Notice that every word received a single synthesis.  Open the output file alice.syn and you will see that it is identical to the input text file shown in figure 1.

Running KTEXT
*************

This section describes KTEXT's user interface and the input files it uses.

KTEXT is a batch-processing program.  This means that the program takes as input a text from a disk file and returns as output the processed text in a new disk file.  KTEXT is run from the command line by giving it the information it needs (file names and other options).  It does not have an interactive interface.  The user controls KTEXT's operation by means of special files that contain all the information KTEXT needs to process the input text.  These files are called control files.

The operation of the program is controlled by using command line options.  To see a list of the command line options, run the KTEXT application with -h as a command line option.  You will see a display similar to this:

     KTEXT (analyze/synthesize words using PC-Kimmo functions)
     Version 2.0b11 (November 1, 1996), Copyright 1996 SIL
     Beta test version compiled Nov  7 1996 15:11:16
     with PC-Kimmo functions version 2.1b7 (November 6, 1996)
       and PC-PATR functions version 0.99b0 (November 7, 1996)
     For 386 CPU (or better) under MS-DOS [compiled with DJGPP 2.1/GNU C 2.7]

     Usage:  ktext [options]
         -c char      make char the comment character for the control files
                      (default is ;)
         -s           synthesis mode (default is analysis)
         -v           for synthesis, verify each result with a word parse
         -x ctlfile   specify the KTEXT control file (default is ktext.ctl)
         -i infile    specify the input file (required: no default)
         -o outfile   specify the output file (default is based on infile)
         -l logfile   specify the KTEXT log file (default is none)

The command line options (-c, -s, and so on) are all lower case letters.  Here is a detailed description of each command line option.

-c
     The -c option takes an argument that sets the comment character used in the KTEXT control files (analysis, synthesis, TEXTIN, and TXTOUT control files).  It has no effect on any other files used by KTEXT.  If the -c option is not used, the semicolon (;) is used as the default comment character.

-s
     The -s option causes KTEXT to run in synthesis mode. Without this option, KTEXT by default will run in analysis mode.

-v
     The -v option applies only to synthesis mode; it causes KTEXT to verify the synthesis by using the word grammar (if one is specified in the analysis control file).  The default is not to use the word grammar (even if one is specified).

-x
     The -x option takes an argument that specifies the name of either the analysis or synthesis control file.  These control files contains the name of the TEXTIN or TXTOUT control files and the names of the rules, lexicon, and word grammar files.  They can also specify consistent changes to be made to the output.  The -x option accepts a default file name extension of .ctl; for example if you use -x english KTEXT will try to load the file english.ctl.  If the -x option is not used, KTEXT will try to load a control file with the default file name ktext.ctl.

-i
     The -i option takes an argument that specifies the name of the input file containing the text that KTEXT will process.  If the -i option is not used, KTEXT displays an error message and quits.

-o
     The -o option takes an argument that specifies the name of the output file that KTEXT creates.  If the -o option is not used, the output filename is constructed from the input filename.

-l
     The -l option takes an argument that specifies the name of a log file.  The log file contains messages about any analysis failures or other anomalous behavior during processing of the input text.

In all instances where file names are supplied to KTEXT, an optional directory path can be included; for example, -i c:\texts\alice.txt.

KTEXT's functional structure
****************************

Analysis mode
=============

KTEXT uses three main functional modules in analysis mode: the text input module, the analysis module, and the structured output module.  The diagram in figure 5 shows the flow of data through these modules.  The input text is fed into the text input module which outputs the text as a stream of normalized words with capitalization and punctuation stripped out and saved.  The text input module is controlled by a file that specifies orthographic changes.  Each word is then passed to the analysis module where it is parsed.  The analysis module is controlled by the PC-KIMMO rules, lexicon, and grammar files.  The parsed words are then passed to the structured output module and written to the output file as database records.

     Figure 5. An overview of KTEXT analysis

                     original input text file
                                  |
                                  |
                      +--------------------------------+
                      |           |                    |
                      |    +------------+              |
     text input       |    |    TEXT    |              |
     control file --->|--->|    INPUT   |-----+        |
                      |    +------------+     |        |
                      |           |      punctuation   |
                      |         words     formatting   |
                      |           |     capitalization |
                      |           |           |        |
     rules file ----->|--->+------------+     |        |
     lexicon files -->|--->|  ANALYSIS  |     |        |
     grammar file --->|--->+------------+     |        |
                      |           |           |        |
                      |     parsed words      |        |
                      |           |           |        |
                      |    +------------+     |        |
                      |    | STRUCTURED |<----+        |
                      |    |   OUTPUT   |              |
                      |    +------------+              |
                      |           |                    |
                      +--------------------------------+
                                  |
                                  |
                  structured text file with parsed words

In analysis mode, KTEXT uses six different input files and produces one output file (plus an optional log file).  These six input file are:

 1. the text data file,

 2. the KTEXT control file,

 3. the text input control file (optional),

 4. the PC-KIMMO rules file,

 5. the PC-KIMMO lexicon file, and

 6. the PC-KIMMO grammar file (optional).

The PC-KIMMO rules, lexicon, and grammar files are described in the PC-KIMMO documentation and will not be discussed further in this document; see Antworth (1990) and Antworth (1995).  The other input files and the analysis output data file are described in the following chapters.

Synthesis mode
==============

KTEXT also uses three main functional modules in synthesis mode: the structured input module, the synthesis module, and the text output module.  The diagram in figure 6 shows the flow of data through these modules.  A structured input text containing parsed words is fed into the structured input module, which outputs the text as a stream of parsed words with capitalization and punctuation stripped out and saved.  Each parsed word is then passed to the synthesis module where it is rebuilt from its pieces.  The synthesis module is controlled by the PC-KIMMO rules and lexicon files. (Synthesis normally does not use the grammar file.)  The synthesized words are then passed to the text output module and written to the output file as a synthesized text with the punctuation and capitalization merged back in.  The text output module is controlled by a file that specifies orthographic changes.

     Figure 6. An overview of KTEXT synthesis

                  structured text file with parsed words
                                  |
                                  |
                      +--------------------------------+
                      |           |                    |
                      |    +------------+              |
                      |    | STRUCTURED |              |
                      |    |    INPUT   |-----+        |
                      |    +------------+     |        |
                      |           |      punctuation   |
                      |        parsed     formatting   |
                      |         words   capitalization |
                      |           |           |        |
     rules file ----->|--->+------------+     |        |
     lexicon files -->|--->| SYNTHESIS  |     |        |
                      |    +------------+     |        |
                      |           |           |        |
                      |   synthesized words   |        |
                      |           |           |        |
                      |    +------------+     |        |
     text output      |    |    TEXT    |<----+        |
     control file --->|--->|   OUTPUT   |              |
                      |    +------------+              |
                      |           |                    |
                      +--------------------------------+
                                  |
                                  |
                     synthesized output text file

In synthesis mode, KTEXT also uses six different input files and produces one output file (plus an optional log file).  These six input file are:

 1. the analysis data file,

 2. the KTEXT control file,

 3. the text output control file (optional),

 4. the PC-KIMMO rules file,

 5. the PC-KIMMO lexicon file, and

 6. the PC-KIMMO grammar file (optional).

The PC-KIMMO rules, lexicon, and grammar files are described in the PC-KIMMO documentation and will not be discussed further in this document; see Antworth (1990) and Antworth (1995).  The other input files and the synthesis output text file are described in the following chapters.

The input text file
*******************

The input text file contains the text that KTEXT will process.  It must be a plain text file, not a file formatted by a word processor.  If you use a word processor such as Microsoft Word to create your text, you must save it as plain text with no formatting.  KTEXT preserves all the ``white space'' used in the text file.  That is, it saves in its output file the location of all line breaks, blank lines, tabs, spaces, and other nonalphabetic characters.  This enables you to recover from the output file the precise format and page layout of the original text.

While KTEXT will accept text with no formatting information other than white space characters, it will also handle text that contains special format markers.  These format markers can indicate parts of the text such as sentences, paragraphs, sections, section headings, and titles.  The use of special format markers is called descriptive markup.  KTEXT (because it is based on AMPLE) works best with a system of descriptive markup called ``standard format'' that is used by SIL International.  SIL standard format marks the beginning of each text unit with a format marker.  There is no explicit indication of the end of a unit.  A format marker is composed of a special character (a backslash by default) followed by a code of one or more letter.  For example, \ti for title, \ch for chapter, \p for paragraph, \s for sentence, and so on.  KTEXT does not ``know'' any particular format markers.  You can use whatever markers you like, as long as you declare them in the text input control file.  For more on format markers, see section 7.3.2 below.

One of the best know systems of descriptive markup is SGML (Standard Generalized Markup Language).  One very significant difference between SGML and SIL standard format is that SGML uses markers in pairs, one at the beginning of a text unit and a matching one at the end.  This should not pose a problem for KTEXT, since KTEXT just preserves all format markers wherever they occur.  Another difference is that SGML flags format markers with angle brackets, for instance <paragraph>. KTEXT can recognize SGML markers by changing the format marker flag character from backslash to left angled bracket (see section 7.3.2 below).  Recognizing the end of the SGML format marker is a bit of a problem.  While SGML uses a matching right angled bracket to indicate the end of the marker, SIL standard format simply uses a space to delineate the format marker from the following text.  This means that for KTEXT to find the end of an SGML tag, you must leave at least one space after it, and there must not be any spaces in the middle of the SGML tag.

The KTEXT control file
**********************

KTEXT uses an overall control file to customize its operation.  This file is structured as a standard format database, composed of various fields marked by backslash codes.  The fields in the control file are as follows.

\textin
     specifies the text input control file.  This is used only in analysis mode.

\textout
     specifies the text output control file.  This is used only in synthesis mode.

\rules
     specifies the PC-KIMMO phonological rules file.

\lexicon
     specifies the primary PC-KIMMO lexicon file.

\grammar
     specifies the PC-KIMMO word grammar file.  This is normally used only in analysis mode.

\ach
     defines an analysis field change.  This is used only in analysis mode, after a word has been parsed.

\dch
     defines a decomposition field change.  This is used only in analysis mode, after a word has been parsed.

\scl
     defines a string class for use with the analysis or decomposition changes.

\cat
     defines how to extract the word category (part of speech) from the feature structure built by the word grammar.  This is used only in analysis mode, and only if a word grammar file is loaded.

\fd
     defines a labeled feature structure.  This is used only in analysis mode, and only if a word grammar file is loaded.  This gives names to feature structures produced by the word grammar for output to the analysis data file.

\rd
     defines the root delimiters.  The default pair of delimiters are < and >.

Figure 7 shows a sample KTEXT control file.

     Figure 7. Sample KTEXT control file

     \textin  engintx.ctl
     \rules   d:\opac\test\ktext\englex\english.rul
     \lexicon d:\opac\test\ktext\englex\english.lex
     \grammar d:\opac\test\ktext\englex\english.grm
     \textout engoutx.ctl

     \cat <head pos>

     \fd singular <number> = SG
     \fd plural   <number> = PL

When KTEXT reads its control file, it ignores any lines beginning with field codes other than those listed above.  For example, a line beginning \co would be ignored.  Such lines are treated as comments.  Comments in the control file can also be indicated with the comment character, which by default is semicolon.  This is the only way to place comments on the same line as a field.  The comment character can be changed with the command line option -c when running KTEXT (see chapter 3).

The text input control file
***************************

     [file textin.txi not included]

The text output control file
****************************

     [file textout.txi not included]

KTEXT analysis output
*********************

     [file anafiles.txi not included]

KTEXT synthesis output
**********************

KTEXT tries to recreate the format of the original input to analysis in its synthesis output.  The main feature worth noting is that synthesis ambiguities and failures are marked similarly to analysis ambiguities and failures in KTEXT analysis output.

Bibliography
************

 1. Antworth, Evan L.. 1990. PC-KIMMO: a two-level processor for morphological analysis. Occasional Publications in Academic Computing No. 16. Dallas, TX: Summer Institute of Linguistics.

 2. Antworth, Evan L.. 1995. User's Guide to PC-KIMMO version 2.  URL ftp://ftp.sil.org/software/dos/pc-kimmo/guide.zip (visited 1997, June 11).

 3. Bloomfield, Leonard. 1917. Tagalog texts with grammatical analysis. Urbana, IL: University of Illinois.

 4. Jang, Taeho. 1995. Computer assisted adaptation of text from Turkish to Korean: design and implementation. Master of Arts in Linguistics, University of Texas at Arlington, Arlington, TX.

 5. Kew, Jonathan and Stephen R. McConnel. 1991. Formatting interlinear text. Occasional Publications in Academic Computing No. 17. Dallas, TX: Summer Institute of Linguistics.

 6. Knuth, Donald E.. 1986. The TeXbook. Reading, MA: Addison Wesley Publishing Company.

 7. Oflazer, Kemal. 1994a. Two-level Description of Turkish Morphology. Literary and Linguistic Computing. 9(2), 137endash148.

 8. Oflazer, Kemal. 1994b. TURKLEX. URL ftp://crl.nmsu.edu/CLR/tools/ling-analysis/morphology/turklex/turklex.tar.z (visited 1997, June 11).

 9. Simons, Gary F., and John Thomson. 1988. How to use IT: interlinear text processing on the Macintosh. Edmonds, WA: Linguist's Software.

 10. Simons, Gary F., and Larry Versaw. 1991. How to use IT: a guide to interlinear text processing, 3rd ed. Dallas, TX: Summer Institute of Linguistics.

 11. Weber, David J., H. Andrew Black, and Stephen R. McConnel. 1988. AMPLE: a tool for exploring morphology. Occasional Publications in Academic Computing No. 12. Dallas, TX: Summer Institute of Linguistics.

 12. Weber, David J., H. Andrew Black, Stephen R. McConnel, and Alan Buseman. 1990. STAMP: a tool for dialect adaptation. Occasional Publications in Academic Computing No. 15. Dallas, TX: Summer Institute of Linguistics.