opener-ned 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +57 -0
- data/bin/ned +7 -0
- data/bin/ned-server +10 -0
- data/config.ru +4 -0
- data/core/target/ehu-ned-1.0.jar +0 -0
- data/lib/opener/ned.rb +96 -0
- data/lib/opener/ned/cli.rb +92 -0
- data/lib/opener/ned/public/markdown.css +284 -0
- data/lib/opener/ned/server.rb +13 -0
- data/lib/opener/ned/version.rb +5 -0
- data/lib/opener/ned/views/index.erb +87 -0
- data/opener-ned.gemspec +30 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9040d06ad1e01c87c8748947ee3c66f61ea2d083
|
4
|
+
data.tar.gz: 843fc7ae1a18cf93118a9300bcfce32f4f5ba27d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6947de909caf7c8ef1c496e994a18a99190b3b23c83e73528a7491531a6a22c08a3179303517a3c99f7041a3a66dffbb5519c7dd8008296c1bd96f45525423b7
|
7
|
+
data.tar.gz: cd2c1cdf5386e380cbb09663a2633f793bcb7f61fa83879df5e92cb118911e177b1d9b82daaa35b8bf5ca55de94a0a38ee5278de5a74c08b45683d9b0d0f2b60
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# NED
|
2
|
+
|
3
|
+
This repository contains a Named Entity Disambiguation tool that queries a
|
4
|
+
DBpedia spotlight server. The client takes KAF as input (containing
|
5
|
+
`<entities>` nodes).
|
6
|
+
|
7
|
+
## Requirements
|
8
|
+
|
9
|
+
* Ruby 1.9.2 or newer
|
10
|
+
* Java 1.7 or newer
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Installing as a regular Gem:
|
15
|
+
|
16
|
+
gem install opener-ned
|
17
|
+
|
18
|
+
Using Bundler:
|
19
|
+
|
20
|
+
gem 'opener-ned',
|
21
|
+
:git => 'git@github.com:opener-project/constituent-parser-base.git',
|
22
|
+
:branch => 'master'
|
23
|
+
|
24
|
+
Using specific install:
|
25
|
+
|
26
|
+
gem install specific_install
|
27
|
+
gem specific_install opener-ned \
|
28
|
+
-l https://github.com/opener-project/constituent-parser-base.git
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
The NED client requires a working DBpedia Spotlight server to be available. By
|
33
|
+
default it tries to connect to http://localhost:2020 (English language) but you
|
34
|
+
can change this using the `--host` and `--port` options in the CLI.
|
35
|
+
|
36
|
+
A simple example:
|
37
|
+
|
38
|
+
cat some_input_file.kaf | ned --host=http://example.com/ --port=1234
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
First make sure all the required dependencies are installed:
|
43
|
+
|
44
|
+
bundle install
|
45
|
+
|
46
|
+
Then compile the required Java code:
|
47
|
+
|
48
|
+
bundle exec rake compile
|
49
|
+
|
50
|
+
For this you'll need to have Java 1.7 and Maven installed. These requirements
|
51
|
+
are verified for you before the Rake task calls Maven.
|
52
|
+
|
53
|
+
## Structure
|
54
|
+
|
55
|
+
This repository comes in two parts: a collection of Java source files and Ruby
|
56
|
+
source files. The Java code can be found in the `core/` directory, everything
|
57
|
+
else will be Ruby source code.
|
data/bin/ned
ADDED
data/bin/ned-server
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../lib/opener/ned/server'
|
4
|
+
|
5
|
+
# Without calling `Rack::Server#options` manually the CLI arguments will never
|
6
|
+
# be passed, thus the application can't be specified as a constructor argument.
|
7
|
+
server = Rack::Server.new
|
8
|
+
server.options[:config] = File.expand_path('../../config.ru', __FILE__)
|
9
|
+
|
10
|
+
server.start
|
data/config.ru
ADDED
Binary file
|
data/lib/opener/ned.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'java'
|
3
|
+
require 'stringio'
|
4
|
+
require 'nokogiri'
|
5
|
+
|
6
|
+
require File.expand_path('../../../core/target/ehu-ned-1.0.jar', __FILE__)
|
7
|
+
|
8
|
+
require_relative 'ned/version'
|
9
|
+
require_relative 'ned/cli'
|
10
|
+
|
11
|
+
import 'java.io.InputStreamReader'
|
12
|
+
|
13
|
+
import 'ehu.ned.Annotate'
|
14
|
+
import 'ixa.kaflib.KAFDocument'
|
15
|
+
|
16
|
+
module Opener
|
17
|
+
##
|
18
|
+
# Ruby wrapper around the Java based Ned tool that's powered by DBpedia.
|
19
|
+
#
|
20
|
+
# @!attribute [r] options
|
21
|
+
# @return [Hash]
|
22
|
+
#
|
23
|
+
class Ned
|
24
|
+
attr_reader :options
|
25
|
+
|
26
|
+
LANGUAGE_ENDPOINTS = {
|
27
|
+
"en"=>"http://spotlight.sztaki.hu:2222",
|
28
|
+
"nl"=>"http://nl.dbpedia.org/spotlight",
|
29
|
+
"fr"=>"http://spotlight.sztaki.hu:2225",
|
30
|
+
"de"=>"http://de.dbpedia.org/spotlight",
|
31
|
+
"es"=>"http://spotlight.sztaki.hu:2231",
|
32
|
+
"it"=>"http://spotlight.sztaki.hu:2230",
|
33
|
+
"ru"=>"http://spotlight.sztaki.hu:2227",
|
34
|
+
"pt"=>"http://spotlight.sztaki.hu:2228",
|
35
|
+
"hu"=>"http://spotlight.sztaki.hu:2229",
|
36
|
+
"tr"=>"http://spotlight.sztaki.hu:2235"
|
37
|
+
}
|
38
|
+
|
39
|
+
##
|
40
|
+
# Hash containing the default options to use.
|
41
|
+
#
|
42
|
+
# @return [Hash]
|
43
|
+
#
|
44
|
+
DEFAULT_OPTIONS = {
|
45
|
+
:args => [],
|
46
|
+
}.freeze
|
47
|
+
|
48
|
+
##
|
49
|
+
# @param [Hash] options
|
50
|
+
#
|
51
|
+
# @option options [Array] :args Arbitrary arguments to pass to the
|
52
|
+
# underlying kernel.
|
53
|
+
# @option options [String|Numeric] :port The port number to connect to.
|
54
|
+
# @option options [String] :host The hostname of the DBpedia server.
|
55
|
+
# @option options [String] :language When set the port number will be based
|
56
|
+
# on this value.
|
57
|
+
#
|
58
|
+
def initialize(options = {})
|
59
|
+
@options = DEFAULT_OPTIONS.merge(options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def run(input)
|
63
|
+
if !input or input.strip.empty?
|
64
|
+
raise ArgumentError, 'No input specified'
|
65
|
+
end
|
66
|
+
|
67
|
+
language = language_from_kaf(input)
|
68
|
+
|
69
|
+
input_io = StringIO.new(input)
|
70
|
+
reader = InputStreamReader.new(input_io.to_inputstream)
|
71
|
+
document = KAFDocument.create_from_stream(reader)
|
72
|
+
annotator = Java::ehu.ned.Annotate.new
|
73
|
+
|
74
|
+
endpoint = @options.fetch(:endpoint, uri_for_language(language))
|
75
|
+
|
76
|
+
annotator.disambiguateNEsToKAF(
|
77
|
+
document,
|
78
|
+
endpoint.to_s
|
79
|
+
)
|
80
|
+
|
81
|
+
return document.to_string
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def language_from_kaf(input)
|
87
|
+
document = Nokogiri::XML(input)
|
88
|
+
language = document.at('KAF').attr('xml:lang')
|
89
|
+
end
|
90
|
+
|
91
|
+
def uri_for_language(language)
|
92
|
+
LANGUAGE_ENDPOINTS[language]+"/rest/disambiguate"
|
93
|
+
end
|
94
|
+
|
95
|
+
end # Ned
|
96
|
+
end # Opener
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module Opener
|
2
|
+
class Ned
|
3
|
+
##
|
4
|
+
# CLI wrapper around {Opener::Ned} using OptionParser.
|
5
|
+
#
|
6
|
+
# @!attribute [r] options
|
7
|
+
# @return [Hash]
|
8
|
+
# @!attribute [r] option_parser
|
9
|
+
# @return [OptionParser]
|
10
|
+
#
|
11
|
+
class CLI
|
12
|
+
attr_reader :options, :option_parser
|
13
|
+
|
14
|
+
##
|
15
|
+
# @param [Hash] options
|
16
|
+
#
|
17
|
+
def initialize(options = {})
|
18
|
+
@options = DEFAULT_OPTIONS.merge(options)
|
19
|
+
|
20
|
+
@option_parser = OptionParser.new do |opts|
|
21
|
+
opts.program_name = 'ned'
|
22
|
+
opts.summary_indent = ' '
|
23
|
+
|
24
|
+
opts.on('-h', '--help', 'Shows this help message') do
|
25
|
+
show_help
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on('-v', '--version', 'Shows the current version') do
|
29
|
+
show_version
|
30
|
+
end
|
31
|
+
|
32
|
+
opts.on('-p', '--port [VALUE]', 'Use a custom port') do |value|
|
33
|
+
@options[:port] = value
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on('-H', '--host [VALUE]', 'Use a custom hostname') do |value|
|
37
|
+
@options[:host] = value
|
38
|
+
end
|
39
|
+
|
40
|
+
opts.separator <<-EOF
|
41
|
+
|
42
|
+
Examples:
|
43
|
+
|
44
|
+
cat input_file.kaf | #{opts.program_name}
|
45
|
+
cat input_file.kaf | #{opts.program_name} --host=http://some-host.com/
|
46
|
+
|
47
|
+
Port Numbers:
|
48
|
+
|
49
|
+
Port numbers are required. Each language has its own port number (unless
|
50
|
+
specified otherwise):
|
51
|
+
|
52
|
+
* German: 2010
|
53
|
+
* English: 2020
|
54
|
+
* Spanish: 2030
|
55
|
+
* French: 2040
|
56
|
+
* Italian: 2050
|
57
|
+
* Dutch: 2060
|
58
|
+
|
59
|
+
By default port 2020 (English) is used.
|
60
|
+
EOF
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# @param [String] input
|
66
|
+
#
|
67
|
+
def run(input)
|
68
|
+
option_parser.parse!(options[:args])
|
69
|
+
|
70
|
+
ned = Ned.new(options)
|
71
|
+
|
72
|
+
puts ned.run(input)
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
##
|
78
|
+
# Shows the help message and exits the program.
|
79
|
+
#
|
80
|
+
def show_help
|
81
|
+
abort option_parser.to_s
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Shows the version and exits the program.
|
86
|
+
#
|
87
|
+
def show_version
|
88
|
+
abort "#{option_parser.program_name} v#{VERSION} on #{RUBY_DESCRIPTION}"
|
89
|
+
end
|
90
|
+
end # CLI
|
91
|
+
end # Ned
|
92
|
+
end # Opener
|
@@ -0,0 +1,284 @@
|
|
1
|
+
|
2
|
+
input[type="text"], textarea
|
3
|
+
{
|
4
|
+
width: 500px;
|
5
|
+
}
|
6
|
+
|
7
|
+
body {
|
8
|
+
font-family: Helvetica, arial, sans-serif;
|
9
|
+
font-size: 14px;
|
10
|
+
line-height: 1.6;
|
11
|
+
padding-top: 10px;
|
12
|
+
padding-bottom: 10px;
|
13
|
+
background-color: white;
|
14
|
+
padding: 30px; }
|
15
|
+
|
16
|
+
body > *:first-child {
|
17
|
+
margin-top: 0 !important; }
|
18
|
+
body > *:last-child {
|
19
|
+
margin-bottom: 0 !important; }
|
20
|
+
|
21
|
+
a {
|
22
|
+
color: #4183C4; }
|
23
|
+
a.absent {
|
24
|
+
color: #cc0000; }
|
25
|
+
a.anchor {
|
26
|
+
display: block;
|
27
|
+
padding-left: 30px;
|
28
|
+
margin-left: -30px;
|
29
|
+
cursor: pointer;
|
30
|
+
position: absolute;
|
31
|
+
top: 0;
|
32
|
+
left: 0;
|
33
|
+
bottom: 0; }
|
34
|
+
|
35
|
+
h1, h2, h3, h4, h5, h6 {
|
36
|
+
margin: 20px 0 10px;
|
37
|
+
padding: 0;
|
38
|
+
font-weight: bold;
|
39
|
+
-webkit-font-smoothing: antialiased;
|
40
|
+
cursor: text;
|
41
|
+
position: relative; }
|
42
|
+
|
43
|
+
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor {
|
44
|
+
background: url("../../images/modules/styleguide/para.png") no-repeat 10px center;
|
45
|
+
text-decoration: none; }
|
46
|
+
|
47
|
+
h1 tt, h1 code {
|
48
|
+
font-size: inherit; }
|
49
|
+
|
50
|
+
h2 tt, h2 code {
|
51
|
+
font-size: inherit; }
|
52
|
+
|
53
|
+
h3 tt, h3 code {
|
54
|
+
font-size: inherit; }
|
55
|
+
|
56
|
+
h4 tt, h4 code {
|
57
|
+
font-size: inherit; }
|
58
|
+
|
59
|
+
h5 tt, h5 code {
|
60
|
+
font-size: inherit; }
|
61
|
+
|
62
|
+
h6 tt, h6 code {
|
63
|
+
font-size: inherit; }
|
64
|
+
|
65
|
+
h1 {
|
66
|
+
font-size: 28px;
|
67
|
+
color: black; }
|
68
|
+
|
69
|
+
h2 {
|
70
|
+
font-size: 24px;
|
71
|
+
border-bottom: 1px solid #cccccc;
|
72
|
+
color: black; }
|
73
|
+
|
74
|
+
h3 {
|
75
|
+
font-size: 18px; }
|
76
|
+
|
77
|
+
h4 {
|
78
|
+
font-size: 16px; }
|
79
|
+
|
80
|
+
h5 {
|
81
|
+
font-size: 14px; }
|
82
|
+
|
83
|
+
h6 {
|
84
|
+
color: #777777;
|
85
|
+
font-size: 14px; }
|
86
|
+
|
87
|
+
p, blockquote, ul, ol, dl, li, table, pre {
|
88
|
+
margin: 15px 0; }
|
89
|
+
|
90
|
+
hr {
|
91
|
+
background: transparent url("../../images/modules/pulls/dirty-shade.png") repeat-x 0 0;
|
92
|
+
border: 0 none;
|
93
|
+
color: #cccccc;
|
94
|
+
height: 4px;
|
95
|
+
padding: 0; }
|
96
|
+
|
97
|
+
body > h2:first-child {
|
98
|
+
margin-top: 0;
|
99
|
+
padding-top: 0; }
|
100
|
+
body > h1:first-child {
|
101
|
+
margin-top: 0;
|
102
|
+
padding-top: 0; }
|
103
|
+
body > h1:first-child + h2 {
|
104
|
+
margin-top: 0;
|
105
|
+
padding-top: 0; }
|
106
|
+
body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child {
|
107
|
+
margin-top: 0;
|
108
|
+
padding-top: 0; }
|
109
|
+
|
110
|
+
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
|
111
|
+
margin-top: 0;
|
112
|
+
padding-top: 0; }
|
113
|
+
|
114
|
+
h1 p, h2 p, h3 p, h4 p, h5 p, h6 p {
|
115
|
+
margin-top: 0; }
|
116
|
+
|
117
|
+
li p.first {
|
118
|
+
display: inline-block; }
|
119
|
+
|
120
|
+
ul, ol {
|
121
|
+
padding-left: 30px; }
|
122
|
+
|
123
|
+
ul :first-child, ol :first-child {
|
124
|
+
margin-top: 0; }
|
125
|
+
|
126
|
+
ul :last-child, ol :last-child {
|
127
|
+
margin-bottom: 0; }
|
128
|
+
|
129
|
+
dl {
|
130
|
+
padding: 0; }
|
131
|
+
dl dt {
|
132
|
+
font-size: 14px;
|
133
|
+
font-weight: bold;
|
134
|
+
font-style: italic;
|
135
|
+
padding: 0;
|
136
|
+
margin: 15px 0 5px; }
|
137
|
+
dl dt:first-child {
|
138
|
+
padding: 0; }
|
139
|
+
dl dt > :first-child {
|
140
|
+
margin-top: 0; }
|
141
|
+
dl dt > :last-child {
|
142
|
+
margin-bottom: 0; }
|
143
|
+
dl dd {
|
144
|
+
margin: 0 0 15px;
|
145
|
+
padding: 0 15px; }
|
146
|
+
dl dd > :first-child {
|
147
|
+
margin-top: 0; }
|
148
|
+
dl dd > :last-child {
|
149
|
+
margin-bottom: 0; }
|
150
|
+
|
151
|
+
blockquote {
|
152
|
+
border-left: 4px solid #dddddd;
|
153
|
+
padding: 0 15px;
|
154
|
+
color: #777777; }
|
155
|
+
blockquote > :first-child {
|
156
|
+
margin-top: 0; }
|
157
|
+
blockquote > :last-child {
|
158
|
+
margin-bottom: 0; }
|
159
|
+
|
160
|
+
table {
|
161
|
+
padding: 0; }
|
162
|
+
table tr {
|
163
|
+
border-top: 1px solid #cccccc;
|
164
|
+
background-color: white;
|
165
|
+
margin: 0;
|
166
|
+
padding: 0; }
|
167
|
+
table tr:nth-child(2n) {
|
168
|
+
background-color: #f8f8f8; }
|
169
|
+
table tr th {
|
170
|
+
font-weight: bold;
|
171
|
+
border: 1px solid #cccccc;
|
172
|
+
text-align: left;
|
173
|
+
margin: 0;
|
174
|
+
padding: 6px 13px; }
|
175
|
+
table tr td {
|
176
|
+
border: 1px solid #cccccc;
|
177
|
+
text-align: left;
|
178
|
+
margin: 0;
|
179
|
+
padding: 6px 13px; }
|
180
|
+
table tr th :first-child, table tr td :first-child {
|
181
|
+
margin-top: 0; }
|
182
|
+
table tr th :last-child, table tr td :last-child {
|
183
|
+
margin-bottom: 0; }
|
184
|
+
|
185
|
+
img {
|
186
|
+
max-width: 100%; }
|
187
|
+
|
188
|
+
span.frame {
|
189
|
+
display: block;
|
190
|
+
overflow: hidden; }
|
191
|
+
span.frame > span {
|
192
|
+
border: 1px solid #dddddd;
|
193
|
+
display: block;
|
194
|
+
float: left;
|
195
|
+
overflow: hidden;
|
196
|
+
margin: 13px 0 0;
|
197
|
+
padding: 7px;
|
198
|
+
width: auto; }
|
199
|
+
span.frame span img {
|
200
|
+
display: block;
|
201
|
+
float: left; }
|
202
|
+
span.frame span span {
|
203
|
+
clear: both;
|
204
|
+
color: #333333;
|
205
|
+
display: block;
|
206
|
+
padding: 5px 0 0; }
|
207
|
+
span.align-center {
|
208
|
+
display: block;
|
209
|
+
overflow: hidden;
|
210
|
+
clear: both; }
|
211
|
+
span.align-center > span {
|
212
|
+
display: block;
|
213
|
+
overflow: hidden;
|
214
|
+
margin: 13px auto 0;
|
215
|
+
text-align: center; }
|
216
|
+
span.align-center span img {
|
217
|
+
margin: 0 auto;
|
218
|
+
text-align: center; }
|
219
|
+
span.align-right {
|
220
|
+
display: block;
|
221
|
+
overflow: hidden;
|
222
|
+
clear: both; }
|
223
|
+
span.align-right > span {
|
224
|
+
display: block;
|
225
|
+
overflow: hidden;
|
226
|
+
margin: 13px 0 0;
|
227
|
+
text-align: right; }
|
228
|
+
span.align-right span img {
|
229
|
+
margin: 0;
|
230
|
+
text-align: right; }
|
231
|
+
span.float-left {
|
232
|
+
display: block;
|
233
|
+
margin-right: 13px;
|
234
|
+
overflow: hidden;
|
235
|
+
float: left; }
|
236
|
+
span.float-left span {
|
237
|
+
margin: 13px 0 0; }
|
238
|
+
span.float-right {
|
239
|
+
display: block;
|
240
|
+
margin-left: 13px;
|
241
|
+
overflow: hidden;
|
242
|
+
float: right; }
|
243
|
+
span.float-right > span {
|
244
|
+
display: block;
|
245
|
+
overflow: hidden;
|
246
|
+
margin: 13px auto 0;
|
247
|
+
text-align: right; }
|
248
|
+
|
249
|
+
code, tt {
|
250
|
+
margin: 0 2px;
|
251
|
+
padding: 0 5px;
|
252
|
+
white-space: nowrap;
|
253
|
+
border: 1px solid #eaeaea;
|
254
|
+
background-color: #f8f8f8;
|
255
|
+
border-radius: 3px; }
|
256
|
+
|
257
|
+
pre code {
|
258
|
+
margin: 0;
|
259
|
+
padding: 0;
|
260
|
+
white-space: pre;
|
261
|
+
border: none;
|
262
|
+
background: transparent; }
|
263
|
+
|
264
|
+
.highlight pre {
|
265
|
+
background-color: #f8f8f8;
|
266
|
+
border: 1px solid #cccccc;
|
267
|
+
font-size: 13px;
|
268
|
+
line-height: 19px;
|
269
|
+
overflow: auto;
|
270
|
+
padding: 6px 10px;
|
271
|
+
border-radius: 3px; }
|
272
|
+
|
273
|
+
pre {
|
274
|
+
background-color: #f8f8f8;
|
275
|
+
border: 1px solid #cccccc;
|
276
|
+
font-size: 13px;
|
277
|
+
line-height: 19px;
|
278
|
+
overflow: auto;
|
279
|
+
padding: 6px 10px;
|
280
|
+
border-radius: 3px; }
|
281
|
+
pre code, pre tt {
|
282
|
+
background-color: transparent;
|
283
|
+
border: none; }
|
284
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'opener/webservice'
|
3
|
+
require 'httpclient'
|
4
|
+
|
5
|
+
module Opener
|
6
|
+
class Ned
|
7
|
+
class Server < Webservice
|
8
|
+
set :views, File.expand_path('../views', __FILE__)
|
9
|
+
text_processor Ned
|
10
|
+
accepted_params :input, :host, :port
|
11
|
+
end # Server
|
12
|
+
end # Ned
|
13
|
+
end # Opener
|
@@ -0,0 +1,87 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<link type="text/css" rel="stylesheet" href="markdown.css" />
|
6
|
+
|
7
|
+
<title>NED Webservice</title>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<h1>NED Webservice</h1>
|
11
|
+
|
12
|
+
<p>
|
13
|
+
* required
|
14
|
+
|
15
|
+
<br />
|
16
|
+
|
17
|
+
** When entering a value no response will be displayed in the browser.
|
18
|
+
</p>
|
19
|
+
|
20
|
+
<form action="<%=url("/")%>" method="POST">
|
21
|
+
<div>
|
22
|
+
<label for="input">KAF input *</label>
|
23
|
+
<br />
|
24
|
+
|
25
|
+
<textarea id="input" name="input" cols="50" rows="10"></textarea>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div>
|
29
|
+
<label for="endpoint">DBPedia disambiguate REST endpoint.</label>
|
30
|
+
<br />
|
31
|
+
|
32
|
+
<input id="host" type="text" name="host" />
|
33
|
+
|
34
|
+
Example: http://nl.dbpedia.org/spotlight/rest/disambiguate
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<% 5.times do |number| %>
|
38
|
+
|
39
|
+
<div>
|
40
|
+
<label for="callbacks">Callback URL <%= number + 1 %> **</label>
|
41
|
+
<br />
|
42
|
+
|
43
|
+
<input id="callbacks" type="text" name="callbacks[]" />
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<% end %>
|
47
|
+
|
48
|
+
<div>
|
49
|
+
<label for="error_callback">Error Callback</label>
|
50
|
+
<br />
|
51
|
+
|
52
|
+
<input id="error_callback" type="text" name="error_callback" />
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<input type="submit" value="Submit" />
|
56
|
+
</form>
|
57
|
+
|
58
|
+
<h2>Actions</h2>
|
59
|
+
|
60
|
+
<dl>
|
61
|
+
<dt>GET /</dt>
|
62
|
+
<dd>Shows this page</dd>
|
63
|
+
|
64
|
+
<dt>POST /</dt>
|
65
|
+
<dd>Submits a KAF document</dd>
|
66
|
+
</dl>
|
67
|
+
|
68
|
+
<h2>Parameters</h2>
|
69
|
+
|
70
|
+
<dl>
|
71
|
+
<dt>text *</dt>
|
72
|
+
<dd>The KAF document to tag.</dd>
|
73
|
+
|
74
|
+
<dt>callbacks</dt>
|
75
|
+
<dd>A collection of callback URLs that are processed as a chain.</dd>
|
76
|
+
|
77
|
+
<dt>error_callback</dt>
|
78
|
+
<dd>Errors are submitted to this URL in the "error" field.</dd>
|
79
|
+
|
80
|
+
<dt>host</dt>
|
81
|
+
<dd>The hostname of the DBpedia Spotlight server.</dd>
|
82
|
+
|
83
|
+
<dt>port</dt>
|
84
|
+
<dd>The port number of the DBpedia Spotlight server.</dd>
|
85
|
+
</dl>
|
86
|
+
</body>
|
87
|
+
</html>
|
data/opener-ned.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path('../lib/opener/ned/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = 'opener-ned'
|
5
|
+
gem.version = Opener::Ned::VERSION
|
6
|
+
gem.authors = ['development@olery.com']
|
7
|
+
gem.summary = 'NED client using DBpedia'
|
8
|
+
gem.description = gem.summary
|
9
|
+
gem.has_rdoc = 'yard'
|
10
|
+
|
11
|
+
gem.required_ruby_version = '>= 1.9.2'
|
12
|
+
|
13
|
+
gem.files = Dir.glob([
|
14
|
+
'core/target/ehu-ned-*.jar',
|
15
|
+
'lib/**/*',
|
16
|
+
'*.gemspec',
|
17
|
+
'config.ru',
|
18
|
+
'README.md'
|
19
|
+
]).select { |file| File.file?(file) }
|
20
|
+
|
21
|
+
gem.executables = Dir.glob('bin/*').map { |file| File.basename(file) }
|
22
|
+
|
23
|
+
gem.add_dependency 'sinatra', '~> 1.4'
|
24
|
+
gem.add_dependency 'httpclient'
|
25
|
+
gem.add_dependency 'opener-webservice'
|
26
|
+
gem.add_dependency 'nokogiri'
|
27
|
+
|
28
|
+
gem.add_development_dependency 'opener-build-tools'
|
29
|
+
gem.add_development_dependency 'rake'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opener-ned
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- development@olery.com
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sinatra
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '1.4'
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httpclient
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
prerelease: false
|
40
|
+
type: :runtime
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: opener-webservice
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
prerelease: false
|
54
|
+
type: :runtime
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nokogiri
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
prerelease: false
|
68
|
+
type: :runtime
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: opener-build-tools
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
prerelease: false
|
82
|
+
type: :development
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
prerelease: false
|
96
|
+
type: :development
|
97
|
+
description: NED client using DBpedia
|
98
|
+
email:
|
99
|
+
executables:
|
100
|
+
- ned-server
|
101
|
+
- ned
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- core/target/ehu-ned-1.0.jar
|
106
|
+
- lib/opener/ned.rb
|
107
|
+
- lib/opener/ned/version.rb
|
108
|
+
- lib/opener/ned/server.rb
|
109
|
+
- lib/opener/ned/cli.rb
|
110
|
+
- lib/opener/ned/public/markdown.css
|
111
|
+
- lib/opener/ned/views/index.erb
|
112
|
+
- opener-ned.gemspec
|
113
|
+
- config.ru
|
114
|
+
- README.md
|
115
|
+
- bin/ned-server
|
116
|
+
- bin/ned
|
117
|
+
homepage:
|
118
|
+
licenses: []
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: 1.9.2
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.1.9
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: NED client using DBpedia
|
140
|
+
test_files: []
|
141
|
+
has_rdoc: yard
|