home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / TEXT / INFO / KGEN02.ZIP / USER.DOC < prev   
Encoding:
Text File  |  1991-04-30  |  32.1 KB  |  824 lines

  1. PRELIMINARY DOCUMENTATION FOR KGEN: a rule compiler for PC-KIMMO
  2.  
  3. Program by Nathan Miles
  4. Documentation by Nathan Miles and Evan Antworth
  5.  
  6. April 30, 1991
  7.  
  8. 1 INTRODUCTION
  9.   1.1 About PC-KIMMO and KGEN
  10.   1.2 KGEN status
  11.   1.3 Running KGEN
  12.   1.4 Error handling
  13. 2 INPUT FILE FORMAT
  14.   2.1 General conventions
  15.   2.2 Subsets
  16.   2.3 Feasible pairs
  17.   2.4 Rule syntax
  18.   2.5 Unimplemented rule syntax
  19. 3 OPTIMIZING KGEN'S OUTPUT
  20.   3.1 Simplifying complex rules
  21.   3.2 Handling rule conflicts
  22.   3.3 Overlappping column headers
  23.   3.4 Backlooping
  24. 4 CONVERTING AN EXISTING PC-KIMMO RULES FILE INTO A KGEN SOURCE FILE
  25. 5 SUMMARY OF LIMITATIONS IN THE BETA VERSION
  26. 6 REPORTING DEFECTS
  27. 7 ACKNOWLEDGMENTS
  28. 8 REFERENCES
  29.  
  30.  
  31. 1 INTRODUCTION
  32.  
  33. 1.1 About PC-KIMMO and KGEN
  34.  
  35. KGEN is an auxiliary program for PC-KIMMO. PC-KIMMO is a program for
  36. doing computational phonology and morphology. It is typically used to
  37. build morphological parsers for natural language processing systems.
  38. PC-KIMMO is described in the book "PC-KIMMO: a two-level processor
  39. for morphological analysis" by Evan L. Antworth, published by the
  40. Summer Institute of Linguistics (1990). The PC-KIMMO software is
  41. available for MS-DOS (IBM PCs and compatibles), Macintosh, and UNIX.
  42. The book (including software) is available for $23.00 (plus postage)
  43. from:
  44.  
  45.    International Academic Bookstore
  46.    7500 W. Camp Wisdom Road
  47.    Dallas TX, 75236
  48.    U.S.A.
  49.  
  50.    phone 214/709-2404
  51.    fax   214/709-2433
  52.  
  53. The KGEN program which this document describes will be of very little
  54. use to you without the PC-KIMMO program and book. The remainder of
  55. this document assumes that you are familiar with PC-KIMMO.
  56.  
  57. The phonological component of PC-KIMMO is based on a rule formalism
  58. called two-level phonology. A typical two-level rule looks like this:
  59.  
  60.    y:i => @:C___+:0
  61.  
  62. Unfortunately, PC-KIMMO cannot directly use rules written in this
  63. high-level notation. Two-level rules must first be translated into
  64. finite state tables such as this:
  65.  
  66.       @ y + @
  67.       C i 0 @
  68.    1: 2 0 1 1
  69.    2: 2 3 2 1
  70.    3. 0 0 1 0
  71.  
  72. The PC-KIMMO book describes in detail how to manually translate
  73. two-level rules into finite state tables. Clearly, however, this is a
  74. job for a computer, not a human. The task of building a program for
  75. translating rules into state tables is not trivial. The only other
  76. successful rule compiler that we know of has been developed at Xerox
  77. (see Dalrymple et al. 1987). However, it is proprietary and may not
  78. run on small computers. The KGEN program is an attempt to build a
  79. rule compiler that will run on personal computers such as the IBM PC
  80. and compatibles and the Apple Macintosh (as well as UNIX). Due to the
  81. complexity of the task, KGEN may never be developed to the point
  82. where it can automatically handle everything that can be expressed
  83. with two-level rules. The user may still need to learn enough about
  84. building state tables to be able to correct KGEN's output. Thus using
  85. KGEN can perhaps better be described as "computer assisted rule
  86. compilation".
  87.  
  88.  
  89. 1.2 KGEN Status
  90.  
  91. The current version of KGEN is Version 0.2.  Caveat lector!
  92.  
  93. The KGEN program was developed by Nathan Miles as a part-time
  94. project. Nathan is currently a computational linguistics graduate
  95. student at The Ohio State University. His background includes a stint
  96. at IBM writing compilers. The program is offered for your use as
  97. follows:
  98.  
  99.    1) You are free to use the program at no charge in any way you
  100.       see fit. The source code is copyrighted, but may be freely
  101.       copied for personal or academic use. Neither the source code
  102.       nor the executable program may be resold or used for commercial
  103.       profit.
  104.  
  105.    2) NO GUARANTEE WHATSOEVER is made as to its fitness for any
  106.       particular purpose.   You must use this program at your
  107.       own risk.
  108.  
  109.    3) Although I am interested in improving the program over time,
  110.       I cannot guarantee that I will fix any problems you find.
  111.  
  112. Note that this program is not currently a supported program of the
  113. Summer Institute in Linguistics. If the program proves useful and
  114. reliable it is my intention to give all rights to it to SIL and they
  115. MAY choose at that time to make it a standard part of their
  116. distribution.
  117.  
  118. The program has successfully compiled approximately 50 rules whose
  119. tables were then checked manually to the best of the authors' ability.
  120. An additional file containing several English morphological rules as
  121. described in the PC-KIMMO book was built. All of the example
  122. derivations from the book were then successfully executed using the
  123. tables built by KGEN. This process completed the Alpha test of the
  124. program.
  125.  
  126. The program is now being distributed to users who would like to
  127. participate in the Beta test of the program. The Beta test is
  128. necessary to determine how effective the program is in building the
  129. kinds of tables used by "real-world" projects.
  130.  
  131. KGEN presently runs under MS-DOS and UNIX. We have not yet succeeding
  132. in porting it to the Macintosh, but hope to eventually. If anyone
  133. out there is a Think C expert who could help us, let us know.
  134.  
  135.  
  136. 1.3 Running KGEN
  137.  
  138. KGEN accepts as input a file of two-level rules (whose format is
  139. described below) and produces as output a PC-KIMMO rules file. The
  140. KGEN program is invoked as follows:
  141.  
  142.    kgen <input.fil >output.fil
  143.  
  144. where input.fil is a file of two-level rules and output.fil is a
  145. PC-KIMMO rules file. For example, to compile the set of English rules
  146. that is part of this Beta release, type:
  147.  
  148.    kgen <english.txt >english.rul
  149.  
  150. Then run PC-KIMMO in the standard way:
  151.  
  152.    pckimmo
  153.    load rules english.rul
  154.  
  155.  
  156. 1.4 Error handling
  157.  
  158. If an error in the input file is found during program execution, the
  159. program stops and prints out the offending line with a "<-- ..."
  160. pointing to the approximate location of the error. For example, this
  161. rule incorrectly uses a curly brace where it should use a square
  162. bracket:
  163.  
  164.    RULE s:z <= [a|b} <-- ... _
  165.  
  166. The current version of the program halts on the first error
  167. encountered. Here are the nonsyntactic errors:
  168.  
  169. Subset name ( xxx ) too long...   (Subset names limited to 40 characters)
  170. Too many sets defined ...         (More than 63 subsets)
  171. Undefined subset ( xxx ) referenced ...
  172. Duplicate subset definition ...
  173. Too many characters in set ...    (More than 63 characters)
  174. Cannot mix x:0 and X:Y in alternate ... (  {x,y,z}:{b,0,c} is illegal )
  175. Number of lexical and surface characters does not match ...
  176.                                   ( PAIRS  a b c
  177.                                            a b c d e f )
  178. Too many feasible pairs defined   (More than 256)
  179. Too many characters with {}       (More than 20 pairs)
  180. Unmatched lengths in {}:{} ...    (  {a,b,c}:{u,v,w,x}  )
  181. Unequal length in alternate sets  (  {a,b}:c <= x ___ {c,d,e}  )
  182. Segset overflow ...               ( string more 63 pairs match a lexical
  183.                                     surface pair )
  184. No pairs match X:V ...            ( no lexical surface pair matches the
  185.                                     subset pair X:V )
  186. Too many columns required ...     ( table needs more than 63 columns )
  187. Translator cannot handle X* at end of pattern
  188.                                   (  x:y <= z ___ t*   breaks and is dumb )
  189. Too many states needed ...        ( more than 63 )
  190.  
  191.  
  192. 2 INPUT FILE FORMAT
  193.  
  194. The format of the KGEN input file is intended to be modeled as closely
  195. as possible on the format of the PC-KIMMO rules file. See pages 94-101
  196. and 179-184 of the PC-KIMMO book.  For those who don't like to read
  197. documentation, a great deal about the file format  can be gathered by
  198. studying the supplied file "english.txt" which contains the rules for
  199. English spelling as described in the PC-KIMMO book (appendix A).
  200.  
  201.  
  202. 2.1 General conventions
  203.  
  204. Comments may be placed anywhere in the rules file.  A semicolon marks
  205. the beginning of a comment. (In this Beta version, the comment
  206. character cannot be changed.)  Everything from the semicolon to the
  207. end of the line is ignored by KGEN.
  208.  
  209. Lines beginning with an exclamation mark (!) are copied verbatim to
  210. the output file. This device makes it possible to preserve comments
  211. and manually constructed rules. For example, if your KGEN input file
  212. contains these lines:
  213.  
  214.    ; this is a KGEN comment
  215.    !; this is a PC-KIMMO comment
  216.  
  217. the output file will look like this:
  218.  
  219.    ; this is a PC-KIMMO comment
  220.  
  221. Blank lines may be inserted anywhere in the file (except between the
  222. two lines of characters in a PAIRS statement).
  223.  
  224. The KGEN input file contains three sections:  subset specifications,
  225. feasible pairs, and the rules section. The ALPHABET, NULL, ANY, and
  226. BOUNDARY declarations that appear at the beginning of the PC-KIMMO
  227. rules file are automatically created by KGEN (see below). The file can
  228. optionally terminate with the END keyword. Any material in the file
  229. after the END keyword is ignored.
  230.  
  231.  
  232. 2.2 Subsets
  233.  
  234. The subsets section of the KGEN input file is optional; that is, a
  235. valid input file does not have to declare any subsets. The subset
  236. section declares the subset names and the alphabetic characters they
  237. specify. The format for declaring subsets is identical to the SUBSET
  238. declarations in the PC-KIMMO rules file (p. 97).   For example:
  239.  
  240.    SUBSET   Vfront    e i
  241.  
  242. Subset names must begin with a capital letter and consist entirely of
  243. letters. (These restrictions apply only to the Beta version of KGEN.)
  244.  
  245.    Valid Names:     X, Cpal, UVW
  246.    INVALID Names:   X1, V{-bk,+hi}
  247.  
  248. There are NO subset names built into KGEN.  In particular you must
  249. define C and V if you intend to use them.
  250.  
  251. KGEN does not require that capital letters only be used to name
  252. subsets. If A, for example, is not defined as a subset it can be used
  253. an alphabetic character.
  254.  
  255.  
  256. 2.3 Feasible pairs
  257.  
  258. The pairs section declares all feasible pairs used in the
  259. description. This includes both default correspondences (such as a:a
  260. and b:b) and special correspondences (such as y:i and s:0). The pairs
  261. section is obligatory. The format used by KGEN to specify feasible
  262. pairs is different, and simpler, than the format used in the PC-KIMMO
  263. rules file. In the PC-KIMMO rules file, pairs are declared using a
  264. special finite state table with only one state (p. 97-98). In the
  265. KGEN input file, pairs are declared with the keyword PAIRS followed
  266. by pairs of characters. Here is an example:
  267.  
  268.    PAIRS  b c d f g h j k l m n p q r s t v w x y z
  269.           b c d f g h j k l m n p q r s t v w x y z
  270.  
  271.    PAIRS  a e i o u +
  272.           a e i o u 0
  273.  
  274.    PAIRS  y s e 0 i
  275.           i 0 0 e y
  276.  
  277. Correspondences must always be specified with consecutive pairs of
  278. lines. Multiple PAIRS statements may, and usually will, be present in
  279. a rules file. They must all be placed in a block after the subset
  280. declarations and before the rules; that is, they cannot be
  281. interspersed with the rules. Pairs of segments do not have to be
  282. vertically aligned, but the first line must have exactly the same
  283. number of segments as the second line. KGEN performs no further
  284. validity checking on the pairs declared. If the user makes a mistake,
  285. such as including a pair twice, PC-KIMMO will complain when it tries
  286. to load the table. For more on how to declare pairs, see section 4.
  287.  
  288. After the pairs section has been completely read, the program will
  289. automatically generate an ALPHABET declaration which contains all the
  290. segments referenced in the PAIRS declarations. This declaration is
  291. placed at the beginning of the output file.
  292.  
  293. Immediately following the ALPHABET declaration, KGEN also
  294. automatically inserts these NULL, ANY, and BOUNDARY declarations:
  295.  
  296.    NULL 0
  297.    ANY @
  298.    BOUNDARY #
  299.  
  300. In the Beta version of KGEN, these declarations cannot be changed.
  301. KGEN depends on being able to interpret 0 as the null segment and @ as
  302. the ANY symbol.
  303.  
  304.  
  305. 2.4 Rule syntax
  306.  
  307. The four basic types of rules are supported:
  308.  
  309.    x:y <= a ___ b
  310.    x:y => a ___ b
  311.    x:y <=> a ___ b
  312.    x:y /<= a ___ b
  313.  
  314. The meaning of these rules is explained in the PC-KIMMO book (pp.
  315. 29ff).
  316.  
  317. A rule is declared with the keyword RULE. The rule must be written
  318. all on one line; for example,
  319.  
  320.    RULE t:c <=> _ (+:0) @:i
  321.  
  322. The environment line must be one or more underline characters. White
  323. space (spaces, tabs, but not new lines) may be used freely to improve
  324. readability.  There is one situation in which white space is
  325. required. Subset names must be followed by a space or some other
  326. white space character. This means that the program will interpret "C
  327. V " as a subset named C followed by a subset named V. Without
  328. intervening space, the sequence "CV " will be interpreted as a subset
  329. named CV, probably not what you had in mind.
  330.  
  331. Optional parts of the right context are enclosed in parenthesis (see
  332. pp. 34-35 of the PC-KIMMO book). Parenthesis may be nested to show
  333. optional parts within optional parts. For example,
  334.  
  335.    RULE  x:y <=  a (b (c d)) ___
  336.    RULE  e:0 <=  V (Cpal) Cpal ___ +:0 V
  337.  
  338. Alternative choices (disjunction) are enclosed by square brackets and
  339. separated by a vertical bar (see pp. 35-36 of the PC-KIMMO book). The
  340. following rule contains a segmental position which can be filled by
  341. either a vowel or y.   Alternatives may be nested within optional
  342. elements and vice versa.
  343.  
  344.    RULE  e:0 <= C [V|y] ___ +:0 e
  345.  
  346. When there are several possible right-hand sides (environments) for a
  347. rule, they are separated by a vertical bar (but without square
  348. brackets) as in the following example. Notice that an environment line
  349. occurs in each subpart of the right side of the rule.
  350.  
  351.    RULE e:0 => V C C*___+:0 V | C [V|y]___+:0 e | C u___+:0 V
  352.  
  353. Correspondences are specified as follows (see p. 31 of the PC-KIMMO
  354. book):
  355.  
  356.    s:s     Lexical s corresponds to surface s
  357.    s       Lexical s corresponds to surface s (same as s:s)
  358.    s:z     Lexical s corresponds to surface z
  359.    s:@     Lexical s corresponds to any surface character
  360.    @:s     Surface s realizes any lexical character
  361.    s:      Same as s:@, but dangerous to use
  362.    :z     Same as @:z, but dangerous to use
  363.  
  364. The last two forms are used in the PC-KIMMO book (p. 31) but are
  365. marked as dangerous here because KGEN will often not interpret them
  366. the way you wish.  This is because spaces are not significant.  Thus
  367. the compiler will interpret the following two rules identically:
  368.  
  369.    a:b <= ___ s:z  :z
  370.    a:b <= ___ s:  z:z
  371.  
  372. We recommend using s:@ and @:z rather than the shortened forms s: and
  373. :z.
  374.  
  375. Correspondences using subset names are written just like the character
  376. correspondences shown above; for instance, Cpal:Cpal, Cpal:@, @:Cpal
  377. (where Cpal stands for the subset of palatal consonants).
  378.  
  379. An asterisk (Kleene-star) is used to indicate zero or more instances
  380. of a correspondence; for instance, s*, s:s*, s:@*, Cpal*, or @:Cpal*.
  381. If you wish to indicate one or more instances of a correspondence, use
  382. the construct X X*.   KGEN will not generate the correct table if you
  383. place the X* first. Here are some rules using the asterisk notation.
  384.  
  385.    RULE  e:0 => V C C* ___ +:0 V
  386.    RULE  s:z => V* C* e ___
  387.  
  388. The compiler interprets a string of consecutive asterisked elements as
  389. occurring an arbitrary number of times in any order. This means, for
  390. example, that the second rule above would match the lexical form
  391. "axaxaxe" as well as the form "aaaxxxe".   Note also that only single
  392. elements may be replicated, not string of elements or disjunctions of
  393. elements; for example, the following asterisked expressions are
  394. invalid:
  395.  
  396.    RULE s:z <= ___ [x|y]*    !!! INVALID
  397.    RULE s:z <= ___ (abc)*    !!! INVALID
  398.  
  399. When a series of mappings all occur in the same environment they can
  400. often be expressed with one rule using curly braces as shown in the
  401. PC-KIMMO book (p. 135).
  402.  
  403.    RULE {b,d,g}:0 => {b,d,g} (+:0) ___
  404.    RULE 0:{b,d,g,p,t} <=> `:0 C* V {b,d,g,p,t} ___ +:0 [V|y:@]
  405.  
  406. 2.5 Unimplemented rule syntax
  407.  
  408. The negative operator ~ is not implemented in the Beta version of
  409. KGEN. For example, on page 219 of the PC-KIMMO book, rule R5a uses the
  410. expression ~[i|'], which means neither i nor '.
  411.  
  412.  
  413. 3 OPTIMIZING KGEN'S OUTPUT
  414.  
  415. The process of translating two-level rules into finite state tables is
  416. an intricate process. It is unfortunately true that this Beta test
  417. version of KGEN is not likely always to do this correctly.  This
  418. section describes strategies for working around problems you find in
  419. the Beta version.
  420.  
  421. 3.1 Simplifying complex rules
  422.  
  423. We suspect that KGEN works fairly well for simple tables but that its
  424. accuracy decreases as the tables built become more and more intricate.
  425. One strategy for dealing with this kind of failure is to replace a
  426. single complicated rule by two or more simpler rules. The following
  427. list suggests ways in which this can be done:
  428.  
  429.    More complex                     Less complex
  430.  
  431.    x:y <=> a___b                    x:y <= a___b
  432.                                     x:y => a___b
  433.  
  434.    x:y <= a___b | c___d | e___      x:y <= a___b
  435.                                     x:y <= c___d
  436.                                     x:y <= e___
  437.  
  438.    {a,b,c}:y <= {d,e,f} ___         a:y <= d___
  439.                                     b:y <= e___
  440.                                     c:y <= f___
  441.  
  442. It would be helpful in the Beta test process if you would first write
  443. the rule in the most natural fashion, even if this creates a fairly
  444. complicated rule.   If the rule does not compile correctly, save a
  445. copy of the offending rule file to submit with a defect report, then
  446. try the simplification process.  By doing this we can incrementally
  447. improve the ability of KGEN to handle all rules.
  448.  
  449. Here is another tip for dealing with troublesome rules. Examine your
  450. context specifications and see if you have a specified a context that
  451. is more general than actually occurs in your data. For example, if the
  452. expression x:y* in a rule seems to cause KGEN to fail but you know
  453. that your data never has more than two consecutive instances of x:y,
  454. you can try replacing the expression with (x:y (x:y)) to see if KGEN
  455. can produce a correct table.
  456.  
  457.  
  458. 3.2 Handling rule conflicts
  459.  
  460. One problem that KGEN does not handle (and may never handle) is rule
  461. conflicts. Rule conflicts are discussed in the PC-KIMMO book on pages
  462. 85-88. The source of rule conflicts lies in the way in which PC-KIMMO
  463. applies rules. PC-KIMMO applies all the rules in a description
  464. simultaneously (or in parallel if you prefer). This means that, for an
  465. input form to be successfully processed by the rules, *all* the rules
  466. must apply successfully. Even rules that do not crucially affect a
  467. particular input form must apply to the form successfully. In such
  468. cases the rules apply 'vacuously', but successfully nevertheless. The
  469. point is that, if you have two rules in a description such
  470. that, the applying one rule makes it impossible to successfully apply
  471. the rule, processing will fail and no result will be returned. This
  472. constitutes a rule conflict.
  473.  
  474. There are two types of rule conflicts: the => (or environment)
  475. conflict and the <= (or realization) conflict (these terms are due to
  476. Dalrymple et al 1987:25). The => conflict arises when two => rules
  477. have the same correspondence on the left side of the rule. For
  478. example:
  479.  
  480.    p:b => m___
  481.    p:b => V___V
  482.  
  483. The rule operator => means that the correspondence can occur *only* in
  484. the specified environment; thus these two rules contradict each other.
  485. If either one is applies, the other is blocked. The simplest way to
  486. resolve such a conflict is to combine the two rules into one rule with
  487. a disjunctive environment:
  488.  
  489.    p:b => m___ | V___V
  490.  
  491. This appears to go against our advice above to simplify complex rules
  492. by breaking them into two or more smaller rules. But in the case of
  493. this type of rule conflict it can't be helped. However, if KGEN seems
  494. to have trouble compiling a => rule with a complex environment such as
  495. the one above, try changing the order of the alternative environments.
  496. Perhaps inserting a later alternative in the table is breaking the
  497. entries for an earlier alternative. This might not happen if they were
  498. inserted in another order.  We suspect that the most complicated
  499. entries should be inserted first for maximum reliability. For example:
  500.  
  501.    p:b => V___V | m___
  502.  
  503. The second type of rule conflict is the <= conflict. It arises when
  504. two conditions exist: (1) the correspondence parts (to the left of the
  505. arrow) of two <= rules have the same lexical character but different
  506. surface realizations of it, and (2) the environments of the two rules
  507. intersect (or overlap, including proper inclusion). A typical example
  508. is these two rules:
  509.  
  510.    s:Z <= i___i  (where Z stands for z-hachek, an alveopalatal fricative)
  511.    s:z <= V___V
  512.  
  513. These two rules meet both conditions for a <= conflict. First, the
  514. lexical characters of their correspondence parts are the same (namely
  515. s), while the surface characters are different (Z and z). Second,
  516. because the character i is a member of the subset V (for vowels), the
  517. two environments intersect. Specifically, V_V properly includes i_i,
  518. since any form that matches i_i will also match V_V. Thus a lexical
  519. input form such as isi meets the structural description of both rules;
  520. that is, both rules are eligible to apply to it. But because the two
  521. rules have different structural changes (one requires a surface Z, the
  522. other a surface z), applying one rule will prevent the other rule from
  523. applying. Thus the rules contradict each other, and a rules file
  524. containing these rules will not work properly.
  525.  
  526. KGEN will do most of the work of compiling these rules, but the user
  527. must manually adjust the resulting state tables to resolve the
  528. conflict. Given these rules, KGEN will produce tables like these:
  529.  
  530.    RULE "s:Z <= i___i" 3 4
  531.       i s s @
  532.       i Z @ @
  533.    1: 2 1 1 1
  534.    2: 2 1 3 1
  535.    3: 0 1 1 1
  536.  
  537.    RULE "s:z <= V___V" 3 4
  538.       V s s @
  539.       V z @ @
  540.    1: 2 1 1 1
  541.    2: 2 1 3 1
  542.    3: 0 1 1 1
  543.  
  544. We will assume that these rules should accept the underlying form isi
  545. and produce the surface form iZi. In other words, when the two rules
  546. conflict, the first rule (the s:Z rule) should win (or take
  547. applicational precedence, if you prefer). To ensure this behavior, the
  548. second rule (the s:z rule) must be modified to allow (but not require)
  549. the s:Z correspondence from the first rule to occur in its
  550. environment. This is done by manually inserting an s:Z column into the
  551. second table with transitions back to state 1 in each row:
  552.  
  553.    RULE "s:z <= V___V" 3 4
  554.       V s s s @
  555.       V z @ Z @
  556.    1: 2 1 1 1 1
  557.    2: 2 1 3 1 1
  558.    3: 0 1 1 1 1
  559.  
  560. In order to preserve this modified table, copy it back into your KGEN
  561. input file of rules and put an exclamation mark (!) at the beginning
  562. of each line. Any line in the KGEN input file that begins with an
  563. exclamation point in the first column will be directly copied to the
  564. output file without any alteration, except the deletion of the !. Thus
  565. the KGEN input file containing the above rule will look like this:
  566.  
  567.    !RULE "s:z <= V___V" 3 4
  568.    !   V s s s @
  569.    !   V z @ Z @
  570.    !1: 2 1 1 1 1
  571.    !2: 2 1 3 1 1
  572.    !3: 0 1 1 1 1
  573.  
  574. Particularly in this Beta version of KGEN, you will undoubtedly find
  575. rules (besides instances of rule conflicts) that KGEN does not
  576. translate completely correctly. The same technique can be used: let
  577. KGEN produce a table the best it can, fix up the table by hand, and
  578. copy back into the source rules file with exclamation points to
  579. preserve it. In the worst case, if KGEN fails to produce a usable
  580. table at all, you will have to construct the table completely by hand
  581. and insert it in the source rules file with exclamation points.
  582.  
  583. 3.3 Overlapping column headers
  584.  
  585. The problem of overlapping column headers is discussed on pages 76-78
  586. of the PC-KIMMO book. KGEN attempts to automatically handle column
  587. overlap. For example, it will correctly generate table T54a on page
  588. 78. On the other hand, it may insert columns where it does not need
  589. to. These columns are redundant, but do not do any harm. Please
  590. report any problems with how KGEN handles overlapping column headers.
  591.  
  592. 3.4 Backlooping
  593.  
  594. Another potential problem is backlooping (see pp. 60ff of the
  595. PC-KIMMO book). In some cases it is very difficult to determine what
  596. state to backloop to.   We hope that the Beta testing will clarify
  597. where this is true of and what algorithms are necessary to correctly
  598. handle tricky backlooping.
  599.  
  600.  
  601. 4 CONVERTING AN EXISTING PC-KIMMO RULES FILE INTO A KGEN SOURCE FILE
  602.  
  603. If you have a PC-KIMMO rules file that you have already developed by
  604. hand, follow these steps to convert it to a KGEN source file.
  605.  
  606. 1. Make a copy of the PC-KIMMO rules file and rename it. Do *not*
  607. throw away your original PC-KIMMO rules file. For example, copy
  608. FRENCH.RUL (the existing rules file) as FRENCH.TXT (the new KGEN
  609. file). Use whatever filename extension you want for the new KGEN file.
  610. KGEN does not presently accept any default file names or extensions.
  611.  
  612. 2. Remove (or comment out) the ALPHABET, NULL, ANY, and BOUNDARY
  613. declarations. KGEN automatically generates these.
  614.  
  615. 3. Retain the SUBSET declarations just as they appear in the PC-KIMMO
  616. rules file.
  617.  
  618. 4. Construct all the PAIRS declarations and place them together
  619. directly after the SUBSET declarations. There are likely to be two
  620. types of tables in your original file that you will convert to PAIRS
  621. declarations. First, at the beginning of the file you should have one
  622. or more special tables whose purpose is to declare all the default
  623. correspondences used in the description; for example,
  624.  
  625.    RULE "1 Consonant defaults"  1 22
  626.        b c d f g h j k l m n p q r s t v w x y z @
  627.        b c d f g h j k l m n p q r s t v w x y z @
  628.    1:  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  629.  
  630.    RULE "2 Vowels and other defaults"  1 11
  631.        a e i o u ' - - ` + @
  632.        a e i o u ' - 0 0 0 @
  633.    1:  1 1 1 1 1 1 1 1 1 1 1
  634.  
  635. Convert these tables into PAIRS declarations like these:
  636.  
  637.    PAIRS  b c d f g h j k l m n p q r s t v w x y z
  638.           b c d f g h j k l m n p q r s t v w x y z
  639.  
  640.    PAIRS  a e i o u ' - - ` +
  641.           a e i o u ' - 0 0 0
  642.  
  643. Second, you may have scattered throughout your rules file special
  644. tables whose purpose is to declare the special correspondences that
  645. result from using subsets. For example, if a rule uses a
  646. correspondence such as B:P where B is a subset containing b, d, and g
  647. (voiced stops) and P is a subset containing p, t, and k (voiceless
  648. stops), the set of pairs that B:P actually stands for must be
  649. explicitly declared in a special table like this:
  650.  
  651.    RULE "B:P correspondences" 1 4
  652.       b d g @
  653.       p t k @
  654.    1: 1 1 1 1
  655.  
  656. Tables such as this must also be converted to a PAIRS declarations
  657. like this:
  658.  
  659.    PAIRS  b d g
  660.           p t k
  661.  
  662. Finally, you must declare any other special correspondences used in
  663. rules. For example, if you have rule such as this:
  664.  
  665.    RULE y:i => @:C (+:0)___+:0
  666.  
  667. you must include the y:i correspondence in a PAIRS declaration. (This
  668. requirement applies to the Beta version of KGEN and may be removed in
  669. the production version.)
  670.  
  671. 5. Remove (or comment out) all the state tables.
  672.  
  673. 6. Construct the RULE declarations. If you have been conscientious
  674. about writing the original rules file, the table headers should
  675. already contain the two-level rule on which it is based. For example,
  676. here is a table header from the original English rules file:
  677.  
  678.    RULE "13 i:y-spelling, i:y <= ___ e: +:0 i"
  679.  
  680. Assuming that this rule is already correctly formulated, only a little
  681. clean-up work is needed. First, remove the quotation marks and any
  682. material that is not part of the actual rule (for instance, the number
  683. and name of the rule). Second, change correspondences of the form x: or
  684. :x to x:@ and @:x. And fourth, insert a space after each subset name
  685. (for instance, change "VC" to "V C "). The rule above should now look
  686. like this:
  687.  
  688.    RULE i:y <= ___ e:@ +:0 i
  689.  
  690. 7. If there are any comments or other material that you want to
  691. preserve in the output file, place an exclamation mark (!) before each
  692. line.
  693.  
  694. You are now ready to run KGEN on your new file. 
  695.  
  696.  
  697. 5 SUMMARY OF LIMITATIONS IN THE BETA VERSION
  698.  
  699. The Beta version of KGEN has a number of limitations and restrictions
  700. that are not true of PC-KIMMO. We hope that most if not all these
  701. limitations will be removed in the production version of KGEN.
  702.  
  703. 1. The NULL, ANY, and BOUNDARY symbols cannot be assigned by the user.
  704. KGEN automatically sets them to be 0, @, and #, respectively.
  705.  
  706. 2. Subset names are limited to 40 characters.
  707.  
  708. 3. Subset names must begin with a capital letter and must consist
  709. entirely of letters (A-Z and a-z).
  710.  
  711. 4. Subset lists are limited to 63 characters.
  712.  
  713. 5. There can be no more than 63 subsets in a description.
  714.  
  715. 6. The PAIRS declaration is limited to a total of 256 pairs.
  716.  
  717. 7. All feasible pairs (both default and special) must be explicitly
  718. declared in PAIRS statements.
  719.  
  720. 8. The {} notation is limited to 20 pairs.
  721.  
  722. 9. Tables are limited in size to no more than 63 columns and 63
  723. states.
  724.  
  725. 10. The default comment character cannot be changed.
  726.  
  727. 11. Shortened notations of the form x: and :x should not be used. Use
  728. x:@ and @:x instead.
  729.  
  730. 12. The asterisk notation can be used only with single correspondences
  731. not with strings or complex structures. That is, expressions such as
  732. x* and x:y* are valid, but expressions such as (abc)* or [x|y]* are
  733. invalid.
  734.  
  735. 13. The negative operator ~ is not implemented.
  736.  
  737.  
  738. 6 REPORTING DEFECTS
  739.  
  740. When you detect a defect in this program I (Nathan Miles) would very
  741. much like to know about it.   My intention is to gather information
  742. and create later releases. Please be aware that I am still early in my
  743. graduate school process here at OSU and it is not inconceivable that
  744. time pressures could lead to long gaps between releases.
  745.  
  746. Defect reports can be sent to:
  747.  
  748.    via Email (This is preferred mode)
  749.  
  750.       miles@cis.ohio-state.edu
  751.  
  752.    via US Mail
  753.  
  754.       Nathan Miles
  755.       681 Maclam Dr.
  756.       Columbus, OH   43204
  757.  
  758. If you would like to discuss the program with me I can be reached at
  759. 1-614-276-7893 evenings.   I cannot guarantee that I will always be
  760. able to make written responses.   Email is better for me than US Mail.
  761. If you are going to physically send me machine-readable material it
  762. must be a 5 1/4" low density MSDOS IBM/PC compatible diskette.
  763.  
  764. It would be very helpful if bug reports could contain the following
  765. information:
  766.  
  767.    o  Complete set of rules.  (In some cases there might be
  768.       interactions between rules which could only be seen with all
  769.       the rules present.)
  770.  
  771.    o  The input given, the response received, and the response that
  772.       should have been received when PC-KIMMO interpreted the
  773.       table.
  774.  
  775.    o  An indication of what part of the table was incorrectly generated
  776.       and what the correct table should have been (if known).
  777.  
  778. Another valuable form of feedback would be a list of things which you
  779. wish the documentation had of told you that you had to work out for
  780. yourself.
  781.  
  782. I would be interested in hearing suggestions for extensions to KGEN
  783. also although I don't anticipate having time to make major changes in
  784. KGEN in the near future.
  785.  
  786. Questions and requests for information related to PC-KIMMO should be
  787. directed to Evan Antworth at this address:
  788.  
  789.    Evan Antworth
  790.    Academic Computing Department
  791.    Summer Institute of Linguistics
  792.    7500 W. Camp Wisdom Road
  793.    Dallas, TX  75236
  794.  
  795.    phone: 214/709-2418
  796.    email: evan@txsil.lonestar.org
  797.  
  798.  
  799. 7 ACKNOWLEDGMENTS
  800.  
  801. This program would not have existed if it were not for the extensive
  802. work done by Evan Antworth in describing the process of state table
  803. generation.   Evan also provided valuable input during the development
  804. process.
  805.  
  806. My wife Janis cheerfully endured my occasional absence (or worse yet
  807. my distracted presence) while I wrote this program.   Those who know
  808. how quickly three daughters can realize and react to the fact that a
  809. 1-1 zone defense by 2 parents has collapsed into a 3 on 1 break
  810. against Mom alone will appreciate the sacrifice made.
  811.  
  812.  
  813. 8 REFERENCES
  814.  
  815. Antworth, Evan L. 1990. PC-KIMMO: a two-level processor for
  816.     morphological analysis. Occasional Publications in Academic
  817.     Computing No. 16. Dallas, TX: Summer Institute of Linguistics.
  818.     ISBN 0-88312-639-7, 273 pages, paperbound.
  819.  
  820. Dalrymple, Mary et al. 1987. DKIMMO/TWOL: a development environment
  821.     for morphological analysis. Stanford, CA: Xerox Palo Alto Research
  822.     Center and Center for the Study of Language and Information.
  823.  
  824.