activefacts-cql 1.9.6 → 1.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +19 -0
- data/activefacts-cql.gemspec +5 -3
- data/lib/activefacts/cql/parser.rb +4 -0
- data/lib/activefacts/cql/version.rb +1 -1
- metadata +19 -21
- data/lib/activefacts/cql/Rakefile +0 -14
- data/lib/activefacts/cql/parser/CQLParser.treetop +0 -258
- data/lib/activefacts/cql/parser/Context.treetop +0 -46
- data/lib/activefacts/cql/parser/Expressions.treetop +0 -67
- data/lib/activefacts/cql/parser/FactTypes.treetop +0 -371
- data/lib/activefacts/cql/parser/Language/English.treetop +0 -329
- data/lib/activefacts/cql/parser/Language/French.treetop +0 -325
- data/lib/activefacts/cql/parser/Language/Mandarin.treetop +0 -305
- data/lib/activefacts/cql/parser/LexicalRules.treetop +0 -253
- data/lib/activefacts/cql/parser/ObjectTypes.treetop +0 -209
- data/lib/activefacts/cql/parser/Terms.treetop +0 -197
- data/lib/activefacts/cql/parser/TransformRules.treetop +0 -226
- data/lib/activefacts/cql/parser/ValueTypes.treetop +0 -244
@@ -1,325 +0,0 @@
|
|
1
|
-
# Encoding: UTF-8
|
2
|
-
#
|
3
|
-
# ActiveFacts CQL Parser.
|
4
|
-
# Parse rules the French syntax elements for CQL.
|
5
|
-
#
|
6
|
-
# Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
|
7
|
-
#
|
8
|
-
module ActiveFacts
|
9
|
-
module CQL
|
10
|
-
grammar French
|
11
|
-
|
12
|
-
# >>>>>>>>>>>>>>>>>>>> Object Types <<<<<<<<<<<<<<<<<<<<
|
13
|
-
# The pattern to introduce a Value Type
|
14
|
-
rule written_as
|
15
|
-
s est s 'écrit' S 'en' s
|
16
|
-
end
|
17
|
-
|
18
|
-
rule auto_assignment
|
19
|
-
'auto-assigné' S to time:('assertion' / 'validation') !alphanumeric s
|
20
|
-
{
|
21
|
-
def auto_assigned_at
|
22
|
-
time.text_value == 'assertion' ? 'assert' : 'commit'
|
23
|
-
end
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
# The pattern to introduce an Entity Type
|
28
|
-
rule identified_by
|
29
|
-
'identifié' s 'par' s
|
30
|
-
end
|
31
|
-
|
32
|
-
rule basetype_expression
|
33
|
-
is s i:( independent s )? identification
|
34
|
-
end
|
35
|
-
|
36
|
-
# The pattern to introduce an Entity Subtype
|
37
|
-
rule subtype_prefix
|
38
|
-
est s un s ('type'/'genre') s 'de' S
|
39
|
-
end
|
40
|
-
|
41
|
-
rule subtype_expression
|
42
|
-
subtype_prefix i:( independent s )? supertype_list ident:identification?
|
43
|
-
end
|
44
|
-
|
45
|
-
# The pattern to introduce an objectified fact type with implicit identification
|
46
|
-
rule is_where
|
47
|
-
existe s i:(independent s)? si
|
48
|
-
{ def independent; !i.empty?; end }
|
49
|
-
end
|
50
|
-
|
51
|
-
rule in_which # Introduce an objectification step
|
52
|
-
where / # Old syntax
|
53
|
-
dans s laquel # preferred syntax
|
54
|
-
end
|
55
|
-
|
56
|
-
# Units conversion keyword
|
57
|
-
rule conversion
|
58
|
-
converts s a:(approximately s)? to s
|
59
|
-
{
|
60
|
-
def approximate?
|
61
|
-
!a.empty?
|
62
|
-
end
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
# >>>>>>>>>>>>>>>>>>>> Constraints <<<<<<<<<<<<<<<<<<<<
|
67
|
-
# External presence constraint syntax:
|
68
|
-
rule each_occurs_in_clauses
|
69
|
-
s chaque s ('combinaison' S)? role_list s existe s quantifier 'fois' S
|
70
|
-
'parmis' S ce S 'qui' S 'suit' s ':' s
|
71
|
-
clauses_list s c:context_note? ';'
|
72
|
-
{
|
73
|
-
def role_list_ast
|
74
|
-
role_list.ast
|
75
|
-
end
|
76
|
-
def quantifier_ast
|
77
|
-
quantifier.ast
|
78
|
-
end
|
79
|
-
def clauses_ast
|
80
|
-
clauses_list.ast
|
81
|
-
end
|
82
|
-
}
|
83
|
-
end
|
84
|
-
|
85
|
-
rule either_or
|
86
|
-
s soit s r1:clauses s 'ou' S r2:clauses
|
87
|
-
s c:context_note? enforcement ';'
|
88
|
-
{
|
89
|
-
def role_list_ast
|
90
|
-
nil
|
91
|
-
end
|
92
|
-
def quantifier_ast
|
93
|
-
Compiler::Quantifier.new(1, nil)
|
94
|
-
end
|
95
|
-
def clauses_ast
|
96
|
-
[r1.ast, r2.ast]
|
97
|
-
end
|
98
|
-
}
|
99
|
-
end
|
100
|
-
|
101
|
-
# Used for exclusion (at most one) and mandatory exclusion (exactly one)
|
102
|
-
rule for_each_how_many
|
103
|
-
'pour' S 'chaque' S role_list s
|
104
|
-
quantifier s 'des' S 'suivants' S 's\'applique' s ':' s
|
105
|
-
clauses_list s c:context_note? ';'
|
106
|
-
{
|
107
|
-
def role_list_ast
|
108
|
-
role_list.ast
|
109
|
-
end
|
110
|
-
def quantifier_ast
|
111
|
-
quantifier.ast
|
112
|
-
end
|
113
|
-
def clauses_ast
|
114
|
-
clauses_list.ast
|
115
|
-
end
|
116
|
-
}
|
117
|
-
end
|
118
|
-
|
119
|
-
rule either_or_not_both
|
120
|
-
s soit s r1:clauses s 'ou' S r2:clauses 'mais' S 'pas' S 'les' S 'deux'
|
121
|
-
s c:context_note? enforcement ';'
|
122
|
-
{
|
123
|
-
def role_list_ast
|
124
|
-
nil
|
125
|
-
end
|
126
|
-
def quantifier_ast
|
127
|
-
Compiler::Quantifier.new(1, 1)
|
128
|
-
end
|
129
|
-
def clauses_ast
|
130
|
-
[r1.ast, r2.ast]
|
131
|
-
end
|
132
|
-
}
|
133
|
-
end
|
134
|
-
|
135
|
-
rule a_only_if_b
|
136
|
-
s clauses s only_if r2:clauses s c:context_note? enforcement ';'
|
137
|
-
end
|
138
|
-
|
139
|
-
rule only_if
|
140
|
-
que s si s
|
141
|
-
end
|
142
|
-
|
143
|
-
rule if_b_then_a
|
144
|
-
s 'si' S clauses s 'puis' S r2:clauses s c:context_note? enforcement ';'
|
145
|
-
end
|
146
|
-
|
147
|
-
rule if_and_only_if
|
148
|
-
s clauses s tail:( 'si' S 'et' S ('seulement'/'uniquement'/'que') S 'si' S clauses s)+
|
149
|
-
c:context_note? enforcement ';'
|
150
|
-
end
|
151
|
-
|
152
|
-
# During the prescan we need to know where terms in a role list finish.
|
153
|
-
# This rule matches any non-term expressions that may follow a role list.
|
154
|
-
rule role_list_constraint_followers
|
155
|
-
existe
|
156
|
-
end
|
157
|
-
|
158
|
-
# >>>>>>>>>>>>>>>>>>>> Quantifiers <<<<<<<<<<<<<<<<<<<<
|
159
|
-
rule quantifier
|
160
|
-
(
|
161
|
-
( chaque s # "each"
|
162
|
-
{ def value; [1, nil]; end }
|
163
|
-
/ un s 'certain' 'e'? ) s # "some"
|
164
|
-
{ def value; nil; end }
|
165
|
-
/ ce s # "that"
|
166
|
-
{ def value; nil; end }
|
167
|
-
/ un s # "one"; masculine or feminine
|
168
|
-
{ def value; [1, 1]; end }
|
169
|
-
/ 'pas' s 'de' s # REVISIT: Example: "Personne n'a pas de Casier-judiciaire"
|
170
|
-
{ def value; [0, 0]; end }
|
171
|
-
/ exactement s quantity
|
172
|
-
{ def value; q = quantity.value; [q, q]; end }
|
173
|
-
/ au s moins s quantity most:( et s au s plus q:quantity )? # At least (or at most)
|
174
|
-
{ def value; [ quantity.value, most.empty? ? nil : most.q.value ]; end }
|
175
|
-
/ au s plus s quantity # At most
|
176
|
-
{ def value; [ nil, quantity.value ]; end }
|
177
|
-
/ entre s numeric_range s # within numeric_range
|
178
|
-
{ def value; numeric_range.value; end }
|
179
|
-
/ soit s tous s soit s aucun # either all or none
|
180
|
-
{ def value; [ -1, 1 ]; end }
|
181
|
-
)
|
182
|
-
{
|
183
|
-
def ast
|
184
|
-
v = value
|
185
|
-
Compiler::Quantifier.new(v[0], v[1])
|
186
|
-
end
|
187
|
-
}
|
188
|
-
end
|
189
|
-
|
190
|
-
rule quantity
|
191
|
-
un s { def value; 1; end }
|
192
|
-
/ number s { def value; number.value; end }
|
193
|
-
end
|
194
|
-
|
195
|
-
# >>>>>>>>>>>>>>>>>>>> Context Notes <<<<<<<<<<<<<<<<<<<<
|
196
|
-
rule as_agreed_by
|
197
|
-
s 'comme' S 'convenu' S d:('le' s date s)? 'par' S agents
|
198
|
-
{ def value; [ d.empty? ? nil : d.date.value, agents.value ]; end }
|
199
|
-
end
|
200
|
-
|
201
|
-
rule date
|
202
|
-
s d:(!(by/')') .)+
|
203
|
-
{ def value; d.text_value.strip; end }
|
204
|
-
end
|
205
|
-
|
206
|
-
rule agents
|
207
|
-
s h:agent s t:(',' s !context_type agent s)*
|
208
|
-
{
|
209
|
-
def value; [h.text_value] + t.elements.map{|e| e.agent.text_value }; end
|
210
|
-
def node_type; :linking; end
|
211
|
-
}
|
212
|
-
end
|
213
|
-
|
214
|
-
rule agent
|
215
|
-
id (s id)*
|
216
|
-
end
|
217
|
-
|
218
|
-
rule negative_prefix
|
219
|
-
s 'ce' S "n'est" s 'pas' s 'le' s 'cas' s 'que'
|
220
|
-
end
|
221
|
-
|
222
|
-
rule agg_of de end
|
223
|
-
rule agg_in dans end
|
224
|
-
rule restricted_to 'limité' s 'à' !alphanumeric s end
|
225
|
-
rule any un !alphanumeric end
|
226
|
-
|
227
|
-
# >>>>>>>>>>>>>>>>>>>> Internal vocabulary <<<<<<<<<<<<<<<<<<<<
|
228
|
-
rule all 'tous' !alphanumeric end
|
229
|
-
rule at 'a' !alphanumeric end
|
230
|
-
rule both 'les deux' !alphanumeric end
|
231
|
-
rule ce ('cette'/'cet'/'ce') !alphanumeric end # ce is masculine, cette feminine, cet is ce before a noun
|
232
|
-
rule chaque 'chaque' !alphanumeric end
|
233
|
-
rule converts 'convertit' !alphanumeric end
|
234
|
-
rule de 'de' !alphanumeric end
|
235
|
-
rule dans 'dans' !alphanumeric end
|
236
|
-
rule laquel 'laquel' 'le'? !alphanumeric end
|
237
|
-
rule descending 'descendant' !alphanumeric end
|
238
|
-
rule each chaque end
|
239
|
-
rule either 'soit' !alphanumeric end
|
240
|
-
rule entity 'entité' !alphanumeric end
|
241
|
-
rule est 'est' !alphanumeric end
|
242
|
-
rule exactement 'exactement' !alphanumeric end
|
243
|
-
rule existe 'existe' !alphanumeric end
|
244
|
-
rule from 'à partir de' !alphanumeric end # REVISIT: google translate
|
245
|
-
rule includes 'comprend' !alphanumeric end
|
246
|
-
rule matches 'matches' !alphanumeric end
|
247
|
-
rule moins 'moins' !alphanumeric end
|
248
|
-
rule none 'aucun' !alphanumeric end
|
249
|
-
rule not 'not' !alphanumeric end # REVISIT: Used in constraints
|
250
|
-
rule plus 'plus' !alphanumeric end
|
251
|
-
rule some 'quelques' !alphanumeric end
|
252
|
-
rule un 'un' 'e'? !alphanumeric end # un is masculine, une is feminine
|
253
|
-
rule que 'que' !alphanumeric end
|
254
|
-
|
255
|
-
# >>>>>>>>>>>>>>>>>>>> External vocabulary <<<<<<<<<<<<<<<<<<<<
|
256
|
-
rule according_to 'selon' !alphanumeric end
|
257
|
-
rule acyclic 'acyclique' !alphanumeric end
|
258
|
-
rule alias 'alias' !alphanumeric end
|
259
|
-
rule accepts 'accepte' !alphanumeric end
|
260
|
-
rule and 'et' !alphanumeric end
|
261
|
-
rule antisymmetric 'antisymmetric' !alphanumeric end
|
262
|
-
rule approximately 'environ' !alphanumeric end # REVISIT: google translate
|
263
|
-
rule as 'comme' !alphanumeric end
|
264
|
-
rule as_opposed_to 'au' S 'lieu' S 'de' !alphanumeric end
|
265
|
-
rule asymmetric 'asymétrique' !alphanumeric end
|
266
|
-
rule au 'au' !alphanumeric end
|
267
|
-
rule because ('parce' s 'que' / 'car') !alphanumeric end
|
268
|
-
rule but 'mais' !alphanumeric end
|
269
|
-
rule by 'par' !alphanumeric end
|
270
|
-
rule definitely 'définitivement' !alphanumeric end
|
271
|
-
rule entre 'entre' !alphanumeric end
|
272
|
-
rule ephemera 'éphémère' !alphanumeric end
|
273
|
-
rule existe 'existe' !alphanumeric end
|
274
|
-
rule false 'faux' !alphanumeric end
|
275
|
-
rule feminine 'féminin' !alphanumeric end
|
276
|
-
rule identified ('identifié') !alphanumeric end
|
277
|
-
rule if 'si' !alphanumeric end
|
278
|
-
rule import 'import' !alphanumeric end # REVISIT: translation?
|
279
|
-
rule independent 'indépendant' !alphanumeric end
|
280
|
-
rule stronglyintransitive 'stronglyintransitif' !alphanumeric end
|
281
|
-
rule intransitive 'intransitif' !alphanumeric end
|
282
|
-
rule irreflexive 'irréflexive' !alphanumeric end
|
283
|
-
rule is est end # Called from ObjectTypes.treetop in "is identified by"
|
284
|
-
rule its ('sa' / 'son') !alphanumeric end
|
285
|
-
rule masculine 'masculin' !alphanumeric end
|
286
|
-
rule max 'max' !alphanumeric end
|
287
|
-
rule maybe 'peut-être' !alphanumeric end # REVISIT: eventuellement = possibly?
|
288
|
-
rule min 'min' !alphanumeric end
|
289
|
-
rule only 'que' !alphanumeric end # REVISIT: Used in constraints
|
290
|
-
rule or 'ou' !alphanumeric end
|
291
|
-
rule ordering_prefix by s (ascending/descending)? s end
|
292
|
-
rule otherwise 'sinon' !alphanumeric end
|
293
|
-
rule partitioned 'partitionné' !alphanumeric end
|
294
|
-
rule personal 'personelle' !alphanumeric end
|
295
|
-
rule radix_point ',' end
|
296
|
-
rule reflexive 'réflexive' !alphanumeric end
|
297
|
-
rule restricted 'limité' !alphanumeric s end
|
298
|
-
rule restricts 'limit' [ée] !alphanumeric s end
|
299
|
-
rule returning 'retour' !alphanumeric end
|
300
|
-
rule separate 'distincte' !alphanumeric end
|
301
|
-
rule schema 'schema' !alphanumeric end
|
302
|
-
rule si 'si' !alphanumeric end
|
303
|
-
rule so_that 'pour' s 'que' !alphanumeric end
|
304
|
-
rule soit 'soit' !alphanumeric end
|
305
|
-
rule static 'statique' !alphanumeric end
|
306
|
-
rule symmetric 'symétrique' !alphanumeric end
|
307
|
-
rule that que end
|
308
|
-
rule then 'puis' !alphanumeric end
|
309
|
-
rule to 'à' !alphanumeric end
|
310
|
-
rule to_avoid ('pour' s 'empecher' s 'de' / 'pour' s 'ne' s 'pas') !alphanumeric end
|
311
|
-
rule topic 'sujet' !alphanumeric end
|
312
|
-
rule transform 'transform' !alphanumeric end
|
313
|
-
rule transient 'transitoires' !alphanumeric end
|
314
|
-
rule transitive 'transitif' !alphanumeric end
|
315
|
-
rule true 'vrai' !alphanumeric end
|
316
|
-
rule version 'version' !alphanumeric end
|
317
|
-
rule vocabulary 'vocabulaire' !alphanumeric end
|
318
|
-
rule where 'où' !alphanumeric end
|
319
|
-
rule who 'qui' !alphanumeric end
|
320
|
-
rule with 'avec' !alphanumeric end
|
321
|
-
|
322
|
-
end
|
323
|
-
end
|
324
|
-
end
|
325
|
-
# vi:encoding=utf-8
|
@@ -1,305 +0,0 @@
|
|
1
|
-
# Encoding: UTF-8
|
2
|
-
#
|
3
|
-
# ActiveFacts CQL Parser for Mandarin
|
4
|
-
#
|
5
|
-
# Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
|
6
|
-
#
|
7
|
-
module ActiveFacts
|
8
|
-
module CQL
|
9
|
-
grammar Mandarin
|
10
|
-
|
11
|
-
# >>>>>>>>>>>>>>>>>>>> Object Types <<<<<<<<<<<<<<<<<<<<
|
12
|
-
# The pattern to introduce a Value Type
|
13
|
-
rule written_as
|
14
|
-
s est s 'écrit' S 'en' s
|
15
|
-
end
|
16
|
-
|
17
|
-
# The pattern to introduce an Entity Type
|
18
|
-
rule identified_by
|
19
|
-
'identifié' s 'par' s
|
20
|
-
end
|
21
|
-
|
22
|
-
rule basetype_expression
|
23
|
-
is s i:( independent s )? identification
|
24
|
-
end
|
25
|
-
|
26
|
-
# The pattern to introduce an Entity Subtype
|
27
|
-
rule subtype_prefix
|
28
|
-
est s un s ('type'/'genre') s 'de' S
|
29
|
-
end
|
30
|
-
|
31
|
-
rule subtype_expression
|
32
|
-
subtype_prefix i:( independent s )? supertype_list ident:identification?
|
33
|
-
end
|
34
|
-
|
35
|
-
# The pattern to introduce an objectified fact type with implicit identification
|
36
|
-
rule is_where
|
37
|
-
existe s i:(independent s)? si
|
38
|
-
{ def independent; !i.empty?; end }
|
39
|
-
end
|
40
|
-
|
41
|
-
rule in_which # Introduce an objectification step
|
42
|
-
where / # Old syntax
|
43
|
-
dans s laquel # preferred syntax
|
44
|
-
end
|
45
|
-
|
46
|
-
# Units conversion keyword
|
47
|
-
rule conversion
|
48
|
-
converts s a:(approximately s)? to s
|
49
|
-
{
|
50
|
-
def approximate?
|
51
|
-
!a.empty?
|
52
|
-
end
|
53
|
-
}
|
54
|
-
end
|
55
|
-
|
56
|
-
# >>>>>>>>>>>>>>>>>>>> Constraints <<<<<<<<<<<<<<<<<<<<
|
57
|
-
# External presence constraint syntax:
|
58
|
-
rule each_occurs_in_clauses
|
59
|
-
s chaque s ('combinaison' S)? role_list s existe s quantifier 'fois' S
|
60
|
-
'parmis' S ce S 'qui' S 'suit' s ':' s
|
61
|
-
clauses_list s c:context_note? ';'
|
62
|
-
{
|
63
|
-
def role_list_ast
|
64
|
-
role_list.ast
|
65
|
-
end
|
66
|
-
def quantifier_ast
|
67
|
-
quantifier.ast
|
68
|
-
end
|
69
|
-
def clauses_ast
|
70
|
-
clauses_list.ast
|
71
|
-
end
|
72
|
-
}
|
73
|
-
end
|
74
|
-
|
75
|
-
rule either_or
|
76
|
-
s soit s r1:clauses s 'ou' S r2:clauses
|
77
|
-
s c:context_note? enforcement ';'
|
78
|
-
{
|
79
|
-
def role_list_ast
|
80
|
-
nil
|
81
|
-
end
|
82
|
-
def quantifier_ast
|
83
|
-
Compiler::Quantifier.new(1, nil)
|
84
|
-
end
|
85
|
-
def clauses_ast
|
86
|
-
[r1.ast, r2.ast]
|
87
|
-
end
|
88
|
-
}
|
89
|
-
end
|
90
|
-
|
91
|
-
# Used for exclusion (at most one) and mandatory exclusion (exactly one)
|
92
|
-
rule for_each_how_many
|
93
|
-
'pour' S 'chaque' S role_list s
|
94
|
-
quantifier s 'des' S 'suivants' S 's\'applique' s ':' s
|
95
|
-
clauses_list s c:context_note? ';'
|
96
|
-
{
|
97
|
-
def role_list_ast
|
98
|
-
role_list.ast
|
99
|
-
end
|
100
|
-
def quantifier_ast
|
101
|
-
quantifier.ast
|
102
|
-
end
|
103
|
-
def clauses_ast
|
104
|
-
clauses_list.ast
|
105
|
-
end
|
106
|
-
}
|
107
|
-
end
|
108
|
-
|
109
|
-
rule either_or_not_both
|
110
|
-
s soit s r1:clauses s 'ou' S r2:clauses 'mais' S 'pas' S 'les' S 'deux'
|
111
|
-
s c:context_note? enforcement ';'
|
112
|
-
{
|
113
|
-
def role_list_ast
|
114
|
-
nil
|
115
|
-
end
|
116
|
-
def quantifier_ast
|
117
|
-
Compiler::Quantifier.new(1, 1)
|
118
|
-
end
|
119
|
-
def clauses_ast
|
120
|
-
[r1.ast, r2.ast]
|
121
|
-
end
|
122
|
-
}
|
123
|
-
end
|
124
|
-
|
125
|
-
rule a_only_if_b
|
126
|
-
s clauses s only_if r2:clauses s c:context_note? enforcement ';'
|
127
|
-
end
|
128
|
-
|
129
|
-
rule only_if
|
130
|
-
que s si s
|
131
|
-
end
|
132
|
-
|
133
|
-
rule if_b_then_a
|
134
|
-
s 'si' S clauses s 'puis' S r2:clauses s c:context_note? enforcement ';'
|
135
|
-
end
|
136
|
-
|
137
|
-
rule if_and_only_if
|
138
|
-
s clauses s tail:( 'si' S 'et' S ('seulement'/'uniquement'/'que') S 'si' S clauses s)+
|
139
|
-
c:context_note? enforcement ';'
|
140
|
-
end
|
141
|
-
|
142
|
-
# During the prescan we need to know where terms in a role list finish.
|
143
|
-
# This rule matches any non-term expressions that may follow a role list.
|
144
|
-
rule role_list_constraint_followers
|
145
|
-
existe
|
146
|
-
end
|
147
|
-
|
148
|
-
# >>>>>>>>>>>>>>>>>>>> Quantifiers <<<<<<<<<<<<<<<<<<<<
|
149
|
-
rule quantifier
|
150
|
-
(
|
151
|
-
( chaque s # "each"
|
152
|
-
{ def value; [1, nil]; end }
|
153
|
-
/ un s 'certain' 'e'? ) s # "some"
|
154
|
-
{ def value; nil; end }
|
155
|
-
/ ce s # "that"
|
156
|
-
{ def value; nil; end }
|
157
|
-
/ un s # "one"; masculine or feminine
|
158
|
-
{ def value; [1, 1]; end }
|
159
|
-
/ 'pas' s 'de' s # REVISIT: Example: "Personne n'a pas de Casier-judiciaire"
|
160
|
-
{ def value; [0, 0]; end }
|
161
|
-
/ exactement s quantity
|
162
|
-
{ def value; q = quantity.value; [q, q]; end }
|
163
|
-
/ au s moins s quantity most:( et s au s plus q:quantity )? # At least (or at most)
|
164
|
-
{ def value; [ quantity.value, most.empty? ? nil : most.q.value ]; end }
|
165
|
-
/ au s plus s quantity # At most
|
166
|
-
{ def value; [ nil, quantity.value ]; end }
|
167
|
-
/ entre s numeric_range s # within numeric_range
|
168
|
-
{ def value; numeric_range.value; end }
|
169
|
-
/ soit s tous s soit s aucun # either all or none
|
170
|
-
{ def value; [ -1, 1 ]; end }
|
171
|
-
)
|
172
|
-
{
|
173
|
-
def ast
|
174
|
-
v = value
|
175
|
-
Compiler::Quantifier.new(v[0], v[1])
|
176
|
-
end
|
177
|
-
}
|
178
|
-
end
|
179
|
-
|
180
|
-
rule quantity
|
181
|
-
un s { def value; 1; end }
|
182
|
-
/ number s { def value; number.value; end }
|
183
|
-
end
|
184
|
-
|
185
|
-
# >>>>>>>>>>>>>>>>>>>> Context Notes <<<<<<<<<<<<<<<<<<<<
|
186
|
-
rule as_agreed_by
|
187
|
-
s 'comme' S 'convenu' S d:('le' s date s)? 'par' S agents
|
188
|
-
{ def value; [ d.empty? ? nil : d.date.value, agents.value ]; end }
|
189
|
-
end
|
190
|
-
|
191
|
-
rule date
|
192
|
-
s d:(!(by/')') .)+
|
193
|
-
{ def value; d.text_value.strip; end }
|
194
|
-
end
|
195
|
-
|
196
|
-
rule agents
|
197
|
-
s h:agent s t:(',' s !context_type agent s)*
|
198
|
-
{
|
199
|
-
def value; [h.text_value] + t.elements.map{|e| e.agent.text_value }; end
|
200
|
-
def node_type; :linking; end
|
201
|
-
}
|
202
|
-
end
|
203
|
-
|
204
|
-
rule agent
|
205
|
-
id (s id)*
|
206
|
-
end
|
207
|
-
|
208
|
-
rule negative_prefix
|
209
|
-
s 'ce' S "n'est" s 'pas' s 'le' s 'cas' s 'que'
|
210
|
-
end
|
211
|
-
|
212
|
-
rule agg_of de end
|
213
|
-
rule agg_in dans end
|
214
|
-
rule restricted_to 'limité' s 'à' !alphanumeric s end
|
215
|
-
rule any un !alphanumeric end
|
216
|
-
|
217
|
-
# >>>>>>>>>>>>>>>>>>>> Internal vocabulary <<<<<<<<<<<<<<<<<<<<
|
218
|
-
rule all 'tous' !alphanumeric end
|
219
|
-
rule at 'a' !alphanumeric end
|
220
|
-
rule both 'les deux' !alphanumeric end
|
221
|
-
rule ce ('cette'/'cet'/'ce') !alphanumeric end # ce is masculine, cette feminine, cet is ce before a noun
|
222
|
-
rule chaque 'chaque' !alphanumeric end
|
223
|
-
rule converts 'convertit' !alphanumeric end
|
224
|
-
rule de 'de' !alphanumeric end
|
225
|
-
rule dans 'dans' !alphanumeric end
|
226
|
-
rule laquel 'laquel' 'le'? !alphanumeric end
|
227
|
-
rule descending 'descendant' !alphanumeric end
|
228
|
-
rule each chaque end
|
229
|
-
rule either 'soit' !alphanumeric end
|
230
|
-
rule entity 'entité' !alphanumeric end
|
231
|
-
rule est 'est' !alphanumeric end
|
232
|
-
rule exactement 'exactement' !alphanumeric end
|
233
|
-
rule existe 'existe' !alphanumeric end
|
234
|
-
rule from 'à partir de' !alphanumeric end # REVISIT: google translate
|
235
|
-
rule includes 'comprend' !alphanumeric end
|
236
|
-
rule matches 'matches' !alphanumeric end
|
237
|
-
rule moins 'moins' !alphanumeric end
|
238
|
-
rule none 'aucun' !alphanumeric end
|
239
|
-
rule not 'not' !alphanumeric end # REVISIT: Used in constraints
|
240
|
-
rule plus 'plus' !alphanumeric end
|
241
|
-
rule some 'quelques' !alphanumeric end
|
242
|
-
rule un 'un' 'e'? !alphanumeric end # un is masculine, une is feminine
|
243
|
-
rule que 'que' !alphanumeric end
|
244
|
-
|
245
|
-
# >>>>>>>>>>>>>>>>>>>> External vocabulary <<<<<<<<<<<<<<<<<<<<
|
246
|
-
rule according_to 'selon' !alphanumeric end
|
247
|
-
rule acyclic 'acyclique' !alphanumeric end
|
248
|
-
rule alias 'alias' !alphanumeric end
|
249
|
-
rule and 'et' !alphanumeric end
|
250
|
-
rule antisymmetric 'antisymmetric' !alphanumeric end
|
251
|
-
rule approximately 'environ' !alphanumeric end # REVISIT: google translate
|
252
|
-
rule as 'comme' !alphanumeric end
|
253
|
-
rule as_opposed_to 'au' S 'lieu' S 'de' !alphanumeric end
|
254
|
-
rule asymmetric 'asymétrique' !alphanumeric end
|
255
|
-
rule au 'au' !alphanumeric end
|
256
|
-
rule because ('parce' s 'que' / 'car') !alphanumeric end
|
257
|
-
rule but 'mais' !alphanumeric end
|
258
|
-
rule by 'par' !alphanumeric end
|
259
|
-
rule definitely 'définitivement' !alphanumeric end
|
260
|
-
rule entre 'entre' !alphanumeric end
|
261
|
-
rule ephemera 'éphémère' !alphanumeric end
|
262
|
-
rule existe 'existe' !alphanumeric end
|
263
|
-
rule false 'faux' !alphanumeric end
|
264
|
-
rule feminine 'féminin' !alphanumeric end
|
265
|
-
rule identified ('identifié') !alphanumeric end
|
266
|
-
rule if 'si' !alphanumeric end
|
267
|
-
rule import 'import' !alphanumeric end # REVISIT: translation?
|
268
|
-
rule independent 'indépendant' !alphanumeric end
|
269
|
-
rule stronglyintransitive 'stronglyintransitif' !alphanumeric end
|
270
|
-
rule intransitive 'intransitif' !alphanumeric end
|
271
|
-
rule irreflexive 'irréflexive' !alphanumeric end
|
272
|
-
rule is est end # Called from ObjectTypes.treetop in "is identified by"
|
273
|
-
rule its ('sa' / 'son') !alphanumeric end
|
274
|
-
rule masculine 'masculin' !alphanumeric end
|
275
|
-
rule maybe 'peut-être' !alphanumeric end # REVISIT: eventuellement = possibly?
|
276
|
-
rule only 'que' !alphanumeric end # REVISIT: Used in constraints
|
277
|
-
rule or 'ou' !alphanumeric end
|
278
|
-
rule ordering_prefix by s (ascending/descending)? s end
|
279
|
-
rule otherwise 'sinon' !alphanumeric end
|
280
|
-
rule partitioned 'partitionné' !alphanumeric end
|
281
|
-
rule personal 'personelle' !alphanumeric end
|
282
|
-
rule radix_point ',' end
|
283
|
-
rule reflexive 'réflexive' !alphanumeric end
|
284
|
-
rule returning 'retour' !alphanumeric end
|
285
|
-
rule separate 'distincte' !alphanumeric end
|
286
|
-
rule si 'si' !alphanumeric end
|
287
|
-
rule so_that 'pour' s 'que' !alphanumeric end
|
288
|
-
rule soit 'soit' !alphanumeric end
|
289
|
-
rule static 'statique' !alphanumeric end
|
290
|
-
rule symmetric 'symétrique' !alphanumeric end
|
291
|
-
rule that que end
|
292
|
-
rule then 'puis' !alphanumeric end
|
293
|
-
rule to 'à' !alphanumeric end
|
294
|
-
rule to_avoid ('pour' s 'empecher' s 'de' / 'pour' s 'ne' s 'pas') !alphanumeric end
|
295
|
-
rule transient 'transitoires' !alphanumeric end
|
296
|
-
rule transitive 'transitif' !alphanumeric end
|
297
|
-
rule true 'vrai' !alphanumeric end
|
298
|
-
rule version 'version' !alphanumeric end
|
299
|
-
rule vocabulary 'vocabulaire' !alphanumeric end
|
300
|
-
rule where 'où' !alphanumeric end
|
301
|
-
rule who 'qui' !alphanumeric end
|
302
|
-
|
303
|
-
end
|
304
|
-
end
|
305
|
-
end
|