T-rule
From UNL Wiki
(Difference between revisions)
Line 1: | Line 1: | ||
− | T-rules, or transformation rules, are rules that alter the state of the | + | T-rules, or transformation rules, are rules that alter the state of the nodes. They are used for normalization, for syntactic analysis and for semantic interpretation. The set of the t-rules form the [[transformation grammar]]. |
+ | |||
+ | == Syntax == | ||
+ | As describe in the [[UNL Grammar Specs]], they follow the general formalism: | ||
<INITIAL STATE>:=<FINAL STATE>; | <INITIAL STATE>:=<FINAL STATE>; | ||
And may be classified according to the type of modification that they promote: | And may be classified according to the type of modification that they promote: | ||
Line 9: | Line 12: | ||
*TN, or tree-to-networks, converts trees into networks | *TN, or tree-to-networks, converts trees into networks | ||
*NT, or network-to-trees, converts networks into trees | *NT, or network-to-trees, converts networks into trees | ||
+ | |||
+ | == Examples == | ||
+ | ;LL rules | ||
+ | *(BLK):=; deletes a node that has the feature BLK | ||
+ | *(A):=(+B); add the feature B to a node having the feature A | ||
+ | *(A):=(-A); remove the feature A from a node having the feature A | ||
+ | *(A):=(B)(C); replaces a node having the feature A by two nodes having the features B and C, respectively | ||
+ | *(A)(B):=(C); replaces two nodes having the features A and B, respectively, by a node having the feature C | ||
+ | ;TT rules | ||
+ | *XB(A;B):=; deletes the relation XB between two nodes having the features A e B, respectively] | ||
+ | *XB(A;B):=XA(C;D); replaces the relation XB between two nodes having the features A and B, respectively, by a a relation XA between two nodes having the features C and D | ||
+ | *XB(A;B):=XB(+C;-B); adds the feature C to the source argument and removes the feature B from the target argument of a relation XB where the the source node has the feature A and the target node has the feature B | ||
+ | *XB(A;B):=+XC(C;D); adds the relation XC between two nodes having the features C and D, respectively, to the graph where exists a relation XB between two nodes having the feature A and B, respectively | ||
+ | ;NN rules | ||
+ | *agt(A;B):=; deletes the relation agt between two nodes having the features A e B, respectively] | ||
+ | *agt(A;B):=obj(C;D); replaces the relation agt between two nodes having the features A and B, respectively, by a a relation obj between two nodes having the features C and D | ||
+ | *agt(A;B):=agt(+C;-B); adds the feature C to the source argument and removes the feature B from the target argument of a relation agt where the the source node has the feature A and the target node has the feature B | ||
+ | ;LT rules | ||
+ | *(A)(B):=XB(C;D); replaces two nodes having the features A and B respectively by a relation XB between two nodes having the features C and D, respectively | ||
+ | ;TL rules | ||
+ | *XB(C;D):=(A)(B); replaces the relation XB between two nodes having the features C and D, respectively, by two nodes having the features A and B, respectively | ||
+ | ;TN rules | ||
+ | *XB(%a;%b):=agt(%a;%b); replaces the relation XB between two nodes %a and %b by a relation agt between the same nodes | ||
+ | ;NT rules | ||
+ | *agt(%a;%b):=XB(%a;%b); replaces the relation agt between two nodes %a and %b by a relation XB between the same nodes | ||
+ | |||
+ | == Further information == | ||
+ | For further information on t-rules, see the [[UNL Grammar Specs]] |
Revision as of 22:20, 2 August 2012
T-rules, or transformation rules, are rules that alter the state of the nodes. They are used for normalization, for syntactic analysis and for semantic interpretation. The set of the t-rules form the transformation grammar.
Syntax
As describe in the UNL Grammar Specs, they follow the general formalism:
<INITIAL STATE>:=<FINAL STATE>;
And may be classified according to the type of modification that they promote:
- LL, or list-to-list, where the initial state and the final state are list structures
- TT, or tree-to-tree, where the initial state and the final state are tree structures
- NN, or network-to-network, where the initial state and the final state are network structures
- LT, or list-to-tree, converts lists into trees
- TL, or tree-to-list, converts trees into lists
- TN, or tree-to-networks, converts trees into networks
- NT, or network-to-trees, converts networks into trees
Examples
- LL rules
- (BLK):=; deletes a node that has the feature BLK
- (A):=(+B); add the feature B to a node having the feature A
- (A):=(-A); remove the feature A from a node having the feature A
- (A):=(B)(C); replaces a node having the feature A by two nodes having the features B and C, respectively
- (A)(B):=(C); replaces two nodes having the features A and B, respectively, by a node having the feature C
- TT rules
- XB(A;B):=; deletes the relation XB between two nodes having the features A e B, respectively]
- XB(A;B):=XA(C;D); replaces the relation XB between two nodes having the features A and B, respectively, by a a relation XA between two nodes having the features C and D
- XB(A;B):=XB(+C;-B); adds the feature C to the source argument and removes the feature B from the target argument of a relation XB where the the source node has the feature A and the target node has the feature B
- XB(A;B):=+XC(C;D); adds the relation XC between two nodes having the features C and D, respectively, to the graph where exists a relation XB between two nodes having the feature A and B, respectively
- NN rules
- agt(A;B):=; deletes the relation agt between two nodes having the features A e B, respectively]
- agt(A;B):=obj(C;D); replaces the relation agt between two nodes having the features A and B, respectively, by a a relation obj between two nodes having the features C and D
- agt(A;B):=agt(+C;-B); adds the feature C to the source argument and removes the feature B from the target argument of a relation agt where the the source node has the feature A and the target node has the feature B
- LT rules
- (A)(B):=XB(C;D); replaces two nodes having the features A and B respectively by a relation XB between two nodes having the features C and D, respectively
- TL rules
- XB(C;D):=(A)(B); replaces the relation XB between two nodes having the features C and D, respectively, by two nodes having the features A and B, respectively
- TN rules
- XB(%a;%b):=agt(%a;%b); replaces the relation XB between two nodes %a and %b by a relation agt between the same nodes
- NT rules
- agt(%a;%b):=XB(%a;%b); replaces the relation agt between two nodes %a and %b by a relation XB between the same nodes
Further information
For further information on t-rules, see the UNL Grammar Specs