• Nem Talált Eredményt

A.1.3.1 Conditional blocks

Examples

1. if(cat_(N|Adj|Num|Part)) {

... #all rules specific to nominal stems go within this block }

2. unless(phon:/(?:[aeo¨o]|$C2)$/||GEM||stemalt:/./) {

... #the most common case: no alternation }

elsif(!stemalt:/./) {

... #productive alternations }

else {

... #improductive stem alternations }

Theifblock The most common conditional block is theifblock (example 1.). The modifier of theif block is of the formif(<Boolean expression>), i.e. the keyword if is followed by a Boolean expression in parentheses. The block following theif modifier is only evaluated if the condition expressed by the Boolean expression is true. All the properties of the conditional field of the attribute manipulation instruction apply to the Boolean expression in the conditional block modifier: you can use Boolean operators (&&,||and!, but not parentheses), regular expressions, attribute name prefixes (the default attribute to check isrp), substitution etc.

Theunlessblock The only difference between theifblock and theunlessblock (example 2.) is that in the case of the latter the block is only executed if the Boolean expression in the modifier is false.

Theelsifblock Anelsifblock (example 2.) is executed if neither the precedingiforunlessblock or any of the preceding elsifblocks were executed and the Boolean expression in the modifier is evaluated to be true.

Theelseblock An else block (example 2.) is executed if neither the preceding if orunless block or any of the precedingelsifblocks were executed. Anelseorelsifblock can also be used right after a single attribute manipulation instruction if that instruction has a conditional.

A.1.3.2 Generating allomorphs and setting their properties (allomorph generation blocks)

Examples

1. root:/dzs$/&&!GEM&&DIG #if the root is non-geminate dzs final +;;DIG; #bridzs (base allomorph)

+//ddzs/;INS;=Al; #briddzs(el), +// is a shorthand for +/dzs$/

2. root:/([ds]z|[cz]s|[ltgn]y)$/&&!GEM&&DIG #non-gem. digraph final +;;DIG; #fagy (base allomorph)

+/(.)(.)$/$1$1$2/;INS;=Al; #faggy(al)

Description Allomorph generation rules consist of a conditional row (bold) that checks whether the conditions for the stem allomorphy described by the rule are met and a sequence of allomorph generation instructions that actually generate the allomorphs (these begin with a +).

The conditional row The conditional row first names the attribute from the value of which the form of allomorphs is generated (this is normally the root attribute) and checks some property (usually the ending) of it using a regular expression. Additional properties may be checked using Boolean operators (&&,||and!). Note that this conditional row does not contain semicolons (;) in contrast to attribute manipulation rows.

The allomorph gener-ation rows

Allomorph generation rows conform to the general format of attribute manipulation instructions. In this case, however, the conditional field begins with a + (this indicates the addition of an allomorph to the list of allomorphs.) The other fields can be used as usual to set requirements and properties. In this context, however, not global (i.e. morpheme level) properties and requirements are set, but local ones: i.e. the requirements and properties set in the allomorph generation rows pertain only to the allomorph generated by the statement. Negative properties can also be given and thus morpheme-level properties can be deleted in individual allomorphs (see the example below).

Adding the base allo-morph

If the+ is not followed by slashes (i.e. field 1 consists only of a + or the +is followed by a Boolean operator), like in the first allomorph generation row of both examples 1. and 2. above, then the form of the allomorph to be added is identical to the value of the attribute named in the conditional row (i.e. that of the root attribute). This is the base (‘lexical’) allomorph of the morpheme.

Adding other allo-morphs

Otherwise the expression that follows the+sign must in fact be a regular expression based substitution expression (but no s before the first slash). The form of the allomorph to be added is produced from the value of the attribute named in the conditional row (i.e. that of the root attribute) by applying the changes specified by the substitution expression to it. If the regular expression in the row does not match the value of the specified attribute (i.e. root), then no allomorph is added by the row. E.g., in the case of the example below, while the first allomorph generation row applies to both o-final and ¨o-final stems (generating a base allomorph), the second row applies only to o-final ones, while the last one applies only to ¨o-final ones.

#o-final lengthening Oslo -> Osl´o root:/[o¨o]$/

+;0mrf;;

+/o$/´o/;!0mrf;;

+/¨o$/}o/;!0mrf;;

If the regexp is empty If the regular expression part of the substitution expression is empty (i.e. two slashes follow the+, as in the second allomorph generation row of example 1.), then the regular expression given in the conditional row (/dzs$/ in the case of example 1.) is used.

Inserting a harmonic vowel

In the Hungarian description, an ! at the end of the replacement part of a substitution expression in an allomorph generation row marks that the automaton computing vowel harmony must be applied to the form of the allomorph generated by the statement. In the case of the following example, the second allomorph generation row first generates the formf¨urOd! from therootf¨urd by inserting the mid harmonic vowelO, to which vowel harmony is applied (because of the final

!), and thus we obtain the correct allomorph formf¨ur¨od.

#f¨urd.ik

root:/($C)d$/&&-ik&&1syl

+;; -ik -Ok -Unk -´As -´O -And´O -AtlAn =At =Asz =AlAk =AnA =AnAk =OtOk +//$1Od!/;; -hAt -vA =jUk =j =d =gAt =sz =lAk =nA =nAk =tOk =tAm This is not a built-in feature, however, but it is achieved by the following row in an allomorph list manipulation block (for(@allomfs), see below) that affects all allomorphs (dovhrm()applies a Kimmo vowel harmony automaton to the string given as its argument):

#! at the end of allomorph marks that vowel harmony must be done:

allomf:s/(.*)!$/dovhrm($1)/e;;;

(The/eswitch at the end of the substitution expression indicates that the replace-ment part of the expression should be evaluated as a perl expression (and call the subroutinedovhrm) instead of as a string.)

Flow of control in allomorph generation rules

A single allomorph generation rule behaves like a conditional block concerning control flow, i.e. if the initial conditional is satisfied, then all the allomorph generation rows in the block are evaluated in sequence. A sequence of allomorph generation rules behave like a sequence ofif-elsifblocks: the first rule the initial conditional of which is satisfied is executed, the rest in the sequence are skipped.

Setting variables in the conditional row

You can add special variable assignments to the end of the conditional row of allomorph generation rules in the form of a comment. This construction can be used when some material from an attribute different from the attribute normally used for generating the form of allomorphs (i.e. from something other thanroot) must be used for generating the form of an allomorph. The material from the other attribute (in the example below: fromphon) can be extracted using the regular expression grouping operator(). The material matched by the first, second etc.

group in the last regular expression is always stored in the temporary variables

$1, $2etc. (in the example below: the final digraph of the value of phonfeature is grouped and stored: ($C2)), and it can be permanently stored in a variable by adding a comment containing the variable assignment statement (here: in$finC2) and later used in an allomorph generation row. Note that the comment that contains the variable assignment must begin with two !’s. If you want to have more than one variable assignments, you must separate them with commas (,) (not semicolons (;)). Normal comments are not allowed in the initial conditional row of allomorph generation blocks.

#foreign digraph-final Milosevic -> Miloseviccs(el)

#if the phon is digraph final but the root is not:

!root:/$C2$/&&phon:/($C2)$/#!!$finC2=$1

You can add preconditions to the end of allomorph generation rows (after the third;closing the property setting field). The preconditions follow anifor an unlessin parentheses and have the same format as all other conditionals. These are evaluated first, and the rest of the line is only evaluated if the preconditions are all satisfied.

A.1.3.3 Manipulating properties and requirements of individual allo-morphs (allomorph list manipulation blocks)

Allomorph list manip-ulation blocks

Allomorph list manipulation blocks begin with eitherfor(@allomfs), to manipu-late all allomorphs, orfor($allomfs[0]), to manipulate only the first (normally the base) allomorph and are enclosed in braces{ ... }. The opening and closing braces must appear on a line of their own.

Attribute manipula-tion instrucmanipula-tions

Within the block, you can use the attribute manipulation instructions to a) add left or right properties if certain conditions are met,

b) delete left or right properties if certain conditions are met, c) add left or right requirements if certain conditions are met.

