Index

From UNL Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "Indexes (%) are used for co-indexing nodes, attributes and values inside and between the left and the right side of T-rules and N-rules. == Use == :X(%a;)Y(%a;) (the ...")
 
Line 1: Line 1:
Indexes (%) are used for co-indexing nodes, attributes and values inside and between the left and the right side of [[T-rule]]s and [[N-rule]]s.
+
Indexes (%) are used for co-indexing nodes, attributes and values inside and between the left and the right side of [[T-rule]]s.
  
 
== Use ==
 
== Use ==

Revision as of 15:14, 16 August 2013

Indexes (%) are used for co-indexing nodes, attributes and values inside and between the left and the right side of T-rules.

Contents

Use

X(%a;)Y(%a;) (the first node of X is also the first node of Y)
X(%a;%b):=Y(%b;%a); (the first node of X becomes the second node of Y, and the second node of X becomes the first node of Y)
X(%a;)Y(%a;):=Z(%a); (if the first node of X is the first node of Y then make it the single node of Z)
Any co-indexation is made by the use of indexes and not by the repetition of features. In that sense, X(A;)Y(A;) is different from X(%a;)Y(%a;). In the former case, the first node of X is not necessarily the first node of Y, they only share the same feature A; in the latter case, the first node of X is necessarily the first node of Y.
Indexes may also be used to transfer attribute values expressed in the format ATTRIBUTE=VALUE
X(A,%a,ATT1=VAL1;B,%b):=X(%a;%b,ATT1=%a); (the value "VAL1" of "ATT1" of %a is copied to the node %b)

Syntax

Indexes are made of any sequence of alphanumeric characters and underscore preceded by %:

%index
%a
%first_index
%a1
%first index (no blank spaces are allowed)
%01 (numbers are used for default indexation and must be avoided - see below)

Indexation

Default indexation
If omitted, indexes are assigned by default, according to the following rules:
Default indexes are assigned from left to right in each side of the rule according to the position of the nodes:
X(A;B)Y(C;D) is the same as X(%01,A;%02,B)Y(%03,C;%04,D)
Default indexation is done only for non-indexed nodes (i.e., user-defined indexes prevail over indexes assigned by default):
X(A,%A;B)Y(C,%C;D) is the same as X(A,%A;B,%02)Y(C,%C;%04,D)
(Notice that the user-defined indexes %A and %C are preserved and not replaced by default indexes)
In default indexation, left-side nodes are automatically co-indexed with right-side nodes if and only if their position and number are the same:
X(A;B):=Y(C;D); is the same as X(%01,A;%02,B):=Y(%01,C;%02,D);
X(A;B):=Y(C;D;E); is the same as X(%01,A;%02,B):=Y(%03,C;%04,D;%05,E);
(there is no co-indexation between the left and the right side in the latter case, because the number of the nodes is not the same)
Default indexes are also assigned to hyper-nodes and sub-nodes
(((A))):=(((B))); is the same as (%01(%01%01(%01%01%01,A))):=(%01(%01%01(%01%01%01,B)));
In default indexation, sub-nodes are informed by the syntax <PARENT NODE><CHILD NODE>, where <PARENT NODE> may be, itself, a sub-node:
X(Y(A;B);C) is the same as X(%01,Y(%01%01,A;%01%02,B);%02)
%01 = Y(A;B), %02 = C, %01%01 = A, %01%02 = B
X(Y(Z(A;B);C);D) is the same as X(%01,Y(%01%01,Z(%01%01%01,A;%01%01%02,B);%01%02,C);%02,D)
%01 = Y(Z(A;B);C), %02 = D, %01%01 = Z(A;B), %01%02 = C, %01%01%01 = A, %01%01%02 = B
Non-indexed nodes in the right side means ADDITION, whereas left-side nodes that are not referred to in the right side means DELETION
X(%a;%b):=Y(%a;X;%b); is the same as X(%a;%b):=Y(%a;%02,X,;%b); (it means that a new node with the feature X will be created for the relation Y)
X(%a;%b;%c):=Y(%a;%c); (it means that the second node of X will be deleted from the relation Y)

Compound NLWs

Special indexes (#) are used to make reference to the internal structure of the field <NLW> in the dictionary
(X)(Y):=(X,#02)(Y)(X,#01);
The rule above is used for complex dictionary entries such as:
[[A][B]] "uw" (X, #01(ATT=AAA), #02(ATT=BBB)) <flg,fre,pri>;
It means that, given (X)(Y), the output should be (B)(Y)(A).
Software