opener-constituent-parser 1.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 +30 -0
- data/bin/constituent-parser +7 -0
- data/bin/constituent-parser-server +10 -0
- data/config.ru +4 -0
- data/lib/opener/constituent_parser/cli.rb +86 -0
- data/lib/opener/constituent_parser/public/markdown.css +283 -0
- data/lib/opener/constituent_parser/server.rb +14 -0
- data/lib/opener/constituent_parser/version.rb +5 -0
- data/lib/opener/constituent_parser/views/index.erb +88 -0
- data/lib/opener/constituent_parser.rb +98 -0
- data/opener-constituent-parser.gemspec +27 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf9cb3d2b534265f6dc4d347f9ace8dcbd36f54e
|
4
|
+
data.tar.gz: 2c4ff4b9bea88aff427f4a570fa455f49501d344
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 83758c416f6aa1e05c899b0f6cc4be67a904d43328d357d2f5c8e649dbf4d3caa324669b3c473637ee2630d7089a4b4a6ee83eac10ebe70543c65b6243ac2ef6
|
7
|
+
data.tar.gz: db883a9e99c5e6200968b8bc23e3bbaee4dfad125f4484e2b2763a550833a7cc5f18a12da9da992900391f73464ccfd2cc90fbae5dcaead5f7d237c6caf1fd68
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Constituent Parser
|
2
|
+
|
3
|
+
This repository contains a constituent parser component that provides a CLI
|
4
|
+
interface and a webservice for the various constituent parser kernels.
|
5
|
+
|
6
|
+
## Requirements
|
7
|
+
|
8
|
+
* Ruby 1.9.2 or newer
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Installing as a regular Gem:
|
13
|
+
|
14
|
+
gem install opener-constituent-parser
|
15
|
+
|
16
|
+
Using Bundler:
|
17
|
+
|
18
|
+
gem 'opener-constituent-parser',
|
19
|
+
:git => 'git@github.com:opener-project/constituent-parser.git',
|
20
|
+
:branch => 'master'
|
21
|
+
|
22
|
+
Using specific install:
|
23
|
+
|
24
|
+
gem install specific_install
|
25
|
+
gem specific_install opener-constituent-parser \
|
26
|
+
-l https://github.com/opener-project/constituent-parser.git
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
cat some_input_file.kaf | constituent-parser -l en
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../lib/opener/constituent_parser/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
@@ -0,0 +1,86 @@
|
|
1
|
+
module Opener
|
2
|
+
class ConstituentParser
|
3
|
+
##
|
4
|
+
# CLI wrapper around {Opener::ConstituentParser} 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 = 'constituent-parser'
|
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(
|
33
|
+
'-l',
|
34
|
+
'--language [VALUE]',
|
35
|
+
'Uses this specific language'
|
36
|
+
) do |value|
|
37
|
+
@options[:language] = 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} -l nl
|
46
|
+
EOF
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# @param [String] input
|
52
|
+
#
|
53
|
+
def run(input)
|
54
|
+
option_parser.parse!(options[:args])
|
55
|
+
|
56
|
+
runner = ConstituentParser.new(options)
|
57
|
+
|
58
|
+
stdout, stderr, process = runner.run(input)
|
59
|
+
|
60
|
+
if process.success?
|
61
|
+
puts stdout
|
62
|
+
|
63
|
+
STDERR.puts(stderr) unless stderr.empty?
|
64
|
+
else
|
65
|
+
abort stderr
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
##
|
72
|
+
# Shows the help message and exits the program.
|
73
|
+
#
|
74
|
+
def show_help
|
75
|
+
abort option_parser.to_s
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# Shows the version and exits the program.
|
80
|
+
#
|
81
|
+
def show_version
|
82
|
+
abort "#{option_parser.program_name} v#{VERSION} on #{RUBY_DESCRIPTION}"
|
83
|
+
end
|
84
|
+
end # CLI
|
85
|
+
end # ConstituentParser
|
86
|
+
end # Opener
|
@@ -0,0 +1,283 @@
|
|
1
|
+
input[type="text"], textarea
|
2
|
+
{
|
3
|
+
width: 500px;
|
4
|
+
}
|
5
|
+
|
6
|
+
body {
|
7
|
+
font-family: Helvetica, arial, sans-serif;
|
8
|
+
font-size: 14px;
|
9
|
+
line-height: 1.6;
|
10
|
+
padding-top: 10px;
|
11
|
+
padding-bottom: 10px;
|
12
|
+
background-color: white;
|
13
|
+
padding: 30px; }
|
14
|
+
|
15
|
+
body > *:first-child {
|
16
|
+
margin-top: 0 !important; }
|
17
|
+
body > *:last-child {
|
18
|
+
margin-bottom: 0 !important; }
|
19
|
+
|
20
|
+
a {
|
21
|
+
color: #4183C4; }
|
22
|
+
a.absent {
|
23
|
+
color: #cc0000; }
|
24
|
+
a.anchor {
|
25
|
+
display: block;
|
26
|
+
padding-left: 30px;
|
27
|
+
margin-left: -30px;
|
28
|
+
cursor: pointer;
|
29
|
+
position: absolute;
|
30
|
+
top: 0;
|
31
|
+
left: 0;
|
32
|
+
bottom: 0; }
|
33
|
+
|
34
|
+
h1, h2, h3, h4, h5, h6 {
|
35
|
+
margin: 20px 0 10px;
|
36
|
+
padding: 0;
|
37
|
+
font-weight: bold;
|
38
|
+
-webkit-font-smoothing: antialiased;
|
39
|
+
cursor: text;
|
40
|
+
position: relative; }
|
41
|
+
|
42
|
+
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor {
|
43
|
+
background: url("../../images/modules/styleguide/para.png") no-repeat 10px center;
|
44
|
+
text-decoration: none; }
|
45
|
+
|
46
|
+
h1 tt, h1 code {
|
47
|
+
font-size: inherit; }
|
48
|
+
|
49
|
+
h2 tt, h2 code {
|
50
|
+
font-size: inherit; }
|
51
|
+
|
52
|
+
h3 tt, h3 code {
|
53
|
+
font-size: inherit; }
|
54
|
+
|
55
|
+
h4 tt, h4 code {
|
56
|
+
font-size: inherit; }
|
57
|
+
|
58
|
+
h5 tt, h5 code {
|
59
|
+
font-size: inherit; }
|
60
|
+
|
61
|
+
h6 tt, h6 code {
|
62
|
+
font-size: inherit; }
|
63
|
+
|
64
|
+
h1 {
|
65
|
+
font-size: 28px;
|
66
|
+
color: black; }
|
67
|
+
|
68
|
+
h2 {
|
69
|
+
font-size: 24px;
|
70
|
+
border-bottom: 1px solid #cccccc;
|
71
|
+
color: black; }
|
72
|
+
|
73
|
+
h3 {
|
74
|
+
font-size: 18px; }
|
75
|
+
|
76
|
+
h4 {
|
77
|
+
font-size: 16px; }
|
78
|
+
|
79
|
+
h5 {
|
80
|
+
font-size: 14px; }
|
81
|
+
|
82
|
+
h6 {
|
83
|
+
color: #777777;
|
84
|
+
font-size: 14px; }
|
85
|
+
|
86
|
+
p, blockquote, ul, ol, dl, li, table, pre {
|
87
|
+
margin: 15px 0; }
|
88
|
+
|
89
|
+
hr {
|
90
|
+
background: transparent url("../../images/modules/pulls/dirty-shade.png") repeat-x 0 0;
|
91
|
+
border: 0 none;
|
92
|
+
color: #cccccc;
|
93
|
+
height: 4px;
|
94
|
+
padding: 0; }
|
95
|
+
|
96
|
+
body > h2:first-child {
|
97
|
+
margin-top: 0;
|
98
|
+
padding-top: 0; }
|
99
|
+
body > h1:first-child {
|
100
|
+
margin-top: 0;
|
101
|
+
padding-top: 0; }
|
102
|
+
body > h1:first-child + h2 {
|
103
|
+
margin-top: 0;
|
104
|
+
padding-top: 0; }
|
105
|
+
body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child {
|
106
|
+
margin-top: 0;
|
107
|
+
padding-top: 0; }
|
108
|
+
|
109
|
+
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
|
110
|
+
margin-top: 0;
|
111
|
+
padding-top: 0; }
|
112
|
+
|
113
|
+
h1 p, h2 p, h3 p, h4 p, h5 p, h6 p {
|
114
|
+
margin-top: 0; }
|
115
|
+
|
116
|
+
li p.first {
|
117
|
+
display: inline-block; }
|
118
|
+
|
119
|
+
ul, ol {
|
120
|
+
padding-left: 30px; }
|
121
|
+
|
122
|
+
ul :first-child, ol :first-child {
|
123
|
+
margin-top: 0; }
|
124
|
+
|
125
|
+
ul :last-child, ol :last-child {
|
126
|
+
margin-bottom: 0; }
|
127
|
+
|
128
|
+
dl {
|
129
|
+
padding: 0; }
|
130
|
+
dl dt {
|
131
|
+
font-size: 14px;
|
132
|
+
font-weight: bold;
|
133
|
+
font-style: italic;
|
134
|
+
padding: 0;
|
135
|
+
margin: 15px 0 5px; }
|
136
|
+
dl dt:first-child {
|
137
|
+
padding: 0; }
|
138
|
+
dl dt > :first-child {
|
139
|
+
margin-top: 0; }
|
140
|
+
dl dt > :last-child {
|
141
|
+
margin-bottom: 0; }
|
142
|
+
dl dd {
|
143
|
+
margin: 0 0 15px;
|
144
|
+
padding: 0 15px; }
|
145
|
+
dl dd > :first-child {
|
146
|
+
margin-top: 0; }
|
147
|
+
dl dd > :last-child {
|
148
|
+
margin-bottom: 0; }
|
149
|
+
|
150
|
+
blockquote {
|
151
|
+
border-left: 4px solid #dddddd;
|
152
|
+
padding: 0 15px;
|
153
|
+
color: #777777; }
|
154
|
+
blockquote > :first-child {
|
155
|
+
margin-top: 0; }
|
156
|
+
blockquote > :last-child {
|
157
|
+
margin-bottom: 0; }
|
158
|
+
|
159
|
+
table {
|
160
|
+
padding: 0; }
|
161
|
+
table tr {
|
162
|
+
border-top: 1px solid #cccccc;
|
163
|
+
background-color: white;
|
164
|
+
margin: 0;
|
165
|
+
padding: 0; }
|
166
|
+
table tr:nth-child(2n) {
|
167
|
+
background-color: #f8f8f8; }
|
168
|
+
table tr th {
|
169
|
+
font-weight: bold;
|
170
|
+
border: 1px solid #cccccc;
|
171
|
+
text-align: left;
|
172
|
+
margin: 0;
|
173
|
+
padding: 6px 13px; }
|
174
|
+
table tr td {
|
175
|
+
border: 1px solid #cccccc;
|
176
|
+
text-align: left;
|
177
|
+
margin: 0;
|
178
|
+
padding: 6px 13px; }
|
179
|
+
table tr th :first-child, table tr td :first-child {
|
180
|
+
margin-top: 0; }
|
181
|
+
table tr th :last-child, table tr td :last-child {
|
182
|
+
margin-bottom: 0; }
|
183
|
+
|
184
|
+
img {
|
185
|
+
max-width: 100%; }
|
186
|
+
|
187
|
+
span.frame {
|
188
|
+
display: block;
|
189
|
+
overflow: hidden; }
|
190
|
+
span.frame > span {
|
191
|
+
border: 1px solid #dddddd;
|
192
|
+
display: block;
|
193
|
+
float: left;
|
194
|
+
overflow: hidden;
|
195
|
+
margin: 13px 0 0;
|
196
|
+
padding: 7px;
|
197
|
+
width: auto; }
|
198
|
+
span.frame span img {
|
199
|
+
display: block;
|
200
|
+
float: left; }
|
201
|
+
span.frame span span {
|
202
|
+
clear: both;
|
203
|
+
color: #333333;
|
204
|
+
display: block;
|
205
|
+
padding: 5px 0 0; }
|
206
|
+
span.align-center {
|
207
|
+
display: block;
|
208
|
+
overflow: hidden;
|
209
|
+
clear: both; }
|
210
|
+
span.align-center > span {
|
211
|
+
display: block;
|
212
|
+
overflow: hidden;
|
213
|
+
margin: 13px auto 0;
|
214
|
+
text-align: center; }
|
215
|
+
span.align-center span img {
|
216
|
+
margin: 0 auto;
|
217
|
+
text-align: center; }
|
218
|
+
span.align-right {
|
219
|
+
display: block;
|
220
|
+
overflow: hidden;
|
221
|
+
clear: both; }
|
222
|
+
span.align-right > span {
|
223
|
+
display: block;
|
224
|
+
overflow: hidden;
|
225
|
+
margin: 13px 0 0;
|
226
|
+
text-align: right; }
|
227
|
+
span.align-right span img {
|
228
|
+
margin: 0;
|
229
|
+
text-align: right; }
|
230
|
+
span.float-left {
|
231
|
+
display: block;
|
232
|
+
margin-right: 13px;
|
233
|
+
overflow: hidden;
|
234
|
+
float: left; }
|
235
|
+
span.float-left span {
|
236
|
+
margin: 13px 0 0; }
|
237
|
+
span.float-right {
|
238
|
+
display: block;
|
239
|
+
margin-left: 13px;
|
240
|
+
overflow: hidden;
|
241
|
+
float: right; }
|
242
|
+
span.float-right > span {
|
243
|
+
display: block;
|
244
|
+
overflow: hidden;
|
245
|
+
margin: 13px auto 0;
|
246
|
+
text-align: right; }
|
247
|
+
|
248
|
+
code, tt {
|
249
|
+
margin: 0 2px;
|
250
|
+
padding: 0 5px;
|
251
|
+
white-space: nowrap;
|
252
|
+
border: 1px solid #eaeaea;
|
253
|
+
background-color: #f8f8f8;
|
254
|
+
border-radius: 3px; }
|
255
|
+
|
256
|
+
pre code {
|
257
|
+
margin: 0;
|
258
|
+
padding: 0;
|
259
|
+
white-space: pre;
|
260
|
+
border: none;
|
261
|
+
background: transparent; }
|
262
|
+
|
263
|
+
.highlight pre {
|
264
|
+
background-color: #f8f8f8;
|
265
|
+
border: 1px solid #cccccc;
|
266
|
+
font-size: 13px;
|
267
|
+
line-height: 19px;
|
268
|
+
overflow: auto;
|
269
|
+
padding: 6px 10px;
|
270
|
+
border-radius: 3px; }
|
271
|
+
|
272
|
+
pre {
|
273
|
+
background-color: #f8f8f8;
|
274
|
+
border: 1px solid #cccccc;
|
275
|
+
font-size: 13px;
|
276
|
+
line-height: 19px;
|
277
|
+
overflow: auto;
|
278
|
+
padding: 6px 10px;
|
279
|
+
border-radius: 3px; }
|
280
|
+
pre code, pre tt {
|
281
|
+
background-color: transparent;
|
282
|
+
border: none; }
|
283
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'opener/webservice'
|
2
|
+
|
3
|
+
module Opener
|
4
|
+
class ConstituentParser
|
5
|
+
##
|
6
|
+
# Constituent parser server powered by Sinatra.
|
7
|
+
#
|
8
|
+
class Server < Webservice
|
9
|
+
set :views, File.expand_path('../views', __FILE__)
|
10
|
+
text_processor ConstituentParser
|
11
|
+
accepted_params :input, :language
|
12
|
+
end # Server
|
13
|
+
end # ConstituentParser
|
14
|
+
end # Opener
|
@@ -0,0 +1,88 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link type="text/css" rel="stylesheet" href="markdown.css" />
|
5
|
+
|
6
|
+
<title>Constituent Parser Webservice</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<h1>Constituent Parser Webservice</h1>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
* required
|
13
|
+
|
14
|
+
<br />
|
15
|
+
|
16
|
+
** When entering a value no response will be displayed in the browser.
|
17
|
+
</p>
|
18
|
+
|
19
|
+
<form action="/" method="POST">
|
20
|
+
<div>
|
21
|
+
<label for="input">KAF input *</label>
|
22
|
+
<br />
|
23
|
+
|
24
|
+
<textarea id="input" name="input" cols="50" rows="10"></textarea>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div>
|
28
|
+
<label for="language">Language</label>
|
29
|
+
<br />
|
30
|
+
|
31
|
+
<select id="language" name="language">
|
32
|
+
<option value="nl">Dutch</option>
|
33
|
+
<option value="en">English</option>
|
34
|
+
<option value="fr">French</option>
|
35
|
+
<option value="de">German</option>
|
36
|
+
<option value="it">Italian</option>
|
37
|
+
<option value="es">Spanish</option>
|
38
|
+
</select>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<% 5.times do |number| %>
|
42
|
+
|
43
|
+
<div>
|
44
|
+
<label for="callbacks">Callback URL <%= number + 1%> **</label>
|
45
|
+
<br />
|
46
|
+
|
47
|
+
<input id="callbacks" type="text" name="callbacks[]" />
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<% end %>
|
51
|
+
|
52
|
+
<div>
|
53
|
+
<label for="error_callback">Error Callback</label>
|
54
|
+
<br />
|
55
|
+
|
56
|
+
<input id="error_callback" type="text" name="error_callback" />
|
57
|
+
</div>
|
58
|
+
|
59
|
+
<input type="submit" value="Submit" />
|
60
|
+
</form>
|
61
|
+
|
62
|
+
<h2>Actions</h2>
|
63
|
+
|
64
|
+
<dl>
|
65
|
+
<dt>GET /</dt>
|
66
|
+
<dd>Shows this page</dd>
|
67
|
+
|
68
|
+
<dt>POST /</dt>
|
69
|
+
<dd>Submits a KAF document</dd>
|
70
|
+
</dl>
|
71
|
+
|
72
|
+
<h2>Parameters</h2>
|
73
|
+
|
74
|
+
<dl>
|
75
|
+
<dt>text *</dt>
|
76
|
+
<dd>The KAF document to process.</dd>
|
77
|
+
|
78
|
+
<dt>language</dt>
|
79
|
+
<dd>The language (code) to use, e.g. "en" or "fr".</dd>
|
80
|
+
|
81
|
+
<dt>callbacks</dt>
|
82
|
+
<dd>A collection of callback URLs that are processed as a chain.</dd>
|
83
|
+
|
84
|
+
<dt>error_callback</dt>
|
85
|
+
<dd>Errors are submitted to this URL in the "error" field.</dd>
|
86
|
+
</dl>
|
87
|
+
</body>
|
88
|
+
</html>
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'open3'
|
2
|
+
require 'optparse'
|
3
|
+
require 'opener/constituent_parsers/base'
|
4
|
+
|
5
|
+
require_relative 'constituent_parser/version'
|
6
|
+
require_relative 'constituent_parser/cli'
|
7
|
+
|
8
|
+
module Opener
|
9
|
+
##
|
10
|
+
# Constituent parser for various languages such as English and German.
|
11
|
+
#
|
12
|
+
# @!attribute [r] options
|
13
|
+
# @return [Hash]
|
14
|
+
#
|
15
|
+
class ConstituentParser
|
16
|
+
attr_reader :options
|
17
|
+
|
18
|
+
##
|
19
|
+
# Returns the default language to use.
|
20
|
+
#
|
21
|
+
# @return [String]
|
22
|
+
#
|
23
|
+
DEFAULT_LANGUAGE = 'en'.freeze
|
24
|
+
|
25
|
+
##
|
26
|
+
# Hash containing the default options to use.
|
27
|
+
#
|
28
|
+
# @return [Hash]
|
29
|
+
#
|
30
|
+
DEFAULT_OPTIONS = {
|
31
|
+
:args => [],
|
32
|
+
:language => DEFAULT_LANGUAGE
|
33
|
+
}.freeze
|
34
|
+
|
35
|
+
##
|
36
|
+
# @param [Hash] options
|
37
|
+
# @see Opener::ConstituentParsers::Base#initialize
|
38
|
+
#
|
39
|
+
def initialize(options = {})
|
40
|
+
@options = DEFAULT_OPTIONS.merge(options)
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Processes the input and returns an array containing the output of STDOUT,
|
45
|
+
# STDERR and an object containing process information.
|
46
|
+
#
|
47
|
+
# @param [String] input
|
48
|
+
# @return [Array]
|
49
|
+
#
|
50
|
+
def run(input)
|
51
|
+
args = options[:args].dup
|
52
|
+
|
53
|
+
if language_constant_defined?
|
54
|
+
kernel = language_constant.new(:args => args)
|
55
|
+
else
|
56
|
+
kernel = ConstituentParsers::Base.new(
|
57
|
+
:args => args,
|
58
|
+
:language => options[:language]
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
return kernel.run(input)
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# @return [String]
|
67
|
+
#
|
68
|
+
def output_type
|
69
|
+
return 'text/plain'
|
70
|
+
end
|
71
|
+
|
72
|
+
protected
|
73
|
+
|
74
|
+
|
75
|
+
##
|
76
|
+
# Returns `true` if the current language has a dedicated kernel class.
|
77
|
+
#
|
78
|
+
# @return [TrueClass|FalseClass]
|
79
|
+
#
|
80
|
+
def language_constant_defined?
|
81
|
+
return ConstituentParsers.const_defined?(language_constant_name)
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# @return [String]
|
86
|
+
#
|
87
|
+
def language_constant_name
|
88
|
+
return options[:language].upcase
|
89
|
+
end
|
90
|
+
|
91
|
+
##
|
92
|
+
# @return [Class]
|
93
|
+
#
|
94
|
+
def language_constant
|
95
|
+
return ConstituentParsers.const_get(language_constant_name)
|
96
|
+
end
|
97
|
+
end # ConstituentParser
|
98
|
+
end # Opener
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path('../lib/opener/constituent_parser/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = 'opener-constituent-parser'
|
5
|
+
gem.version = Opener::ConstituentParser::VERSION
|
6
|
+
gem.authors = ['development@olery.com']
|
7
|
+
gem.summary = 'Constituent parser including a webservice.'
|
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
|
+
'lib/**/*.*',
|
15
|
+
'*.gemspec',
|
16
|
+
'README.md',
|
17
|
+
'config.ru'
|
18
|
+
])
|
19
|
+
|
20
|
+
gem.executables = Dir.glob('bin/*').map { |f| File.basename(f) }
|
21
|
+
|
22
|
+
gem.add_dependency 'opener-webservice'
|
23
|
+
gem.add_dependency 'opener-constituent-parser-base', '>= 0.1.0'
|
24
|
+
|
25
|
+
gem.add_development_dependency 'opener-build-tools'
|
26
|
+
gem.add_development_dependency 'rake'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opener-constituent-parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.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: opener-webservice
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opener-constituent-parser-base
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: opener-build-tools
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Constituent parser including a webservice.
|
70
|
+
email:
|
71
|
+
executables:
|
72
|
+
- constituent-parser
|
73
|
+
- constituent-parser-server
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- README.md
|
78
|
+
- bin/constituent-parser
|
79
|
+
- bin/constituent-parser-server
|
80
|
+
- config.ru
|
81
|
+
- lib/opener/constituent_parser.rb
|
82
|
+
- lib/opener/constituent_parser/cli.rb
|
83
|
+
- lib/opener/constituent_parser/public/markdown.css
|
84
|
+
- lib/opener/constituent_parser/server.rb
|
85
|
+
- lib/opener/constituent_parser/version.rb
|
86
|
+
- lib/opener/constituent_parser/views/index.erb
|
87
|
+
- opener-constituent-parser.gemspec
|
88
|
+
homepage:
|
89
|
+
licenses: []
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.9.2
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.2.2
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Constituent parser including a webservice.
|
111
|
+
test_files: []
|
112
|
+
has_rdoc: yard
|