Like in the case where morpheme-level properties are set (i.e. when you use the attribute manipulation instructions outside of an allomorph manipulation block), the default attribute to check in the condition field (field 1) is rp, the default attribute to set in the requirements field (field 2) isrr, and the default attribute to set in the properties field (field 3) isrp.

Allomorph-local at-tributes

In contrast to the morpheme-level case, however, the following attributes are assumed to be allomorph-local in this context: gp, glr, grr, lr, rr, lp, rp andallomf. All the other attributes are global (i.e. they belong to the morpheme as a whole) in this context as well. If, for any reason, you want to refer to the morpheme level variant of therr, rpetc. attributes, or a property within them, precede them with a caret (ˆ).The caret must precede the negation mark if one is present, e.g. ˆ!1syl. See the examples below. You can also use conditional blocks within allomorph list manipulation blocks. In these, the same attributes are assumed to be allomorph-local.

Examples: reference to global properties

for($allomfs[0]) {

##mark the first allomorph of all verbs with -ik/-03 and regular unless marked otherwise

#add -ik or -03 property marking sg3 ind pres ending ˆ-ik&&!-ik;;-ik;

The properties and requirements of individual allomorphs specific to the stem allomorphy are set by the allomorph generation rules already. The morpheme-level properties and requirements coming from the lexicon and specified by mor-pheme level attribute manipulation rules (gp, glr, grr, lr, rr, lp and rp) can be added to these by using the&addprops;statement at the beginning of the for(@allomfs) block (see the example below). Another variant of this statement,

&addlexprops;, adds only properties and requirements specified in the lexicon, but not the ones set by the morpheme-level attribute manipulation rules.

An example

#add properties of nominal allomorphs for(@allomfs)

{

#add morpheme-level properties to each allomorph

&addprops;

#fix the v-final allomf of V->v stems Cfin;;!Vfin;

A.1.3.4 Allomorph duplication blocks

An example

###split underspecified allomfs map(@allomfs)

{

#split vacillating harmonic stems

#VHV:balett -[oe]t, n[ae]k

#VHVF:m´agnes -es, n[ae]k

#VHVB:klarin´et -ot, n[ae]k dup(VHV[FB]?)

{

rp:s/VHVB?/VHB/;;;

rp:s/VHVF?/VHFU/;;;

rp:s/VHVB/VHFU/;Cini;; #only consonant-initial front suffixes rp:s/VHVF/VHB/;Cini;; #only consonant-initial back suffixes }

#split allomorphs having specifications like =A0lAk

#to one having =lAk and another having =AlAk dup(rp:/=[ˆ &]+0/)

{

rp:s/=[ˆ &]+0/=/g;;;

rp:s/=([ˆ &]+)0/=$1/g;;;

} }

Description Allomorph duplication can be done within a map(@allomfs)block. Within the block, only comments anddup(=allomorph duplication) blocks may appear. The dupkeyword is followed by a Boolean expression in parentheses. The dup block is executed if this conditional expression is true.

Within thedupblock, there is a sequence of attribute manipulation instructions, the conditional part of which normally contains a substitution expression which changes the disjunctive property into one of its possible alternatives. Each of the attribute manipulation instructions the conditional of which matches, produces an allomorph with the property changed as specified by the substitution expression, and possibly with the addition or deletion of other properties or requirements.