cycr 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/changelog.txt +4 -0
- data/cycr.gemspec +2 -2
- data/lib/cycr/builder.rb +3 -3
- data/lib/cycr/client.rb +40 -34
- data/spec/client.rb +17 -5
- metadata +4 -19
- data/lib/cycr/constants.rb +0 -8
- data/lib/cycr/domains.lisp +0 -584
- data/lib/cycr/sexpr.flex +0 -74
data/.gitignore
CHANGED
data/changelog.txt
CHANGED
data/cycr.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cycr"
|
3
|
-
s.version = "0.0.
|
4
|
-
s.date = "
|
3
|
+
s.version = "0.0.8"
|
4
|
+
s.date = "#{Time.now.strftime("%Y-%m-%d")}"
|
5
5
|
s.summary = "Ruby client for the (Open)Cyc server"
|
6
6
|
s.email = "apohllo@o2.pl"
|
7
7
|
s.homepage = "http://github.com/apohllo/cycr"
|
data/lib/cycr/builder.rb
CHANGED
@@ -4,9 +4,9 @@ module Cyc
|
|
4
4
|
#
|
5
5
|
# This class is used to capture calls to the Cyc client, to allow
|
6
6
|
# nested calls, like
|
7
|
-
#
|
8
|
-
# cyc.with_any_mt do
|
9
|
-
# comment :Collection
|
7
|
+
#
|
8
|
+
# cyc.with_any_mt do |cyc|
|
9
|
+
# cyc.comment :Collection
|
10
10
|
# end
|
11
11
|
class Builder
|
12
12
|
def initialize
|
data/lib/cycr/client.rb
CHANGED
@@ -4,13 +4,13 @@ module Cyc
|
|
4
4
|
# Author:: Aleksander Pohl (mailto:apohllo@o2.pl)
|
5
5
|
# License:: MIT License
|
6
6
|
#
|
7
|
-
# This class is the implementation of the Cyc server client.
|
7
|
+
# This class is the implementation of the Cyc server client.
|
8
8
|
class Client
|
9
9
|
# If set to true, all communication with the server is logged
|
10
10
|
# to standard output
|
11
11
|
attr_accessor :debug
|
12
12
|
attr_reader :host, :port
|
13
|
-
# Creates new Client.
|
13
|
+
# Creates new Client.
|
14
14
|
def initialize(host="localhost",port="3601",debug=false)
|
15
15
|
@debug = debug
|
16
16
|
@host = host
|
@@ -30,7 +30,7 @@ module Cyc
|
|
30
30
|
|
31
31
|
# Returns the connection object. Ensures that the pid of current
|
32
32
|
# process is the same as the pid, the connection was initialized with.
|
33
|
-
#
|
33
|
+
#
|
34
34
|
# If the block is given, the command is guarded by assertion, that
|
35
35
|
# it will be performed, even if the connection was reset.
|
36
36
|
def connection
|
@@ -46,7 +46,7 @@ module Cyc
|
|
46
46
|
yield @conn
|
47
47
|
end
|
48
48
|
else
|
49
|
-
@conn
|
49
|
+
@conn
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -62,13 +62,20 @@ module Cyc
|
|
62
62
|
@conn = nil
|
63
63
|
end
|
64
64
|
|
65
|
-
# Sends message +msg+ directly to the Cyc server and
|
66
|
-
# the answer.
|
65
|
+
# Sends message +msg+ directly to the Cyc server and
|
66
|
+
# returns the parsed answer.
|
67
67
|
def talk(msg, options={})
|
68
68
|
send_message(msg)
|
69
69
|
receive_answer(options)
|
70
70
|
end
|
71
71
|
|
72
|
+
# Sends message +msg+ directly to the Cyc server and
|
73
|
+
# returns the raw answer (i.e. not parsed).
|
74
|
+
def raw_talk(msg, options={})
|
75
|
+
send_message(msg)
|
76
|
+
receive_raw_answer(options)
|
77
|
+
end
|
78
|
+
|
72
79
|
# Send the raw message.
|
73
80
|
def send_message(msg)
|
74
81
|
@last_message = msg
|
@@ -76,13 +83,34 @@ module Cyc
|
|
76
83
|
connection{|c| c.puts(msg)}
|
77
84
|
end
|
78
85
|
|
79
|
-
# Receive answer from server.
|
80
86
|
def receive_answer(options={})
|
87
|
+
receive_raw_answer do |answer|
|
88
|
+
begin
|
89
|
+
result = @parser.parse(answer,options[:stack])
|
90
|
+
rescue Parser::ContinueParsing => ex
|
91
|
+
result = ex.stack
|
92
|
+
current_result = result
|
93
|
+
last_message = @last_message
|
94
|
+
while current_result.size == 100 do
|
95
|
+
send_message("(subseq #{last_message} #{result.size} " +
|
96
|
+
"#{result.size + 100})")
|
97
|
+
current_result = receive_answer(options) || []
|
98
|
+
result.concat(current_result)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
return result
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Receive raw answer from server. If a +block+ is given
|
106
|
+
# the answer is yield to the block, otherwise the naswer is returned.
|
107
|
+
def receive_raw_answer(options={})
|
81
108
|
answer = connection{|c| c.waitfor(/./)}
|
82
109
|
puts "Recv: #{answer}" if @debug
|
83
110
|
if answer.nil?
|
84
111
|
raise "Unknwon error occured. " +
|
85
|
-
"Check the submitted query in detail
|
112
|
+
"Check the submitted query in detail:\n" +
|
113
|
+
@last_message
|
86
114
|
end
|
87
115
|
while not answer =~ /\n/ do
|
88
116
|
next_answer = connection{|c| c.waitfor(/./)}
|
@@ -98,19 +126,10 @@ module Cyc
|
|
98
126
|
#answer = answer.split("\n")[-1]
|
99
127
|
answer = answer.sub(/(\d\d\d) (.*)/,"\\2")
|
100
128
|
if($1.to_i == 200)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
current_result = result
|
106
|
-
last_message = @last_message
|
107
|
-
while current_result.size == 100 do
|
108
|
-
send_message("(subseq #{last_message} #{result.size} " +
|
109
|
-
"#{result.size + 100})")
|
110
|
-
current_result = receive_answer(options) || []
|
111
|
-
result.concat(current_result)
|
112
|
-
end
|
113
|
-
result
|
129
|
+
if block_given?
|
130
|
+
yield answer
|
131
|
+
else
|
132
|
+
return answer
|
114
133
|
end
|
115
134
|
else
|
116
135
|
unless $2.nil?
|
@@ -129,18 +148,5 @@ module Cyc
|
|
129
148
|
@builder.send(name,*args,&block)
|
130
149
|
talk(@builder.to_cyc)
|
131
150
|
end
|
132
|
-
|
133
|
-
protected
|
134
|
-
|
135
|
-
def relevant_mts(term)
|
136
|
-
@mts_cache[term] ||=
|
137
|
-
(mts = self.term_mts(term)
|
138
|
-
if mts
|
139
|
-
mts.select{|mt| mt.is_a? Symbol}.
|
140
|
-
reject{|mt| IRRELEVANT_MTS.include?(mt)}
|
141
|
-
else
|
142
|
-
[]
|
143
|
-
end)
|
144
|
-
end
|
145
151
|
end
|
146
152
|
end
|
data/spec/client.rb
CHANGED
@@ -2,24 +2,36 @@ $:.unshift "lib"
|
|
2
2
|
require 'cycr'
|
3
3
|
|
4
4
|
describe Cyc::Client do
|
5
|
-
before(:each) do
|
5
|
+
before(:each) do
|
6
6
|
@client = Cyc::Client.new()
|
7
7
|
# @client.debug = true
|
8
8
|
end
|
9
9
|
|
10
|
-
after(:each) do
|
10
|
+
after(:each) do
|
11
11
|
@client.close
|
12
12
|
end
|
13
13
|
|
14
|
-
it "should allow to talk to the server" do
|
14
|
+
it "should allow to talk to the server" do
|
15
15
|
@client.talk("(constant-count)").should_not == nil
|
16
16
|
end
|
17
17
|
|
18
|
-
it "should allow to talk to server by calling
|
18
|
+
it "should allow to talk to server by calling SubL methods which are not defined in the client" do
|
19
19
|
@client.constant_count.should_not == nil
|
20
20
|
end
|
21
21
|
|
22
|
-
it "should allow
|
22
|
+
it "should allow to talk to server and return raw answer" do
|
23
|
+
result = @client.raw_talk("(constant-count)")
|
24
|
+
result.should_not == nil
|
25
|
+
result.should be_a_kind_of String
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should allow to talk to server and return parsed answer" do
|
29
|
+
result = @client.talk("(genls \#\$Dog)")
|
30
|
+
result.should_not == nil
|
31
|
+
result.should respond_to :size
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should allow multiple processes to use the client" do
|
23
35
|
parent_pid = Process.pid
|
24
36
|
if fork
|
25
37
|
@client.find_constant("Cat")
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cycr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
version: 0.0.7
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.8
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Aleksander Pohl
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
13
|
+
date: 2011-04-15 00:00:00 +02:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,10 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ">="
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 2
|
31
|
-
- 9
|
32
24
|
version: 1.2.9
|
33
25
|
type: :development
|
34
26
|
version_requirements: *id001
|
@@ -51,11 +43,8 @@ files:
|
|
51
43
|
- lib/cycr/builder.rb
|
52
44
|
- lib/cycr/client.rb
|
53
45
|
- lib/cycr/collection.rb
|
54
|
-
- lib/cycr/constants.rb
|
55
|
-
- lib/cycr/domains.lisp
|
56
46
|
- lib/cycr/extensions.rb
|
57
47
|
- lib/cycr/parser.rb
|
58
|
-
- lib/cycr/sexpr.flex
|
59
48
|
- lib/cycr/sexpr.rex
|
60
49
|
- lib/cycr/sexpr.rex.rb
|
61
50
|
- spec/assertion.rb
|
@@ -75,21 +64,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
64
|
requirements:
|
76
65
|
- - ">="
|
77
66
|
- !ruby/object:Gem::Version
|
78
|
-
segments:
|
79
|
-
- 0
|
80
67
|
version: "0"
|
81
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
69
|
none: false
|
83
70
|
requirements:
|
84
71
|
- - ">="
|
85
72
|
- !ruby/object:Gem::Version
|
86
|
-
segments:
|
87
|
-
- 0
|
88
73
|
version: "0"
|
89
74
|
requirements: []
|
90
75
|
|
91
76
|
rubyforge_project:
|
92
|
-
rubygems_version: 1.
|
77
|
+
rubygems_version: 1.5.2
|
93
78
|
signing_key:
|
94
79
|
specification_version: 3
|
95
80
|
summary: Ruby client for the (Open)Cyc server
|
data/lib/cycr/constants.rb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
module Cyc
|
2
|
-
# These Microteories contain non-ontological assertions.
|
3
|
-
IRRELEVANT_MTS = [:WordNetMappingMt, :EnglishMt, :UniversalVocabularyMt,
|
4
|
-
:BaseKB, :CycHistoricalPossibilityTheoryMt, :SENSUSMappingMt,
|
5
|
-
:GeneralLexiconMt, :BookkeepingMt, :CycNounLearnerMt, :HPKBVocabMt,
|
6
|
-
:SKSIMt, :TopicMt, :SNOMEDMappingMt, :MeSHMappingMt, :CycNounLearnerMt,
|
7
|
-
:TheMotleyFoolUKCorpusMt, :AnalystDatabaseMt, :CyclistsMt ]
|
8
|
-
end
|
data/lib/cycr/domains.lisp
DELETED
@@ -1,584 +0,0 @@
|
|
1
|
-
(csetq *domains* '(
|
2
|
-
("Accts" . (
|
3
|
-
#$AccountingMt
|
4
|
-
))
|
5
|
-
("Admin" . (
|
6
|
-
#$InternationalOrganizationDataMt
|
7
|
-
#$RegionalOrganizationsInTheMiddleEastFactsheetMt
|
8
|
-
#$USGovernmentDomesticOrganizationDataMt
|
9
|
-
#$USGovernmentOrganizationDataMt
|
10
|
-
))
|
11
|
-
("Advertg" . (
|
12
|
-
#$Advertising
|
13
|
-
))
|
14
|
-
("Aerosp" . (
|
15
|
-
#$AeronauticalEngineer
|
16
|
-
#$Aeronautics
|
17
|
-
))
|
18
|
-
("Agric" . (
|
19
|
-
))
|
20
|
-
("Anat" . (
|
21
|
-
#$AnimalPhysiologyMt
|
22
|
-
#$AnimalPhysiologyVocabularyMt
|
23
|
-
#$FemaleHumanBodyStructureMt
|
24
|
-
#$HumanBodyStructureMt
|
25
|
-
#$MaleHumanBodyStructureMt
|
26
|
-
))
|
27
|
-
("Anthrop" . (
|
28
|
-
#$EthnicGroupsMt
|
29
|
-
#$EthnicGroupsVocabularyMt
|
30
|
-
#$PeopleLingoTemplateMt
|
31
|
-
#$PeopleVocabularyMt
|
32
|
-
))
|
33
|
-
("Antiq" . (
|
34
|
-
#$PeloponnesianWarMt
|
35
|
-
))
|
36
|
-
("Archeol" . (
|
37
|
-
))
|
38
|
-
("Archit" . (
|
39
|
-
#$NooescapeArchitectureMt
|
40
|
-
))
|
41
|
-
("Art" . (
|
42
|
-
#$ArtWorksDataMt
|
43
|
-
#$ArtWorksDataVocabularyMt
|
44
|
-
#$PopCultureMythologyMt
|
45
|
-
))
|
46
|
-
("Astrol" . (
|
47
|
-
))
|
48
|
-
("Astron" . (
|
49
|
-
#$EarthObservationalAstronomyMt
|
50
|
-
#$EarthObservationalAstronomyVocabularyMt
|
51
|
-
#$ObservationalAstronomyMt
|
52
|
-
#$PlanetaryBaseKBVocabularyMt
|
53
|
-
#$SimpleAstronomyDataVocabularyMt
|
54
|
-
#$SimpleAstronomyMt
|
55
|
-
#$UniverseDataMt
|
56
|
-
#$UniverseDataVocabularyMt
|
57
|
-
#$UniverseVocabularyMt
|
58
|
-
))
|
59
|
-
("Audio" . (
|
60
|
-
#$HistoryOfMusicDataMt
|
61
|
-
))
|
62
|
-
("Aut" . (
|
63
|
-
#$DriverPerspectiveMt
|
64
|
-
#$FiremenAndFireTruckIMt
|
65
|
-
))
|
66
|
-
("Aviat" . (
|
67
|
-
))
|
68
|
-
("Bible" . (
|
69
|
-
))
|
70
|
-
("Biol" . (
|
71
|
-
#$BiochemicalReasoningWithRCCMt
|
72
|
-
#$BiochemistryMt
|
73
|
-
#$BiochemistryVocabularyMt
|
74
|
-
#$BiologicalChemistryMt
|
75
|
-
#$BiologicalChemistryVocabularyMt
|
76
|
-
#$BiologicalProcedureMt
|
77
|
-
#$BiologicalProcedureVocabularyMt
|
78
|
-
#$BiologicalSocialMt
|
79
|
-
#$BiologicalSocialVocabularyMt
|
80
|
-
#$BiologicalWarfareDemoEnvironmentMt
|
81
|
-
#$BiologyGenericsMt
|
82
|
-
#$BiologyMt
|
83
|
-
#$BiologyVocabularyMt
|
84
|
-
#$MicrobiologicalChemistryMt
|
85
|
-
#$MicrobiologicalProcedureVocabularyMt
|
86
|
-
#$MicrobiologyMt
|
87
|
-
#$MicrobiologyVocabularyMt
|
88
|
-
#$MolecularBiologyMt
|
89
|
-
#$MolecularBiologyVocabularyMt
|
90
|
-
#$NaiveBiologicalDescentVocabularyMt
|
91
|
-
))
|
92
|
-
("Bot" . (
|
93
|
-
#$BotanyMt
|
94
|
-
#$BotanyVocabularyMt
|
95
|
-
#$FloralMarketingMt
|
96
|
-
#$VegetationMapCodeMt
|
97
|
-
))
|
98
|
-
("Chem" . (
|
99
|
-
#$AcidsAndBases-ChemistryDomainMt
|
100
|
-
#$BiochemicalReasoningWithRCCMt
|
101
|
-
#$BiochemistryMt
|
102
|
-
#$BiochemistryVocabularyMt
|
103
|
-
#$BiologicalChemistryMt
|
104
|
-
#$BiologicalChemistryVocabularyMt
|
105
|
-
#$ChemicalComposition-ChemistryDomainMt
|
106
|
-
#$ChemicalConstantData-ChemistryDomainMt
|
107
|
-
#$ChemicalDissociation-ChemistryDomainMt
|
108
|
-
#$ChemicalEquations-ChemistryDomainMt
|
109
|
-
#$ChemicalReactions-ChemistryDomainMt
|
110
|
-
#$ChemicalSolutions-ChemistryDomainMt
|
111
|
-
#$ChemistryAssumptionsMt
|
112
|
-
#$ChemistryLaboratory-ChemistryDomainMt
|
113
|
-
#$ChemistryMt
|
114
|
-
#$ChemistryTemplateMt
|
115
|
-
#$ChemistryVocabularyMt
|
116
|
-
#$OrganicChemistryMt
|
117
|
-
#$OrganicChemistryVocabularyMt
|
118
|
-
))
|
119
|
-
("Cin" . (
|
120
|
-
))
|
121
|
-
("CivEng" . (
|
122
|
-
#$EngineeringField
|
123
|
-
))
|
124
|
-
("Comm" . (
|
125
|
-
#$BrandNameProductGMt
|
126
|
-
#$BrandNameProductGVocabularyMt
|
127
|
-
#$BrandNameProductPhysicalCharacteristicsMt
|
128
|
-
#$BrandNameProductPhysicalCharacteristicsVocabularyMt
|
129
|
-
#$BrandNameRoadVehicleWorkingsMt
|
130
|
-
#$BuyingMt
|
131
|
-
#$CommercialBuyingMt
|
132
|
-
#$RetailSalesMt
|
133
|
-
#$ShoppingGMt
|
134
|
-
#$WesternBusinessPracticesMt
|
135
|
-
#$WorldProductsMt
|
136
|
-
))
|
137
|
-
("Comput" . (
|
138
|
-
#$ComputerDataTypesDataMt
|
139
|
-
#$ComputereseLexicalMt
|
140
|
-
#$ComputerGMt
|
141
|
-
#$ComputerGVocabularyMt
|
142
|
-
#$ComputerHardwareDataMt
|
143
|
-
#$ComputerHardwareDataVocabularyMt
|
144
|
-
#$ComputerHardwareMt
|
145
|
-
#$ComputerHardwareVocabularyMt
|
146
|
-
#$ComputerNetworkMt
|
147
|
-
#$ComputerOrganizationDataMt
|
148
|
-
#$ComputerRunningDataMt
|
149
|
-
#$ComputerRunningMt
|
150
|
-
#$ComputerSecurityDataMt
|
151
|
-
#$ComputerSecurityMt
|
152
|
-
#$ComputerSoftwareBuyingMt
|
153
|
-
#$ComputerSoftwareDataMt
|
154
|
-
#$ComputerSoftwareMt
|
155
|
-
#$ComputerSoftwareVocabularyMt
|
156
|
-
#$ComputerUseDomainMt
|
157
|
-
#$ComputerVulnerabilityMt
|
158
|
-
#$NetworkModelMt
|
159
|
-
#$ProgramModelMt
|
160
|
-
#$InformationBuyingMt
|
161
|
-
#$InformationGVocabularyMt
|
162
|
-
#$InformationSecurityMt
|
163
|
-
#$InformationTerminologyVocabularyMt
|
164
|
-
))
|
165
|
-
("Constr" . (
|
166
|
-
#$BuildingContentsMt
|
167
|
-
#$BuildingContentsVocabularyMt
|
168
|
-
#$BuildingMt
|
169
|
-
#$BuildingVocabularyMt
|
170
|
-
#$OrganizationBuildingVocabularyMt
|
171
|
-
))
|
172
|
-
("Cosmet" . (
|
173
|
-
))
|
174
|
-
("Culin" . (
|
175
|
-
#$CoffeeMt
|
176
|
-
#$CookingLingoTemplateMt
|
177
|
-
#$CookingWorldTestCaseEntitiesMt
|
178
|
-
#$FoodBuyingGMt
|
179
|
-
#$FoodSocialMt
|
180
|
-
#$HumanFoodGVocabularyMt
|
181
|
-
))
|
182
|
-
("Dance" . (
|
183
|
-
))
|
184
|
-
("Dent" . (
|
185
|
-
))
|
186
|
-
("Ecol" . (
|
187
|
-
#$EcologyMt
|
188
|
-
#$EcologyVocabularyMt
|
189
|
-
))
|
190
|
-
("Econ" . (
|
191
|
-
#$EconomyMt
|
192
|
-
#$EconomyVocabularyMt
|
193
|
-
))
|
194
|
-
("Educ" . (
|
195
|
-
))
|
196
|
-
("Elec" . (
|
197
|
-
#$ElectricalSystemsMt
|
198
|
-
#$ElectricalSystemsVocabularyMt
|
199
|
-
))
|
200
|
-
("Electron" . (
|
201
|
-
))
|
202
|
-
("Equest" . (
|
203
|
-
))
|
204
|
-
("Fashn" . (
|
205
|
-
#$ClothingGMt
|
206
|
-
#$ClothingGVocabularyMt
|
207
|
-
#$ClothingLingoTemplateMt
|
208
|
-
#$ModernWesternClothingConventionMt
|
209
|
-
))
|
210
|
-
("Fin" . (
|
211
|
-
#$BusinessGMt
|
212
|
-
#$BusinessMoneyMt
|
213
|
-
#$BusinessStillUnsortedForStubsMt
|
214
|
-
#$BusinessStubMt
|
215
|
-
#$FinancialTransactionMt
|
216
|
-
#$WesternBusinessPracticesMt
|
217
|
-
))
|
218
|
-
("Fishg" . (
|
219
|
-
))
|
220
|
-
("Games" . (
|
221
|
-
))
|
222
|
-
("Geog" . (
|
223
|
-
#$DesertShieldMt
|
224
|
-
#$DualistGeopoliticalMt
|
225
|
-
#$DualistGeopoliticalVocabularyMt
|
226
|
-
#$FranceGeographyDualistMt
|
227
|
-
#$FranceGeographyMt
|
228
|
-
#$FranceNaturalGeographyMt
|
229
|
-
#$GeographicalRegionGVocabularyMt
|
230
|
-
#$GeographyLingoTemplateMt
|
231
|
-
#$GeographyVocabularyMt
|
232
|
-
#$GeopoliticalBordersMt
|
233
|
-
#$GeopoliticalEntityVocabularyMt
|
234
|
-
#$NaturalGeographyVocabularyMt
|
235
|
-
#$NorthernHemisphereMt
|
236
|
-
#$PhysicalGeographyMt
|
237
|
-
#$PoliticalGeographyVocabularyMt
|
238
|
-
#$UnitedStatesCulturalGeographyMt
|
239
|
-
#$UnitedStatesGeographyMt
|
240
|
-
#$UnitedStatesGeographyPeopleMt
|
241
|
-
#$UnitedStatesNaturalGeographyMt
|
242
|
-
#$UnitedStatesNaturalGeographyVocabularyMt
|
243
|
-
#$WorldCompleteDualistGeographyMt
|
244
|
-
#$WorldCulturalGeographyDataMt
|
245
|
-
#$WorldGeographyDualistMt
|
246
|
-
#$WorldGeographyMt
|
247
|
-
#$WorldGeographyPhysicalMt
|
248
|
-
#$WorldNaturalGeographyMt
|
249
|
-
#$WorldNaturalGeographyVocabularyMt
|
250
|
-
#$WorldPoliticalGeographyDataMt
|
251
|
-
#$WorldPoliticalGeographyDataVocabularyMt
|
252
|
-
))
|
253
|
-
("Geol" . (
|
254
|
-
#$GeologicalAge
|
255
|
-
))
|
256
|
-
("Herald" . (
|
257
|
-
))
|
258
|
-
("Hist" . (
|
259
|
-
#$PeopleDataMt
|
260
|
-
#$ChronologyMt
|
261
|
-
#$ChronologyVocabularyMt
|
262
|
-
#$HistoryOfMusicDataMt
|
263
|
-
#$HistoryOfScienceDataMt
|
264
|
-
#$WorldHistoryMt
|
265
|
-
))
|
266
|
-
("Hort" . (
|
267
|
-
))
|
268
|
-
("Hunt" . (
|
269
|
-
))
|
270
|
-
("Ind" . (
|
271
|
-
))
|
272
|
-
("Insur" . (
|
273
|
-
))
|
274
|
-
("Journ" . (
|
275
|
-
#$AssociatedPressMt
|
276
|
-
))
|
277
|
-
("Jur" . (
|
278
|
-
#$BasicWesternLegalConceptsMt
|
279
|
-
))
|
280
|
-
("Ling" . (
|
281
|
-
#$CorpusLexicalMt
|
282
|
-
#$CrossLinguisticLexicalMt
|
283
|
-
#$LanguageAndWritingSystemVocabularyMt
|
284
|
-
#$RelativeClausesTemplateMt
|
285
|
-
#$WritingSystemCharactersVocabularyMt
|
286
|
-
))
|
287
|
-
("Literat" . (
|
288
|
-
#$FactsInFictionalWorksMt
|
289
|
-
#$LiteraryPeopleDataMt
|
290
|
-
#$NonfictionalWorksMt
|
291
|
-
))
|
292
|
-
("Math" . (
|
293
|
-
#$BayesianNetworkMt
|
294
|
-
#$DeonticReasoning-InferenceMt
|
295
|
-
#$DeonticReasoning-LogicMt
|
296
|
-
#$EqualityReasoningVocabularyMt
|
297
|
-
#$EuclideanGeometryMt
|
298
|
-
#$GeometryGMt
|
299
|
-
#$GeometryGVocabularyMt
|
300
|
-
#$LogicalTruthImplementationMt
|
301
|
-
#$LogicalTruthMt
|
302
|
-
#$MathMt
|
303
|
-
#$MathVocabularyMt
|
304
|
-
#$NaiveSpatialMt
|
305
|
-
#$NaiveSpatialVocabularyMt
|
306
|
-
#$PathSystemsVocabularyMt
|
307
|
-
#$PointBasedGeometryMt
|
308
|
-
#$PointBasedGeometryVocabularyMt
|
309
|
-
))
|
310
|
-
("Mech" . (
|
311
|
-
))
|
312
|
-
("Med" . (
|
313
|
-
#$AilmentMt
|
314
|
-
#$AilmentVocabularyMt
|
315
|
-
#$BloodTransfusionMt
|
316
|
-
#$DiseaseLexicalMt
|
317
|
-
#$HumanAilmentMt
|
318
|
-
#$HumanAilmentVocabularyMt
|
319
|
-
#$MedicalVulnerabilityMt
|
320
|
-
#$USHealthcareMt
|
321
|
-
))
|
322
|
-
("Meas" . (
|
323
|
-
#$CalendarsMt
|
324
|
-
#$CalendarsVocabularyMt
|
325
|
-
#$GregorianCalendarMt
|
326
|
-
#$GregorianCalendarVocabularyMt
|
327
|
-
#$IslamicCalendarMt
|
328
|
-
#$JewishCalendarMt
|
329
|
-
))
|
330
|
-
("Meteorol" . (
|
331
|
-
#$AmbientConditionsDataMt
|
332
|
-
#$AmbientConditionsMt
|
333
|
-
#$AmbientConditionsVocabularyMt
|
334
|
-
#$EarthWeatherMt
|
335
|
-
#$EarthWeatherVocabularyMt
|
336
|
-
#$WeatherMt
|
337
|
-
#$WeatherVocabularyMt
|
338
|
-
))
|
339
|
-
("Mgmt" . (
|
340
|
-
#$InternationalOrganizationDataMt
|
341
|
-
#$JobMt
|
342
|
-
#$OrganizationGMt
|
343
|
-
#$OrganizationGVocabularyMt
|
344
|
-
#$OrganizationInternalsMt
|
345
|
-
))
|
346
|
-
("Mil" . (
|
347
|
-
#$ArmyFM8-10-7Mt
|
348
|
-
#$ChemicalWeaponsDestructionInRussiaMt
|
349
|
-
#$China-TaiwanMilitaryTechnologyMt
|
350
|
-
#$DesertStormMilitaryPresenceMt
|
351
|
-
#$EmergingCruiseMissileCapabilitiesMt
|
352
|
-
#$EnemyMovementMt
|
353
|
-
#$MilitaryForceStructureMt
|
354
|
-
#$MilitaryGlossaryHoldingMt
|
355
|
-
#$MilitaryGMt
|
356
|
-
#$MilitaryGVocabularyMt
|
357
|
-
#$MilitaryOrganization
|
358
|
-
#$MilitaryStandard-2408Mt
|
359
|
-
#$MilitaryTermsVocabularyMt
|
360
|
-
#$ModernMilitaryMt
|
361
|
-
#$ModernMilitaryTacticsMt
|
362
|
-
#$ModernMilitaryVehiclesMt
|
363
|
-
#$ModernMilitaryWeaponsMt
|
364
|
-
#$PeloponnesianWarMt
|
365
|
-
#$RightWingTerrorismAndWeaponsOfMassDestructionMt
|
366
|
-
#$SAICTerrorismEventsDataMt
|
367
|
-
#$TerrorismInTheMiddleEastFactsheetMt
|
368
|
-
#$TerroristGroup
|
369
|
-
#$UnitedStatesModernMilitaryVehiclesDataMt
|
370
|
-
#$USArmsControlAndDisarmamentAgencyMt
|
371
|
-
#$USMarineCorpsPracticesMt
|
372
|
-
#$USMilitaryPracticesMt
|
373
|
-
#$USMilitaryStaffOrganizationMt
|
374
|
-
#$WeaponsOfMassDestructionTacticsMt
|
375
|
-
#$Year2000MilitaryTechnologyMt
|
376
|
-
))
|
377
|
-
("Mil" Naut . (
|
378
|
-
))
|
379
|
-
("Miner" . (
|
380
|
-
#$MineralogyMt
|
381
|
-
))
|
382
|
-
("Mining" . (
|
383
|
-
))
|
384
|
-
("Mus" . (
|
385
|
-
))
|
386
|
-
("Mythol" . (
|
387
|
-
#$ChristmasMythologyMt
|
388
|
-
#$FactsInFictionalWorksMt
|
389
|
-
#$GreekMythologyMt
|
390
|
-
#$PopCultureMythologyMt
|
391
|
-
#$RomanMythologyMt
|
392
|
-
#$WorldMythologyMt
|
393
|
-
))
|
394
|
-
("Naut" . (
|
395
|
-
))
|
396
|
-
("Nucl" nuclear . (
|
397
|
-
))
|
398
|
-
("Pharm" . (
|
399
|
-
#$BrandNamePharmaceuticalUseMt
|
400
|
-
#$PharmaceuticalDetailsMt
|
401
|
-
#$PharmaceuticalGMt
|
402
|
-
#$PharmaceuticalGVocabularyMt
|
403
|
-
#$PharmaceuticalUseMt
|
404
|
-
#$PharmaceuticalUseVocabularyMt
|
405
|
-
))
|
406
|
-
("Philos" . (
|
407
|
-
))
|
408
|
-
("Phon" . (
|
409
|
-
))
|
410
|
-
("Phot" . (
|
411
|
-
))
|
412
|
-
("Phys" . (
|
413
|
-
#$Aerodynamics
|
414
|
-
#$DefinitionOfKineticEnergyMt
|
415
|
-
#$DefinitionOfNetWorkMt
|
416
|
-
#$DefinitionOfWeightMt
|
417
|
-
#$DefinitionOfWork-ForceAndDisplacementSameDirectionMt
|
418
|
-
#$DefinitionOfWorkMt
|
419
|
-
#$NaivePhysicsVocabularyMt
|
420
|
-
#$NewtonianPhysicsMt
|
421
|
-
#$NewtonsSecondLawMt
|
422
|
-
#$NewtonsThirdLawMt
|
423
|
-
#$NormalPhysicalConditionsMt
|
424
|
-
#$ObjectPhysicalCharacteristicsVocabularyMt
|
425
|
-
))
|
426
|
-
("Physiol" . (
|
427
|
-
#$HumanPerceptionMt
|
428
|
-
#$HumanPerceptionVocabularyMt
|
429
|
-
#$HumanPhysiologyVocabularyMt
|
430
|
-
#$LinnaeanTaxonomyPhysiologyMt
|
431
|
-
#$LinnaeanTaxonomyPhysiologyVocabularyMt
|
432
|
-
#$PerceptionMt
|
433
|
-
#$PerceptionVocabularyMt
|
434
|
-
#$VertebratePhysiologyMt
|
435
|
-
#$VertebratePhysiologyVocabularyMt
|
436
|
-
))
|
437
|
-
("Pol" . (
|
438
|
-
#$GovernmentAgency
|
439
|
-
))
|
440
|
-
("Post" postal . (
|
441
|
-
))
|
442
|
-
("Print" . (
|
443
|
-
))
|
444
|
-
("Psych" . (
|
445
|
-
#$AffectMt
|
446
|
-
#$AffectVocabularyMt
|
447
|
-
))
|
448
|
-
("Publg" . (
|
449
|
-
#$PublicationDataMt
|
450
|
-
))
|
451
|
-
("Radio" . (
|
452
|
-
))
|
453
|
-
("Rail" . (
|
454
|
-
))
|
455
|
-
("Relig" . (
|
456
|
-
#$BuddhismMt
|
457
|
-
#$CatholicismMt
|
458
|
-
#$ChristianityMt
|
459
|
-
#$ChristianityNaiveMt
|
460
|
-
#$ChristianTrinityMt
|
461
|
-
#$IslamShiaMt
|
462
|
-
#$JudaismMt
|
463
|
-
#$Judeo-ChristianMt
|
464
|
-
#$NaturalismMt
|
465
|
-
#$ReligiousAgnostic
|
466
|
-
#$ReligiousCeremony
|
467
|
-
#$ReligiousPeopleDataMt
|
468
|
-
))
|
469
|
-
("Sch" . (
|
470
|
-
))
|
471
|
-
("Sci" . (
|
472
|
-
#$GeneralScientificLexicalMt
|
473
|
-
#$HistoryOfScienceDataMt
|
474
|
-
#$OrganizedResearchMt
|
475
|
-
#$TheoryOfScienceVocabularyMt
|
476
|
-
))
|
477
|
-
("Sewing" . (
|
478
|
-
))
|
479
|
-
("Sociol" . (
|
480
|
-
#$AustralasianSocialLifeMt
|
481
|
-
#$BiologicalSocialVocabularyMt
|
482
|
-
#$HumanSocialLifeMt
|
483
|
-
#$HumanSocialLifeWithTenseMt
|
484
|
-
#$IranianSocialLifeMt
|
485
|
-
#$PeopleVocabularyMt
|
486
|
-
#$UnitedStatesSocialLifeMt
|
487
|
-
#$CultureGMt
|
488
|
-
#$CultureGVocabularyMt
|
489
|
-
))
|
490
|
-
("Sport" . (
|
491
|
-
#$AmericanCollegeSportsOrganizationsDataMt
|
492
|
-
#$AmericanCollegeSportsPeopleDataMt
|
493
|
-
#$AmericanProfessionalSportsMt
|
494
|
-
#$NonUSProfessionalSportsMt
|
495
|
-
#$OlympicsMt
|
496
|
-
#$ProfessionalSportsGMt
|
497
|
-
#$SportsLingoTemplateMt
|
498
|
-
#$SportsProductsMt
|
499
|
-
))
|
500
|
-
("Stat" . (
|
501
|
-
))
|
502
|
-
("Tax" . (
|
503
|
-
#$AmericanFiscalPracticeMt
|
504
|
-
#$JapaneseFiscalPracticeMt
|
505
|
-
))
|
506
|
-
("Tech" . (
|
507
|
-
#$DevicePerspectiveMt
|
508
|
-
#$SimpleDeviceFunctioningMt
|
509
|
-
#$TechnicalEnglishLexicalMt
|
510
|
-
#$ProductGMt
|
511
|
-
#$ProductGVocabularyMt
|
512
|
-
#$ProductPhysicalCharacteristicsMt
|
513
|
-
#$ProductUsageMt
|
514
|
-
#$ProductUsageVocabularyMt
|
515
|
-
))
|
516
|
-
("Telcom" . (
|
517
|
-
#$CommunicationsSupportMt
|
518
|
-
#$CommunicationsSupportRulesMt
|
519
|
-
#$CommunicationsSupportVocabMt
|
520
|
-
))
|
521
|
-
("Tex" . (
|
522
|
-
#$MaterialsManipulationMt
|
523
|
-
))
|
524
|
-
("Theat" . (
|
525
|
-
))
|
526
|
-
("Tourism" . (
|
527
|
-
#$GenericTouristMt
|
528
|
-
))
|
529
|
-
("Transp" . (
|
530
|
-
#$InternationalTrafficMt
|
531
|
-
#$MovementMt
|
532
|
-
#$MovementVocabularyMt
|
533
|
-
#$SuezCanalTrafficMt
|
534
|
-
#$TransportationMt
|
535
|
-
#$TransportationPlanningMt
|
536
|
-
#$TransportationVocabularyMt
|
537
|
-
))
|
538
|
-
("Turf" . (
|
539
|
-
))
|
540
|
-
("TV" . (
|
541
|
-
#$DCSuperheroesMt
|
542
|
-
#$LargeCorpBlackBoxMt
|
543
|
-
#$MassMediaDataMt
|
544
|
-
#$MassMediaMt
|
545
|
-
#$TeletubbiesMt
|
546
|
-
#$ThePeanutsCartoonMt
|
547
|
-
#$TheSimpsonsMt
|
548
|
-
#$TheXFilesTVSeriesMt
|
549
|
-
))
|
550
|
-
("Univ" . (
|
551
|
-
#$AcademicLifeMt
|
552
|
-
#$AcademicOrganizationMt
|
553
|
-
#$AcademicOrganizationVocabularyMt
|
554
|
-
#$UniversityDataMt
|
555
|
-
))
|
556
|
-
("Vet" veterinary . (
|
557
|
-
))
|
558
|
-
("Wine" . (
|
559
|
-
))
|
560
|
-
("Zool" . (
|
561
|
-
#$AmericanKennelClubMt
|
562
|
-
#$AnimalActivitiesMt
|
563
|
-
#$AnimalActivitiesVocabularyMt
|
564
|
-
#$AnimalMovementMt
|
565
|
-
#$DogClassificationSpindleCollectorMt
|
566
|
-
#$DogClassificationSpindleHeadMt
|
567
|
-
#$DomesticBreedsMt
|
568
|
-
#$DomesticBreedsVocabularyMt
|
569
|
-
#$NaiveAnimalsVocabularyMt
|
570
|
-
))
|
571
|
-
))
|
572
|
-
|
573
|
-
(define domains-of (term)
|
574
|
-
(clet (
|
575
|
-
(result ())
|
576
|
-
(base-assertions (with-just-mt #$BaseKB (gather-index term)))
|
577
|
-
)
|
578
|
-
(cdolist (pair *domains*)
|
579
|
-
(pif(< 0 (with-mt-list (cdr pair)
|
580
|
-
(length (set-difference (gather-index term)
|
581
|
-
base-assertions) )))
|
582
|
-
(csetq result (adjoin (car pair) result))
|
583
|
-
()))
|
584
|
-
(ret result)))
|
data/lib/cycr/sexpr.flex
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
package pl.apohllo.lexicon.pwn.server;
|
2
|
-
|
3
|
-
import java.io.StringReader;
|
4
|
-
%%
|
5
|
-
|
6
|
-
%class Lexer
|
7
|
-
%unicode
|
8
|
-
%line
|
9
|
-
%public
|
10
|
-
%type Symbol
|
11
|
-
|
12
|
-
%{
|
13
|
-
StringBuffer string = new StringBuffer();
|
14
|
-
|
15
|
-
public Lexer(String input){
|
16
|
-
this.zzReader = new StringReader(input);
|
17
|
-
}
|
18
|
-
|
19
|
-
private Symbol symbol(int type) {
|
20
|
-
return new Symbol(type, yyline, yycolumn);
|
21
|
-
}
|
22
|
-
private Symbol symbol(int type, String value) {
|
23
|
-
return new Symbol(type, yyline, yycolumn, value);
|
24
|
-
}
|
25
|
-
%}
|
26
|
-
|
27
|
-
LineTerminator = \r|\n|\r\n
|
28
|
-
InputCharacter = [^\r\n\"\(\):& ]
|
29
|
-
WhiteSpace = {LineTerminator} | [ \t\f]
|
30
|
-
|
31
|
-
Symbol = : {InputCharacter}+
|
32
|
-
|
33
|
-
Atom = {InputCharacter}+
|
34
|
-
|
35
|
-
OpenPar = "("
|
36
|
-
ClosePar = ")"
|
37
|
-
|
38
|
-
%state STRING
|
39
|
-
|
40
|
-
|
41
|
-
%%
|
42
|
-
|
43
|
-
<YYINITIAL> {
|
44
|
-
/* keywords */
|
45
|
-
{OpenPar} { return symbol(Symbol.OPEN_PAR); }
|
46
|
-
{ClosePar} { return symbol(Symbol.CLOSE_PAR); }
|
47
|
-
|
48
|
-
/* identifiers */
|
49
|
-
{Symbol} { return symbol(Symbol.SYMBOL,yytext()); }
|
50
|
-
{Atom} { return symbol(Symbol.ATOM,yytext()); }
|
51
|
-
|
52
|
-
|
53
|
-
/* literals */
|
54
|
-
\" { string.setLength(0); yybegin(STRING); }
|
55
|
-
|
56
|
-
/* whitespace */
|
57
|
-
{WhiteSpace} { /* ignore */ }
|
58
|
-
}
|
59
|
-
|
60
|
-
<STRING> {
|
61
|
-
\" { yybegin(YYINITIAL);
|
62
|
-
return symbol(Symbol.STRING_LITERAL, string.toString()); }
|
63
|
-
[^\n\r\"\\]+ { string.append( yytext() ); }
|
64
|
-
\\t { string.append('\t'); }
|
65
|
-
\\n { string.append('\n'); }
|
66
|
-
|
67
|
-
\\r { string.append('\r'); }
|
68
|
-
\\\" { string.append('\"'); }
|
69
|
-
\\ { string.append('\\'); }
|
70
|
-
}
|
71
|
-
|
72
|
-
/* error fallback */
|
73
|
-
.|\n { throw new Error("Illegal character <"+ yytext()+">"); }
|
74
|
-
|