Hyper-node
(→Properties) |
(→Properties) |
||
Line 77: | Line 77: | ||
;Hyper-nodes and inner nodes are also indexed (see [[Indexation]]) | ;Hyper-nodes and inner nodes are also indexed (see [[Indexation]]) | ||
:(%c,(%b,(%a,"a"))) - a hyper-node %c contaning a hyper-node %b contaning the node %a | :(%c,(%b,(%a,"a"))) - a hyper-node %c contaning a hyper-node %b contaning the node %a | ||
− | :(%c,LEX=%a,(%b,(% | + | :(%c,LEX=%a,(%b,(%a,"a"))) - a hyper-node %c containing a hyper-node %b containing the node %a, where the value of LEX of %c is the same as the value of LEX of %a |
;When a hyper-node is deleted, all its internal relations are deleted, if they are not referenced in the rule | ;When a hyper-node is deleted, all its internal relations are deleted, if they are not referenced in the rule | ||
:(([kick],V)([the],D)([bucket],N)):=; (the hyper-node is deleted, as well as the relations ([kick],V)([the],D) AND ([the],D)([bucket],N)) | :(([kick],V)([the],D)([bucket],N)):=; (the hyper-node is deleted, as well as the relations ([kick],V)([the],D) AND ([the],D)([bucket],N)) |
Latest revision as of 14:23, 24 June 2014
Hyper-nodes are nodes containing relations between nodes. They represent scopes or sub-graphs.
Contents |
Basic Symbols
Symbol | Definition | Example |
---|---|---|
( ) | node | (%a) |
" " | string | "went" |
[ ] | natural language entry (headword) | [go] |
[[ ]] | UW | [[to go(icl>to move)]] |
// | regular expression | /a{2,3}/ = aa,aaa |
rel(x;y) | relation | agt(kill;Peter) |
^ | not | ^a = not a |
{ | } | or | {a|b} = a or b |
% | index for nodes, attributes and values | %x |
: | scope ID | :01 |
# | index for sub-NLWs | #01 |
= | attribute-value assignment | POS=NOU |
! | rule trigger | !PLR |
& | merge operator | %x&%y |
? | dictionary lookup operator | ?[a] |
Basic Concepts
- Node
- A node is the most elementary unit in the graph. It is the result of the tokenization process, and corresponds to the notion of "lexical item". At the surface level, a natural language sentence is considered a list of nodes, and a UNL graph a set of relations between nodes.
- Relation
- In order to form a natural language sentence or a UNL graph, nodes are inter-related by relations. In the UNL framework, there are three different types of relations: the linear (list) relation, syntactic relations and semantic relations.
- Hyper-Node
- A hyper-node is a sub-graph, i.e., a scope: a node containing relations between nodes.
- Hyper-Relation
- A hyper-relation is a relation between relations.
Scopes
- main article: Scope
A scope is a sub-graph inside a graph, i.e., group of relations between nodes that work as a single entity. For instance, in the sentence "Mary saw Peter when John arrived", the dependent clause "when John arrived" describes the argument of a time relation and, therefore, should be represented as a hyper-node (i.e., as a sub-graph) as indicated below:
In the UNL table representation, hyper-nodes are indexed by ":XX", where XX is a two-digit hyper-node index. The main node index is :00 and may be omitted. Hyper-node indexes must be associated to every relation inside the node.
Notation
As any node, hyper-nodes are represented between (parentheses):
- (("a")("b")) - a hyper-node containing a list relation between two nodes
- (L("a";"b")) - the same as above
- (VC("a";"b")) - a hyper-node containing a syntactic relation VC between two nodes
- (agt("a";"b")) - a hyper-node containing a semantic relation agt between two nodes
For better readability, hyper-nodes are normally referenced by the SCOPE ID :XX, where XX is a two-character unique identifier for the hyper-node.
- tim(saw;agt(arrived;John)) (= saw when John arrived) is represented as
- tim(saw;:01)
- agt:01(arrived;John)
All relations inside the same scope must share the same scope ID
- tim(saw;agt(killed;John)obj(killed;Peter)) (= saw when John killed Peter) is represented as
- tim(saw;:01)
- agt:01(killed;John)
- obj:01(killed;Peter)
The scope ID of the main scope is 00 and is omitted by default.
- tim(saw;:01)agt:01(arrived;John) is the same as tim:00(saw;:01)agt:01(arrived;John)
Elements
As any node, hyper-nodes are vectors (uni-dimensional arrays) containing the following necessary elements:
- a string, represented between "quotes"
- a headword, represented between [simple square brackets]
- a UW, represented between [[double square brackets]]
- features, of which the internal relations are a special type
- an index, preceded by %
Properties
- As any node, hyper-nodes are expressed between (parentheses)
- (("a")("b"))
- Elements of inner nodes are not elements of hyper-nodes
- (%a,"a",[a],[[a]],A,(%b,"b",[b],[[b]],B))
- The elements of the hyper-node %a are "a", [a], [[a]], A and the node %b
- The elements of the node %b are "b", [b], [[b]], B
- The whole inner node (%b,"b",[b],[[b]],B) is an element of %a and may be used to reference it: (("b")), (([b])), (([[b]]), ((B))
- However, "b", [b], [[b]] and B are not elements of %a (i.e., %a will not match ("b") but only (("b"))
- As any node, hyper-nodes may have one single string, one single headword and one single UW, but may have as many features as necessary
- (([kick],V)([the],D)([bucket],N),"kick the bucket",[kick the bucket],[[die]],V,NTST)
- the hyper-node is formed of the following elements:
- the string "kick the bucket"
- the headword [kick the bucket]
- the UW [[die]]
- the features V and NTST
- the list relation between the nodes ([kick],V)([the],D)([bucket],N)
- Note that the string, headword and UW of the hyper-node may not coincide with the corresponding values of the inner nodes.
- the hyper-node is formed of the following elements:
- Internal nodes and relations work in the same way as features
- (("a"),("b")) (a hyper-node containing two nodes: ("a") and ("b") (there is no necessary relation between ("a") and ("b"))
- (("a")("b")) (a hyper-node containing a list relation between the nodes ("a") and ("b")
- ({("a")|("b")}) (a hyper-node containing either the node ("a") or the node ("b")
- ({("a")("b")|("c")("d")}) (a hyper-node containing either a list relation between the nodes ("a") and ("b") or a list relation between the nodes ("c") and ("d")
- (rel("a";"b"),rel("c";"d")) (a hyper-node containing the relations rel("a";"b") and the relation rel("c";"d"))
- (rel("a";"b")rel("c";"d")) (the same as above)
- ({rel("a";"b")|rel("c";"d")}) (a hyper-node containing either the relation rel("a";"b") or the relation rel("c";"d"))
- As any node, hyper-nodes may be referenced by any of its elements, including internal nodes and relations
- (([kick],V)) - refers to any hyper-node containing the node ([kick],V)
- (([the],D)([bucket],N)) - refers to any hyper-node containing a linear relation between ([the],D) AND ([bucket],N)
- (([kick],D),([bucket],N)) - refers to any hyper-node containing the nodes ([kick],V) AND ([bucket],N)
- A hyper-node can be the internal node of another hyper-node
- ((("a"))) - a hyper-node containing a hyper-node containing the node "a"
- Hyper-nodes and inner nodes are also indexed (see Indexation)
- (%c,(%b,(%a,"a"))) - a hyper-node %c contaning a hyper-node %b contaning the node %a
- (%c,LEX=%a,(%b,(%a,"a"))) - a hyper-node %c containing a hyper-node %b containing the node %a, where the value of LEX of %c is the same as the value of LEX of %a
- When a hyper-node is deleted, all its internal relations are deleted, if they are not referenced in the rule
- (([kick],V)([the],D)([bucket],N)):=; (the hyper-node is deleted, as well as the relations ([kick],V)([the],D) AND ([the],D)([bucket],N))
- (([kick],V)):=; (all hyper-nodes containing the node ([kick],V) are deleted, even if the hyper-node consists of several other inner nodes
Examples
Examples of hyper-nodes are the following:
- (("a"),("b")) - a hyper-node containing the nodes ("a") and ('b")
- (("a")("b")) - a hyper-node containing a linear relation between the nodes ("a") and ("b")
- (VC(%x;%y)VA(%x;%z)) - a hyper-node containing two syntactic relations: VC(%x;%y) AND VA(%x;%z)
- (agt([a];[b])obj([a];[c])) - a hyper-node containing two semantic relations: agt([a];[b]) AND obj([a];[c])
- (([kick],V)([the],D)([bucket],N),V,NTST) - a hyper-node having the features V and NTST and containing two linear relations: one between the nodes ([kick],V) and ([the],D), and other between ([the],D) and [bucket],N)
- (([kick],V)([the],D)([bucket],N),"kick the bucket",[[die]],V,NTST) - the same as before, except for the fact that the hyper-node has string = "kick the bucket" and UW = [[die]]
Hyper-nodes may also contain internal hyper-nodes:
- ((("a")("b"))("c")) - a hyper-node containing a linear relation between the hyper-node (("a")("b")) and the node ("c")
Transformations
Changes
Hyper-nodes, as nodes, have elements, which may be altered by the use of the operators + (add) and - (delete). The operator + may be omitted. Changes affect only the scopes indicated.
- Changes to the main scope
- (%a,"a",[a],[[a]],A,(%b,"b")):=(%a,"c");(the string of the hyper-node is set to "c"; the internal node %b is not affected)
- (%a,"a",[a],[[a]],A,(%b,"b")):=(%a,"");(the string of the hyper-node is set to ""; the internal node %b is not affected)
- (%a,"a",[a],[[a]],A,(%b,"b")):=(%a,-"a");(the same as above)
- (%a,"a",[a],[[a]],A,(%b,"b")):=(%a,[c]);(the headword of the hyper-node is set to [c]; the internal node %b is not affected)
- (%a,"a",[a],[[a]],A,(%b,"b")):=(%a,[[c]]);(the UW of the hyper-node is set to [[c]]; the internal node %b is not affected)
- (%a,"a",[a],[[a]],A,^B,(%b,"b")):=(%a,+B);(add the feature B to the hyper-node %a; the internal node %b is not affected)
- (%a,"a",[a],[[a]],A,^B,(%b,"b")):=(%a,B); (the same as above: add the feature B to %a)
- (%a,"a",[a],[[a]],A,(%b,"b")):=(%a,-A);(delete the feature A from the hyper-node %a; the internal node %b is not affected)
- Changes to inner scopes
- (%a,(%b,"b",[b],[[b]],B)):=(%a,(%b,"c"));(the string of the inner node %b is set to "c"; the hyper-node %a is not affected)
- (%a,(%b,"b",[b],[[b]],B)):=(%a,(%b,""));(the string of the inner node %b is set to ""; the hyper-node %a is not affected)
- (%a,(%b,"b",[b],[[b]],B)):=(%a,(%b,-"b"));(the same as above)
- (%a,(%b,"b",[b],[[b]],B)):=(%a,(%b,[c]));(the headword of the inner node %bis set to [c]; the hyper-node %a is not affected)
- (%a,(%b,"b",[b],[[b]],B)):=(%a,(%b,[[c]]));(the UW of the inner node %b is set to [[c]]; the hyper-node %a is not affected)
- (%a,(%b,"b",[b],[[b]],B,^C)):=(%a,(%b,+C));(add the feature C to the inner node %b; the hyper-node %a is not affected)
- (%a,(%b,"b",[b],[[b]],B,^C)):=(%a,(%b,C)); (the same as above: add the feature C to %b)
- (%a,(%b,"b",[b],[[b]],B)):=(%a,(%b,-B));(delete the feature B from the inner node %b; the hyper-node %a is not affected)
- Rules must have as many parentheses as the depth of the inner scope to be altered
- (%a,(%b,(%c,(%d,(%e,"e",[e],[[e]],E))))):=(%a,(%b,(%c,(%d,(%e,"f"))))); (the string of inner node %e is set to "f"; the enclosing nodes %d, %c, %b and %a are not affected)
- Hyper-nodes do not need to be represented if the changes apply to nodes instead of nodes inside hyper-nodes
- (%a,(%b,"b",[b],[[b]],B)):=(%a,(%b,"c")); (the string of the inner node %b is set to "c"; the hyper-node %a is not affected)
could be represented simply as
- (%b,"b",[b],[[b]],B)):=(%b,"c");
if the changes apply to all nodes ("b",[b],[[b]],B) and not only to those inside scopes.
Deletion
Hyper-nodes, as any node, are deleted if they are not repeated (co-indexed) in the right side. In this case, all the inner nodes are deleted as well:
- (REL(%x;%y),%z):=; (the hyper-node %z will be deleted, and all its internal nodes and relations as well)
As any feature, inner nodes are conservative, and are not deleted even if they are not repeated (co-indexed) in the right side:
- (%a,A,^B):=(%a,+B); (the feature A is not deleted from the node %a)
- (%a,^B,(%b,"b")):=(%a,+B); (the node %b is not deleted from the hyper-node %a)
In order to delete inner nodes, the operator "-" must be used
- (%a,A,(%b,B)):=(%a,-(%b)); (the node %b is deleted from the hyper-node %a)
- (%a,A,rel(%b;%c)):=(%a,-rel(%b;%c)); (the relation rel(%b;%c) is deleted from the hyper-node %a)
Extraction
Nodes may be extracted from hyper-nodes by removing the corresponding parentheses. In this case, the hyper-node is deleted (along with its features), but the internal nodes and relations are preserved, if repeated on the right side.
- ((%x),%y):=(%x); (the hyper-node %y is deleted, but its internal node %x is preserved; in case %y have nodes other than %x, these nodes will be deleted as well, because they are not repeated in the right side)
- (REL(%x;%y),%z):=REL(%x;%y); (the hyper-node %z is deleted, but its internal relation REL(%x;%y) is preserved; in case %z have relations other than REL(%x;%y), and nodes other than %x and %y, these will be deleted as well, because they are not repeated in the right side.
Create
Hyper-nodes are created through the encapsulation of existing nodes
- (%x):=((%x),%y); (the hyper-node %y is created, with the node %x there inside)
- REL(%x;%y):=(REL(%x;%y),%z); (the hyper-node %z is created, with the relation REL between the nodes %x and %y inside)
- (%x)(%y):=((%x)(%y),%z); (the hyper-node %z is created, with the linear relation between the nodes %x and %y there inside)
- Attention
- relations and nodes must be repeated in the right side or they will be deleted
- (%x):=(%y); (the node %x will be simply replaced by %y; no hyper-node will be created)
- REL(%x;%y):=(%z); (the relation REL between the nodes %x and %y will be replaced by the node %z; no hyper-node will be created)