opener-constituent-parser-nl 0.1.1
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 +41 -0
- data/bin/constituent-parser-nl +15 -0
- data/core/alpino_parser.py +212 -0
- data/core/convert_penn_to_kaf.py +161 -0
- data/core/convert_penn_to_kaf.pyc +0 -0
- data/core/convert_penn_to_kaf.pyo +0 -0
- data/core/tree.py +1438 -0
- data/core/tree.pyc +0 -0
- data/core/tree.pyo +0 -0
- data/ext/hack/Rakefile +8 -0
- data/lib/opener/constituent_parsers/nl.rb +93 -0
- data/lib/opener/constituent_parsers/nl/version.rb +7 -0
- data/opener-constituent-parser-nl.gemspec +32 -0
- data/pre_install_requirements.txt +1 -0
- data/task/compile.rake +2 -0
- data/task/python.rake +11 -0
- data/task/requirements.rake +8 -0
- data/task/test.rake +4 -0
- metadata +132 -0
data/core/tree.pyc
ADDED
Binary file
|
data/core/tree.pyo
ADDED
Binary file
|
data/ext/hack/Rakefile
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
import File.expand_path('../../../task/requirements.rake', __FILE__)
|
2
|
+
import File.expand_path('../../../task/python.rake', __FILE__)
|
3
|
+
|
4
|
+
task :default => :requirements do
|
5
|
+
Dir.chdir(File.expand_path('../../../', __FILE__)) do
|
6
|
+
Rake::Task['core/site-packages/pre_install'].invoke
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
require_relative 'nl/version'
|
5
|
+
|
6
|
+
module Opener
|
7
|
+
module ConstituentParsers
|
8
|
+
|
9
|
+
##
|
10
|
+
# The constituent parser that supports Dutch.
|
11
|
+
#
|
12
|
+
# @!attribute [r] args
|
13
|
+
# @return [Array]
|
14
|
+
#
|
15
|
+
# @!attribute [r] options
|
16
|
+
# @return [Hash]
|
17
|
+
#
|
18
|
+
class NL
|
19
|
+
attr_reader :args, :options
|
20
|
+
|
21
|
+
##
|
22
|
+
# @param [Hash] options
|
23
|
+
#
|
24
|
+
# @option options [Array] :args Extra commandline arguments to use.
|
25
|
+
#
|
26
|
+
def initialize(options = {})
|
27
|
+
@args = options.delete(:args) || []
|
28
|
+
@options = options
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# Builds the command used to execute the kernel.
|
33
|
+
#
|
34
|
+
# @param [Array] args Commandline arguments passed to the command.
|
35
|
+
#
|
36
|
+
def command
|
37
|
+
return "#{adjust_python_path} python -OO #{kernel} #{args.join(' ')}"
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# Runs the command and returns the output of STDOUT, STDERR and the
|
42
|
+
# process information.
|
43
|
+
#
|
44
|
+
# @param [String] input The input to tag.
|
45
|
+
# @return [Array]
|
46
|
+
#
|
47
|
+
def run(input)
|
48
|
+
stdout, stderr, process = capture(input)
|
49
|
+
raise stderr unless process.success?
|
50
|
+
return stdout, stderr, process
|
51
|
+
end
|
52
|
+
|
53
|
+
protected
|
54
|
+
|
55
|
+
##
|
56
|
+
# @return [String]
|
57
|
+
#
|
58
|
+
def adjust_python_path
|
59
|
+
site_packages = File.join(core_dir, 'site-packages/pre_install')
|
60
|
+
|
61
|
+
return "env PYTHONPATH=#{site_packages}:$PYTHONPATH"
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# capture3 method doesn't work properly with Jruby, so
|
66
|
+
# this is a workaround
|
67
|
+
#
|
68
|
+
def capture(input)
|
69
|
+
Open3.popen3(*command.split(" ")) {|i, o, e, t|
|
70
|
+
out_reader = Thread.new { o.read }
|
71
|
+
err_reader = Thread.new { e.read }
|
72
|
+
i.write input
|
73
|
+
i.close
|
74
|
+
[out_reader.value, err_reader.value, t.value]
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# @return [String]
|
80
|
+
#
|
81
|
+
def core_dir
|
82
|
+
return File.expand_path('../../../../core', __FILE__)
|
83
|
+
end
|
84
|
+
|
85
|
+
##
|
86
|
+
# @return [String]
|
87
|
+
#
|
88
|
+
def kernel
|
89
|
+
return File.join(core_dir, 'alpino_parser.py')
|
90
|
+
end
|
91
|
+
end # NL
|
92
|
+
end # ConstituentParsers
|
93
|
+
end # Opener
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path('../lib/opener/constituent_parsers/nl/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = 'opener-constituent-parser-nl'
|
5
|
+
gem.version = Opener::ConstituentParsers::NL::VERSION
|
6
|
+
gem.authors = ['development@olery.com']
|
7
|
+
gem.summary = 'Constituent Parser for dutch using Alpino.'
|
8
|
+
gem.description = gem.summary
|
9
|
+
gem.homepage = 'http://opener-project.github.com/'
|
10
|
+
gem.extensions = ['ext/hack/Rakefile']
|
11
|
+
|
12
|
+
gem.required_ruby_version = '>= 1.9.2'
|
13
|
+
|
14
|
+
gem.files = Dir.glob([
|
15
|
+
'core/*',
|
16
|
+
'ext/**/*',
|
17
|
+
'lib/**/*',
|
18
|
+
'*.gemspec',
|
19
|
+
'*_requirements.txt',
|
20
|
+
'README.md',
|
21
|
+
'task/*'
|
22
|
+
]).select { |file| File.file?(file) }
|
23
|
+
|
24
|
+
gem.executables = Dir.glob('bin/*').map { |file| File.basename(file) }
|
25
|
+
|
26
|
+
gem.add_dependency 'rake'
|
27
|
+
gem.add_dependency 'nokogiri'
|
28
|
+
gem.add_dependency 'cliver'
|
29
|
+
|
30
|
+
gem.add_development_dependency 'rspec', '~> 3.0'
|
31
|
+
gem.add_development_dependency 'cucumber'
|
32
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
https://github.com/opener-project/VU-kaf-parser/archive/v1.1.zip#egg=VUKafParserPy
|
data/task/compile.rake
ADDED
data/task/python.rake
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# NOTE: pre_build/pre_install directories are created by pip.
|
2
|
+
|
3
|
+
directory 'core/site-packages/pre_install' do |task|
|
4
|
+
sh "pip install --requirement=pre_install_requirements.txt " \
|
5
|
+
"--target=#{task.name} --ignore-installed"
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :python do
|
9
|
+
desc 'Installs Python packages in a local directory'
|
10
|
+
task :compile => ['core/site-packages/pre_install']
|
11
|
+
end
|
data/task/test.rake
ADDED
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opener-constituent-parser-nl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- development@olery.com
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0'
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
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: cliver
|
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: rspec
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '3.0'
|
67
|
+
prerelease: false
|
68
|
+
type: :development
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: cucumber
|
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
|
+
description: Constituent Parser for dutch using Alpino.
|
84
|
+
email:
|
85
|
+
executables:
|
86
|
+
- constituent-parser-nl
|
87
|
+
extensions:
|
88
|
+
- ext/hack/Rakefile
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- README.md
|
92
|
+
- bin/constituent-parser-nl
|
93
|
+
- core/alpino_parser.py
|
94
|
+
- core/convert_penn_to_kaf.py
|
95
|
+
- core/convert_penn_to_kaf.pyc
|
96
|
+
- core/convert_penn_to_kaf.pyo
|
97
|
+
- core/tree.py
|
98
|
+
- core/tree.pyc
|
99
|
+
- core/tree.pyo
|
100
|
+
- ext/hack/Rakefile
|
101
|
+
- lib/opener/constituent_parsers/nl.rb
|
102
|
+
- lib/opener/constituent_parsers/nl/version.rb
|
103
|
+
- opener-constituent-parser-nl.gemspec
|
104
|
+
- pre_install_requirements.txt
|
105
|
+
- task/compile.rake
|
106
|
+
- task/python.rake
|
107
|
+
- task/requirements.rake
|
108
|
+
- task/test.rake
|
109
|
+
homepage: http://opener-project.github.com/
|
110
|
+
licenses: []
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 1.9.2
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.2.2
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: Constituent Parser for dutch using Alpino.
|
132
|
+
test_files: []
|