opener-ner-base 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +77 -0
- data/bin/ner-de +8 -0
- data/bin/ner-en +8 -0
- data/bin/ner-es +8 -0
- data/bin/ner-fr +8 -0
- data/bin/ner-it +8 -0
- data/bin/ner-nl +8 -0
- data/core/target/ehu-nerc-1.0.jar +0 -0
- data/lib/opener/ners/base.rb +64 -0
- data/lib/opener/ners/base/version.rb +7 -0
- data/opener-ner-base.gemspec +25 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8b12de8ee2e71e39bfa794f3a348fecd60c8c9a8
|
4
|
+
data.tar.gz: 4d47bc08a613b62ff3a68a84546266ef934c88b1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bc5a4b1aaed45611d5653fe1a98c83b16de04b949d12881d8a6805073a7bfdede4a020200dcb0b6a314e27bf00f5450f78aa6aea7149377a71d5a36162084b58
|
7
|
+
data.tar.gz: 5a2d575e5628db0f3fd7b845690f5d553759437dec59df627700f7010e8ce303eddcc4e59dc5a6ff97274f395e1b0b13fad8cf4d2cba2b14ca894ce519220130
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
[![Build Status](https://drone.io/github.com/opener-project/ner-base/status.png)](https://drone.io/github.com/opener-project/ner-base/latest)
|
2
|
+
|
3
|
+
# NER Base
|
4
|
+
|
5
|
+
This repository contains the source code used for performing Named Entity
|
6
|
+
Recognition for the following languages:
|
7
|
+
|
8
|
+
* Dutch
|
9
|
+
* English
|
10
|
+
* German
|
11
|
+
* Italian
|
12
|
+
* Spanish
|
13
|
+
* French
|
14
|
+
|
15
|
+
## Requirements
|
16
|
+
|
17
|
+
* Java 1.7 or newer
|
18
|
+
* Ruby 1.9.2 or newer
|
19
|
+
|
20
|
+
Development requirements:
|
21
|
+
|
22
|
+
* Maven
|
23
|
+
* Bundler
|
24
|
+
|
25
|
+
## Installation
|
26
|
+
|
27
|
+
Installing as a regular Gem:
|
28
|
+
|
29
|
+
gem install opener-ner-base
|
30
|
+
|
31
|
+
Using Bundler:
|
32
|
+
|
33
|
+
gem 'opener-ner-base',
|
34
|
+
:git => 'git@github.com:opener-project/ner-base.git',
|
35
|
+
:branch => 'master'
|
36
|
+
|
37
|
+
Using specific install:
|
38
|
+
|
39
|
+
gem install specific_install
|
40
|
+
gem specific_install opener-ner-base \
|
41
|
+
-l https://github.com/opener-project/ner-base.git
|
42
|
+
|
43
|
+
## Usage
|
44
|
+
|
45
|
+
cat some_input_file.kaf | ner-en
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
First make sure all the required dependencies are installed:
|
50
|
+
|
51
|
+
bundle install
|
52
|
+
|
53
|
+
Then compile the required Java code:
|
54
|
+
|
55
|
+
bundle exec rake compile
|
56
|
+
|
57
|
+
For this you'll need to have Java 1.7 and Maven installed. These requirements
|
58
|
+
are verified for you before the Rake task calls Maven.
|
59
|
+
|
60
|
+
## Testing
|
61
|
+
|
62
|
+
To run the tests (which are powered by Cucumber), simply run the following:
|
63
|
+
|
64
|
+
bundle exec rake
|
65
|
+
|
66
|
+
This will take care of verifying the requirements, installing the required Java
|
67
|
+
packages and running the tests.
|
68
|
+
|
69
|
+
For more information on the available Rake tasks run the following:
|
70
|
+
|
71
|
+
bundle exec rake -T
|
72
|
+
|
73
|
+
## Structure
|
74
|
+
|
75
|
+
This repository comes in two parts: a collection of Java source files and Ruby
|
76
|
+
source files. The Java code can be found in the `core/` directory, everything
|
77
|
+
else will be Ruby source code.
|
data/bin/ner-de
ADDED
data/bin/ner-en
ADDED
data/bin/ner-es
ADDED
data/bin/ner-fr
ADDED
data/bin/ner-it
ADDED
data/bin/ner-nl
ADDED
Binary file
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'open3'
|
2
|
+
require 'java'
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
require File.expand_path("../../../../core/target/ehu-nerc-1.0.jar", __FILE__)
|
6
|
+
import 'ehu.nerc.Annotate'
|
7
|
+
import 'ixa.kaflib.KAFDocument'
|
8
|
+
import 'java.io.InputStreamReader'
|
9
|
+
|
10
|
+
require_relative 'base/version'
|
11
|
+
|
12
|
+
module Opener
|
13
|
+
module Ners
|
14
|
+
##
|
15
|
+
# Base NER class that supports various languages such as Dutch and English.
|
16
|
+
#
|
17
|
+
# @!attribute [r] args
|
18
|
+
# @return [Array]
|
19
|
+
# @!attribute [r] options
|
20
|
+
# @return [Hash]
|
21
|
+
#
|
22
|
+
class Base
|
23
|
+
attr_reader :args, :options
|
24
|
+
|
25
|
+
##
|
26
|
+
# @param [Hash] options
|
27
|
+
#
|
28
|
+
# @option options [Array] :args The commandline arguments to pass to the
|
29
|
+
# underlying Java code.
|
30
|
+
#
|
31
|
+
def initialize(options = {})
|
32
|
+
@args = options.delete(:args) || []
|
33
|
+
@options = options
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# Runs the command and returns the output of STDOUT, STDERR and the
|
38
|
+
# process information.
|
39
|
+
#
|
40
|
+
# @param [String] input The input to process.
|
41
|
+
# @return [Array]
|
42
|
+
#
|
43
|
+
def run(input)
|
44
|
+
input = StringIO.new(input) unless input.kind_of?(IO)
|
45
|
+
annotator = Java::ehu.nerc.Annotate.new(language)
|
46
|
+
reader = InputStreamReader.new(input.to_inputstream)
|
47
|
+
kaf = KAFDocument.create_from_stream(reader)
|
48
|
+
|
49
|
+
kaf.add_linguistic_processor("entities","ehu-nerc-"+language,"now","1.0")
|
50
|
+
annotator.annotateNEsToKAF(kaf)
|
51
|
+
|
52
|
+
return kaf.to_string
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# @return [String]
|
57
|
+
#
|
58
|
+
def language
|
59
|
+
return options[:language]
|
60
|
+
end
|
61
|
+
|
62
|
+
end # Base
|
63
|
+
end # Ners
|
64
|
+
end # Opener
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path('../lib/opener/ners/base/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = 'opener-ner-base'
|
5
|
+
gem.version = Opener::Ners::Base::VERSION
|
6
|
+
gem.authors = ['development@olery.com']
|
7
|
+
gem.summary = 'Base NER component for languages such as English.'
|
8
|
+
gem.description = gem.summary
|
9
|
+
gem.homepage = 'http://opener-project.github.com/'
|
10
|
+
|
11
|
+
gem.files = Dir.glob([
|
12
|
+
'core/target/ehu-nerc-*.jar',
|
13
|
+
'lib/**/*',
|
14
|
+
'*.gemspec',
|
15
|
+
'README.md'
|
16
|
+
]).select { |file| File.file?(file) }
|
17
|
+
|
18
|
+
gem.executables = Dir.glob('bin/*').map { |file| File.basename(file) }
|
19
|
+
|
20
|
+
gem.add_dependency 'opener-build-tools'
|
21
|
+
|
22
|
+
gem.add_development_dependency 'rspec'
|
23
|
+
gem.add_development_dependency 'cucumber'
|
24
|
+
gem.add_development_dependency 'rake'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opener-ner-base
|
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: opener-build-tools
|
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: rspec
|
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: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cucumber
|
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: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
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: :development
|
69
|
+
description: Base NER component for languages such as English.
|
70
|
+
email:
|
71
|
+
executables:
|
72
|
+
- ner-nl
|
73
|
+
- ner-it
|
74
|
+
- ner-es
|
75
|
+
- ner-en
|
76
|
+
- ner-de
|
77
|
+
- ner-fr
|
78
|
+
extensions: []
|
79
|
+
extra_rdoc_files: []
|
80
|
+
files:
|
81
|
+
- core/target/ehu-nerc-1.0.jar
|
82
|
+
- lib/opener/ners/base.rb
|
83
|
+
- lib/opener/ners/base/version.rb
|
84
|
+
- opener-ner-base.gemspec
|
85
|
+
- README.md
|
86
|
+
- bin/ner-nl
|
87
|
+
- bin/ner-it
|
88
|
+
- bin/ner-es
|
89
|
+
- bin/ner-en
|
90
|
+
- bin/ner-de
|
91
|
+
- bin/ner-fr
|
92
|
+
homepage: http://opener-project.github.com/
|
93
|
+
licenses: []
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.1.9
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Base NER component for languages such as English.
|
115
|
+
test_files: []
|
116
|
+
has_rdoc:
|