A-rule
From UNL Wiki
M-rule is the formalism used for describing morphological behavior in the UNL framework. It is used in inflectional paradigms, in inflectional rules, in attribute rules and in morphological settings.
Contents |
Syntax
A M-rule rule should comply with the following syntax:
<F-MOR RULE> ::= <CONDITION> “:=” <ACTION> [, <ACTION>]* “;” <CONDITION> ::= <ATAG>[&[“^”]<ATAG>]* <ATAG> ::= {one of the attribute tags defined in the UNL Tagset} <ACTION> ::= <LEFT APPENDING> | <RIGHT APPENDING> | <REPLACEMENT> <LEFT APPENDING> ::= <ADDED> {“<” | “<<”} [ <DELETED> ] <RIGHT APPENDING> ::= [ <DELETED> ] {“>” | “>>”} <ADDED> <REPLACEMENT> ::= [ <DELETED> ":" ] <ADDED> <ADDED> ::= <STRING> <DELETED> ::= <STRING> | <NUMBER> <STRING> ::= “ “ “ [a..Z]+ “ “ “ <NUMBER> ::= [0..9]+
where
<a> = a is a non-terminal symbol
“a“ = a is a constant
[a] = a can be omitted
a | b = a or b
{ a | b } = either a or b
a* = a can be repeated 0 or more times
a+ = a can be repeated 1 or more times
Examples
Left appending (prefixation) rules
RULE | BEHAVIOR | BEFORE | AFTER |
---|---|---|---|
X:=”y”<”z”; | if X replace the string “z” by the string “y” in the beginning of the string | zabc | yabc |
X:=”y”<1; | if X replace the first character of the string by “y” | zabc | yabc |
X:=”y”<0; | if X add the string “y” to the beginning of the string | zabc | yzabc |
X:=”y”<; | if X add the string “y” to the beginning of the string (idem previous) | zabc | yzabc |
X:=”y”<<0; | if X add the string “y” and a blank space to the beginning of the string | zabc | y zabc |
X:=”y”<<; | if X add the string “y” and a blank space to the beginning of the string (idem previous) | zabc | y zabc |
Right appending (suffixation) rules
RULE | BEHAVIOR | BEFORE | AFTER |
---|---|---|---|
X:=”z”>”y”; | if X replace the string “z” by the string “y” in the end of the string | abcz | abcy |
X:=1>”y”; | if X replace the last character of the string by “y” | abcz | abcy |
X:=0>”y”; | if X add the string “y” to the end of the string | abcz | abczy |
X:=>”y”; | if X add the string “y” to the end of the string (idem previous) | abcz | abczy |
X:=0>>”y”; | if X add a blank space and the string “y” to the end of the string | abcz | abcz y |
X:=>>”y”; | if X add a blank space and the string “y” to the end of the string (idem previous) | abcz | abcz y |
Replacement (infixation) rules
RULE | BEHAVIOR | BEFORE | AFTER |
---|---|---|---|
X:=”y”; | if X replace the whole by “y” | X | y |
X:=”z”:”y”; | if X replace the string “z” by “y” | azbc | aybc |
X:=[2;3]:”y”; | if X replace the second to the third character by “z” | abcz | ayz |
X:=Y; | replace the feature X by the feature Y | X | Y |
Observations
- The symbol “^” can be used for negation (“^MCL” means “not MCL”)
- NOU&^MCL:=”x”:”y”; (If NOU and not MCL then replace “x” by “y”)
- Rules will only be applied if all conditions are true
- X:=”y”<”z”; ( “zabc” changes to “yabc”, but “abc” remains “abc”)
- There can be as many rules as necessary, but they will always be applied from left to right.
- X:=”y”<”z”,”a”<”y”; (“zabc” > “yabc” > “aabc”)
- The replacement rule applies only once the same action
- X:=”a”:”b”; ( “aaa” becomes “baa” and not “bbb”)
- “<<” and “>>” add blank spaces
- X:=”a”<<”b” (“bc” becomes “a bc” and not “abc”)
Common mistakes
- nou:= ”y”<”z”; (WRONG: Tags are case sensitive)
- NNN:= ”y”<”z”; (WRONG: NNN is not defined in the tagset)
- NOUFEM:=”y”<”z”; (WRONG: Tags must be separated by “&”)
- NOU,FEM:=”y”<”z”; (WRONG: Tags must be separated by “&”)
- NOU & FEM:=”y”<”z”; (WRONG: There can be no blank spaces between tags)
- X:=1<1; (WRONG: The left side must always be a string in a left appending rule)
- X:=1>1; (WRONG: The right side must always be a string in a right appending rule)
- X:=1; (WRONG: Replacement rules do not allow for numbers)
- X:=1:1; (WRONG: Replacement rules do not allow for numbers)