Project

General

Profile

Element Expression Examples » History » Version 1

Robert Bossy, 08/23/2011 04:45 PM

1 1 Robert Bossy
{{toc}}
2 1 Robert Bossy
3 1 Robert Bossy
The type of the expected kind of context element is given between brackets in the example title.
4 1 Robert Bossy
5 1 Robert Bossy
h3. Sections in the corpus [corpus]
6 1 Robert Bossy
7 1 Robert Bossy
<pre>
8 1 Robert Bossy
documents.sections
9 1 Robert Bossy
</pre>
10 1 Robert Bossy
11 1 Robert Bossy
h3. Abstract sections [corpus]
12 1 Robert Bossy
13 1 Robert Bossy
<pre>
14 1 Robert Bossy
documents.sections:abstract
15 1 Robert Bossy
</pre>
16 1 Robert Bossy
17 1 Robert Bossy
or
18 1 Robert Bossy
19 1 Robert Bossy
<pre>
20 1 Robert Bossy
documents.sections(name == "abstract")
21 1 Robert Bossy
</pre>
22 1 Robert Bossy
23 1 Robert Bossy
First is faster.
24 1 Robert Bossy
25 1 Robert Bossy
h3. Abstract sections in the test set [corpus]
26 1 Robert Bossy
27 1 Robert Bossy
<pre>
28 1 Robert Bossy
documents(set == "test").sections:abstract
29 1 Robert Bossy
</pre>
30 1 Robert Bossy
31 1 Robert Bossy
This assumes that documents have a feature with key _set_ that denote the set to which it pertains.
32 1 Robert Bossy
33 1 Robert Bossy
h3. All genes and taxa [section]
34 1 Robert Bossy
35 1 Robert Bossy
<pre>
36 1 Robert Bossy
layer:genes | layer:taxa
37 1 Robert Bossy
</pre>
38 1 Robert Bossy
39 1 Robert Bossy
or
40 1 Robert Bossy
41 1 Robert Bossy
<pre>
42 1 Robert Bossy
layer('ne-tpe' == "gene" or 'ne-type' == "species")
43 1 Robert Bossy
</pre>
44 1 Robert Bossy
45 1 Robert Bossy
The first is faster. It assumes that all gene annotations are in a layer named _genes_, and that all taxon annotations are in a layer _taxa_. The annotations are given in the following order: first genes in standard order, then taxa in standard order.
46 1 Robert Bossy
47 1 Robert Bossy
The second assumes that annotations have a feature names _ne-type_ containing the named entity type of the annotation. The annotations are given in standard order regardless of the type.
48 1 Robert Bossy
49 1 Robert Bossy
h3. All words included in a sentence [annotation]
50 1 Robert Bossy
51 1 Robert Bossy
<pre>
52 1 Robert Bossy
inside:words
53 1 Robert Bossy
</pre>
54 1 Robert Bossy
55 1 Robert Bossy
This assumes that the context element is an annotation representing a sentence. It also assumes that all words are in a layer named _words_.
56 1 Robert Bossy
57 1 Robert Bossy
h3. All verbs [section]
58 1 Robert Bossy
59 1 Robert Bossy
<pre>
60 1 Robert Bossy
layer:words(pos ^= "V")
61 1 Robert Bossy
</pre>
62 1 Robert Bossy
63 1 Robert Bossy
or
64 1 Robert Bossy
65 1 Robert Bossy
<pre>
66 1 Robert Bossy
layer:words(pos =~ "^V")
67 1 Robert Bossy
</pre>
68 1 Robert Bossy
69 1 Robert Bossy
Both assume all word annotations are in a layer named _words_ and have a feature with key _pos_ whose value denote its POS. First should be slightly faster.
70 1 Robert Bossy
71 1 Robert Bossy
h3. All syntactic dependencies [section]
72 1 Robert Bossy
73 1 Robert Bossy
<pre>
74 1 Robert Bossy
relations:dependencies.tuples
75 1 Robert Bossy
</pre>
76 1 Robert Bossy
77 1 Robert Bossy
This assumes syntactic dependencies are in a relation named _dependencies_.
78 1 Robert Bossy
79 1 Robert Bossy
h3. Words that are subject [section]
80 1 Robert Bossy
81 1 Robert Bossy
<pre>
82 1 Robert Bossy
relations:dependencies.tuples(label == "SUBJ:V-N").args:dependent
83 1 Robert Bossy
</pre>
84 1 Robert Bossy
85 1 Robert Bossy
If you insist to check they are subjet to verbs:
86 1 Robert Bossy
87 1 Robert Bossy
<pre>
88 1 Robert Bossy
relations:dependencies.tuples(label == "SUBJ:V-N" and args:head.pos ^= "V").args:dependent
89 1 Robert Bossy
</pre>
90 1 Robert Bossy
91 1 Robert Bossy
h3. Subject of a verb [annotation]
92 1 Robert Bossy
93 1 Robert Bossy
<pre>
94 1 Robert Bossy
tuple:dependencies:head(label == "SUBJ:V-N").args:dependent
95 1 Robert Bossy
</pre>