Element Expression Examples » History » Version 3
Robert Bossy, 08/23/2011 05:09 PM
1 | 1 | Robert Bossy | {{toc}} |
---|---|---|---|
2 | 1 | Robert Bossy | |
3 | 2 | Robert Bossy | The type of the expected kind of context element is given between brackets in the example title. For detailed information on all the expression parts, you may refer to [[ElementExpression]]. |
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 | 3 | Robert Bossy | h3. Documents whose PMID is in a file [corpus] |
34 | 3 | Robert Bossy | |
35 | 3 | Robert Bossy | <pre> |
36 | 3 | Robert Bossy | documents(pmid in "good_pmids.txt") |
37 | 3 | Robert Bossy | </pre> |
38 | 3 | Robert Bossy | |
39 | 3 | Robert Bossy | This assumes that the PMID of the document is in a feature with key _pmid_, and there is a file in the current directory named _good_pmids.txt_ containing all PMIDs of interest (one per line). |
40 | 3 | Robert Bossy | |
41 | 1 | Robert Bossy | h3. All genes and taxa [section] |
42 | 1 | Robert Bossy | |
43 | 1 | Robert Bossy | <pre> |
44 | 1 | Robert Bossy | layer:genes | layer:taxa |
45 | 1 | Robert Bossy | </pre> |
46 | 1 | Robert Bossy | |
47 | 1 | Robert Bossy | or |
48 | 1 | Robert Bossy | |
49 | 1 | Robert Bossy | <pre> |
50 | 1 | Robert Bossy | layer('ne-tpe' == "gene" or 'ne-type' == "species") |
51 | 1 | Robert Bossy | </pre> |
52 | 1 | Robert Bossy | |
53 | 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. |
54 | 1 | Robert Bossy | |
55 | 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. |
56 | 1 | Robert Bossy | |
57 | 1 | Robert Bossy | h3. All words included in a sentence [annotation] |
58 | 1 | Robert Bossy | |
59 | 1 | Robert Bossy | <pre> |
60 | 1 | Robert Bossy | inside:words |
61 | 1 | Robert Bossy | </pre> |
62 | 1 | Robert Bossy | |
63 | 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_. |
64 | 1 | Robert Bossy | |
65 | 1 | Robert Bossy | h3. All verbs [section] |
66 | 1 | Robert Bossy | |
67 | 1 | Robert Bossy | <pre> |
68 | 1 | Robert Bossy | layer:words(pos ^= "V") |
69 | 1 | Robert Bossy | </pre> |
70 | 1 | Robert Bossy | |
71 | 1 | Robert Bossy | or |
72 | 1 | Robert Bossy | |
73 | 1 | Robert Bossy | <pre> |
74 | 1 | Robert Bossy | layer:words(pos =~ "^V") |
75 | 1 | Robert Bossy | </pre> |
76 | 1 | Robert Bossy | |
77 | 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. |
78 | 1 | Robert Bossy | |
79 | 1 | Robert Bossy | h3. All syntactic dependencies [section] |
80 | 1 | Robert Bossy | |
81 | 1 | Robert Bossy | <pre> |
82 | 1 | Robert Bossy | relations:dependencies.tuples |
83 | 1 | Robert Bossy | </pre> |
84 | 1 | Robert Bossy | |
85 | 1 | Robert Bossy | This assumes syntactic dependencies are in a relation named _dependencies_. |
86 | 1 | Robert Bossy | |
87 | 1 | Robert Bossy | h3. Words that are subject [section] |
88 | 1 | Robert Bossy | |
89 | 1 | Robert Bossy | <pre> |
90 | 1 | Robert Bossy | relations:dependencies.tuples(label == "SUBJ:V-N").args:dependent |
91 | 1 | Robert Bossy | </pre> |
92 | 1 | Robert Bossy | |
93 | 1 | Robert Bossy | If you insist to check they are subjet to verbs: |
94 | 1 | Robert Bossy | |
95 | 1 | Robert Bossy | <pre> |
96 | 1 | Robert Bossy | relations:dependencies.tuples(label == "SUBJ:V-N" and args:head.pos ^= "V").args:dependent |
97 | 1 | Robert Bossy | </pre> |
98 | 1 | Robert Bossy | |
99 | 1 | Robert Bossy | h3. Subject of a verb [annotation] |
100 | 1 | Robert Bossy | |
101 | 1 | Robert Bossy | <pre> |
102 | 1 | Robert Bossy | tuple:dependencies:head(label == "SUBJ:V-N").args:dependent |
103 | 1 | Robert Bossy | </pre> |