-
Notifications
You must be signed in to change notification settings - Fork 0
/
relation.rb
283 lines (258 loc) · 5 KB
/
relation.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
class Relation < Node
def is? x
return x.to_s == to_s
end
def is x
return x.to_s == to_s
end
# def self.method_missing method,*args
# return Relation.find_by_name method
# end
def self.get relation
return Relation.find_by_name(relation)
end
@@Category=Relation.find_by_id 43
def self.Category
@@Category
end
@@SubContext=Relation.find_by_id 44
def self.SubContext
@@SubContext
end
@@SuperContext=Relation.find_by_id 45
def self.SuperContext
@@SuperContext
end
@@Synonym=Relation.find_by_id 32
def self.Synonym
@@Synonym
end
#rake db:fixtures:load
# ALSO_SEE :
# id: 0x0
# name: "ALSO_SEE"
## ^
#
@@Antonym=Relation.find_by_id 1
def self.Antonym
@@Antonym
end
# ANTONYM :
# id: 0x1
# context_id: 103
# context_id: 103
# name: "ANTONYM"
### !
#
# ATTRIBUTE :
# id: 0x2
# context_id: 103
# name: "ATTRIBUTE"
### =
#
# CAUSE:
# id: 0x3
# context_id: 103
# name: "CAUSE"
### >
#
#
# DERIVATIONALLY_RELATED_FORM :
# id: 0x5
# context_id: 103
# name: "DERIVATIONALLY_RELATED_FORM"
### +
## zero (noun.) => to zero (v.) ++
#
@@Derived=Relation.find_by_id 4
def self.Derived
@@Derived
end
# DERIVED_FROM_ADJECTIVE :
# id: 0x4
# context_id: 103
# name: "DERIVED_FROM_ADJECTIVE"
# # \
## zero (adj.) => to zero (v.) ++
#
#
# DOMAIN_OF_SYNSET_CATEGORY :
# id: 0x6
# name: "DOMAIN_OF_SYNSET_CATEGORY"
### ;c
## sheet @ maths !!
#
# DOMAIN_OF_SYNSET_REGION :
# id: 0x7
# name: "DOMAIN_OF_SYNSET_REGION"
### ;r
## mate @ australia billion@US --
#
# DOMAIN_OF_SYNSET_USAGE :
# id: 0x8
# context_id: 103
# name: "DOMAIN_OF_SYNSET_USAGE"
### ;u
##bitch @ colloquialism || fin de siecle @ French # fuck(vulgar)
#
# ENTAILMENT :
# id: 0x9
# context_id: 103
# name: "ENTAILMENT"
### *
## jump implies come down to anger s.o. => s.o. sees red
#
@@Hypernym=Relation.find_by_id 10
def self.Hypernym
@@Hypernym
# Relation.find_by_id 10
# Relation.find_by_name "HYPERNYM"
end
# HYPERNYM :
# id: 0xa #10
# context_id: 103
# name: "HYPERNYM"
### @
@@Hyponym=Relation.find_by_id 11
def self.Hyponym
@@Hyponym
# Relation.find_by_id 11
# Relation.find_by_name "HYPONYM"
end
# HYPONYM :
# id: 0xb #11
# context_id: 103
# name: "HYPONYM"
#
# MEMBER_HOLONYM:
# id: 0xc #12
# context_id: 103
# name: "MEMBER_HOLONYM"
### #m
#
@@Holonym=Relation.find_by_id(12)
def self.Holonym
@@Holonym
end
def self.Owner
@@Holonym
end
#TODO: cache
@@Meronym=Relation.find_by_id(13)
def self.Member
@@Meronym
end
def self.Meronym
@@Meronym
# Relation.find_by_id 13
end
@@PartMeronym= Relation.find_by_id 18
def self.Part
@@PartMeronym
# Relation.find_by_id 18
end
@@SubstanceMeronym= Relation.find_by_id 23
def self.Substance
@@SubstanceMeronym
# Relation.find_by_id 23
end
# MEMBER_MERONYM:
# id: 0xd #13
# context_id: 103
# name: "MEMBER_MERONYM"
### %m
#
# MEMBER_OF_THIS_DOMAIN_CATEGORY :
# id: 0xe #14
# context_id: 103
# name: "MEMBER_OF_THIS_DOMAIN_CATEGORY"
### -c
## Old Testament : Simon in(of the) Ethiopia: Rastafarian aviation: to overfly
## name: chandelle
#
# MEMBER_OF_THIS_DOMAIN_REGION :
# id: 0xf #15
# context_id: 103
# name: "MEMBER_OF_THIS_DOMAIN_REGION"
### -r IN Japan : Sushi ! France : Marne?naja
#
# MEMBER_OF_THIS_DOMAIN_USAGE :
# id: 0x10 #16
# context_id: 103
# name: "MEMBER_OF_THIS_DOMAIN_USAGE"
## # -u
#
# PART_HOLONYM:
# id: 0x11
# context_id: 103
# name: "PART_HOLONYM"
## # #p
#
# PART_MERONYM:
# id: 0x12
# context_id: 103
# name: "PART_MERONYM"
## # %p
#
# PARTICIPLE_OF_VERB :
# id: 0x13
# context_id: 103
# name: "PARTICIPLE_OF_VERB"
## # <
#
# PERTAINYM :
# id: 0x14
# context_id: 103
# name: "PERTAINYM"
## # \
## cellular(a) \ cell(n) equally(adv)-equal(adj)
#
# SIMILAR_TO :
# id: 0x15
# context_id: 103
# name: "SIMILAR_TO"
## # &
# #?
#
# SUBSTANCE_HOLONYM :
# id: 0x16
# context_id: 103
# name: "SUBSTANCE_HOLONYM"
## # #s
# # Lithium IS-CONTAINED-BY batteries
#
# SUBSTANCE_MERONYM :
# id: 0x17
# context_id: 103
# name: "SUBSTANCE_MERONYM"
# ##CONTAINS # %s
# # asperin CONTAINS salicylic acid
#
# VERB_GROUP :
# id: 0x18
# context_id: 103
# name: "VERB_GROUP"
## # $
#
# RELATIONSHIP_COUNT:
# id: 0x19
# context_id: 103
# name: "RELATIONSHIP_COUNT"
##
def relation_path
puts "TEST"
end
def Antonym
return Relation.Hyponym if self==Relation.Hypernym
return Relation.Hypernym if self==Relation.Hyponym
return Relation.Synonym if self==Relation.Synonym
return Relation.Antonym if self==Relation.Antonym
# return Relation.Attribute if self==Relation.Owner?
return Relation.Derived if self==Relation.Derived
return Relation.SubContext if self==Relation.SuperContext
return Relation.SuperContext if self==Relation.SubContext
end
def anti
return self.Antonym()
end
end