L-rule
(→When to use Ph-rules) |
|||
Line 1: | Line 1: | ||
'''Ph-rule''' (phonetic rule) is the formalism used for generating spelling changes in the UNL<sup>arium</sup> framework. | '''Ph-rule''' (phonetic rule) is the formalism used for generating spelling changes in the UNL<sup>arium</sup> framework. | ||
== When to use Ph-rules == | == When to use Ph-rules == | ||
− | Ph-rules are used for generating spelling changes (such as | + | Ph-rules are used for generating spelling changes (such as in contraction, elision, assimilation, etc). They are also used to generate other spelling conventions, such as the use of capital letters and punctuation marks. |
== When not to use Ph-rules == | == When not to use Ph-rules == |
Revision as of 12:07, 22 March 2010
Ph-rule (phonetic rule) is the formalism used for generating spelling changes in the UNLarium framework.
Contents |
When to use Ph-rules
Ph-rules are used for generating spelling changes (such as in contraction, elision, assimilation, etc). They are also used to generate other spelling conventions, such as the use of capital letters and punctuation marks.
When not to use Ph-rules
Ph-rules are not to be used for sound changes that do not affect spelling.
Syntax
The general syntax for Ph-rules is the following:
(CONDITION) := (ACTION);
Where:
- CONDITION is a single form or a sequence of forms over which actions will take place; and
- ACTION is the action to be performed over each form or sequence of forms of the CONDITION.
CONDITION and ACTION may be expressed as:
- a character or string of characters, between quotes: ("a");
- a tag or list of tags, extracted from the UNDL Foundation tagset: (VOW);
- a combination of characters and tags: ("a",PRE);
Examples:
- ("Mr."):=("Mister"); (replace "Mr." by "Mister")
- ("doctor"):=("dr."); (replace "doctor" by "dr.")
- Conditions and actions must always come between parentheses
- ("Mr."):=("Mister");
"Mr.":="Mister";
- Context-sensitiveness
Ph-rules are normally sensitive to the context and apply over a set of conditions rather than over isolated word forms. In this case, each separate word form must be isolated between parentheses and described as a different condition.
("I am"):=("I'm);- ("I")(BLK)("am"):=("I'm");
Types of Ph-rules
There are basically three types of Ph-rules:
- replacement, when the number of parentheses in the CONDITION field is equal to the number of parentheses in the ACTION field:
- addition, when the number of parentheses in the CONDITION field is lower than the number of parentheses in the ACTION field;
- deletion, when the number of parentheses in the CONDITION field is greater than the number parentheses in the ACTION field.
Parentheses are automatically co-indexed between the CONDITION and the ACTION field, so that the first pair of parentheses of the CONDITION field corresponds to the first pair of parentheses of the ACTION field, and so on. This means that parentheses are to be repeated on the right side of a Ph-rule if they are not expected to be deleted. In order to control the process of adding, deleting and reordering, parentheses may be referred by the index "%N" where N is the order of appearance in the left side:
RULE | BEFORE > AFTER | DESCRIPTION |
---|---|---|
("a")("b")("c"):=("d")("e")("f"); | abc > def | "a" will be replaced by "d"; "b" by "e"; and "c" by "f" |
("a")("b")("c"):=("d")( )( ); | abc > dbc | "a" will be replaced by "d"; "b" and "c" will be preserved |
("a")("b")("c"):=("d")("")(""); | abc > d | "a" will be replaced by "d"; "b" and "c" will be replaced by "" (i.e., blank) |
("a")("b")("c"):=("d")( ); | abc > ab | "a" will be replaced by "d"; "b" will be preserved; "c" will be deleted |
("a")("b")("c"):=("d"); | abc > d | "a" will be replaced by "d"; "b" and "c" will be deleted |
("a")("b")("c"):=(%03)(%02)(%01); | abc > cba | "a", "b" and "c" will be preserved, but reordered |
("a")("b")("c"):=("d")(%03); | abc > dc | "a" will be replaced by "d"; "b" will be deleted; "c" will be preserved |
("a")("b")("c"):=("d")("g")( )( ); | abc > dgc | "a" will be replaced by "d"; "b" will be replaced by "g"; "c" will be preserved; and a new form will be generate after it |
("a")("b")("c"):=("d")("g")(%02)(%03); | abc > dgbc | "a" will be replaced by "d"; "g" will be generated after it; and then "b" and "c", which will be preserved |
Conditions may be expressed by features in addition to strings of characters. Features are added through "+" and deleted through "-". No feature is deleted unless explicitly indicate through "-".
RULE | BEFORE > AFTER | DESCRIPTION |
---|---|---|
("a",ART)(BLK)(VOW):=("an")( )( ); | a adjective > an adjective | replace the article "a" by "an" before a blank space and a vowel |
("a",PRE)(BLK)("a",ART):=("à",+ART,+CTC); | a a > à | replace the preposition "a" in front of blank and "a" by "à"; add the features ART (article) and CTC (contraction); and delete the blank and the second "a" |
("de",PRE)(BLK)("le",ART):=("du",+ART,+CTC); | de le > du | replace the preposition "de" in front of blank and "le" by "du"; add the features ART and CTC; and delete the blank and "le" |
("a",VER)(BLK)("il",PPR):=( )("-t-",-BLK)( ); | a il > a-t-il | replace the blank space between the verb "a" and the pronoun "il" by "-t-" |
("de",PRE)(BLK)(VOW):=("d'")(%3); | de avoir > d'avoir | replace the preposition "de" before a blank space and a vowel by "d'" and delete the blank space |
Observations
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 prefixation rule)
- X:=1>1; (WRONG: The right side must always be a string in a suffixation rule)
- X:=1; (WRONG: Replacement rules do not allow for numbers)
- X:=1:1; (WRONG: Replacement rules do not allow for numbers)
Formal syntax
A-rules comply with the following syntax:
<A-RULE> ::= <CONDITION> “:=” <ACTION> ("," <ACTION>)* “;” <CONDITION> ::= <ATAG>(“&”(“^”)?<ATAG>)* <ATAG> ::= {one of the tags defined in the UNDLF Tagset} <ACTION> ::= <PREFIXATION> | <SUFFIXATION> | <INFIXATION> | <REPLACEMENT> <PREFIXATION> ::= <ADDED> {“<” | “<<”} (<DELETED>)? <SUFFIXATION> ::= (<DELETED>)? {“>” | “>>”} <ADDED> <INFIXATION> ::= "["<DELETED"]" ">" <ADDED> | <ADDED> "<" "["<DELETED"]" <REPLACEMENT> ::= ( <STRING> ":" )? <ADDED> | "[" <INTEGER> "-" <INTEGER> "]" ":" <ADDED> <ADDED> ::= <STRING> <DELETED> ::= <STRING> | <INTEGER> <STRING> ::= “ “ “ [a..Z]+ “ “ “ <INTEGER> ::= [0..9]+
where
<a> = a is a non-terminal symbol
“a“ = a is a constant
a | b = a or b
{ a | b } = either a or b
(a)? = a can occur 0 or 1 time
(a)* = a can be repeated 0 or more times
(a)+ = a can be repeated 1 or more times