rudachi 1.3.0 → 1.4.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 +4 -4
- data/README.md +3 -7
- data/lib/rudachi/configurable.rb +1 -1
- data/lib/rudachi/{dependencies/jruby.rb → dependencies.rb} +5 -9
- data/lib/rudachi/file_parser.rb +1 -1
- data/lib/rudachi/lazy_load.rb +4 -2
- data/lib/rudachi/loader.rb +12 -9
- data/lib/rudachi/option/boolean_option.rb +2 -2
- data/lib/rudachi/option/string_option.rb +3 -3
- data/lib/rudachi/stream_parser.rb +2 -2
- data/lib/rudachi/version.rb +1 -1
- metadata +6 -21
- data/lib/rudachi/dependencies/ruby.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b76fd7addfd5f3bd28c0a037a2b3953ddb05a1f83af90aa154e64f54bdd4487
|
4
|
+
data.tar.gz: 57475d77337ee0e058672827ea83ccca6d2713543431deb8625ae6cce4e88abf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a07a1ac681d0999c103ca0f27c12190a8fa95de9ab7a5613d7d6412709ce55b4eb4492c471a1fb10bf5d238b205e51b281b3cd5a6f54237577463a3a8563cbd2
|
7
|
+
data.tar.gz: 75c332d969191be48746969cd103716a3a2c02b7bf1222eaa11b293165635466aeddf93deaed367aba86dd2307fc3df8896eb81b255600fe87e8fa06a599b886
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Rudachi
|
2
|
-
|
2
|
+
JRuby wrapper for [Sudachi](https://github.com/WorksApplications/Sudachi).
|
3
3
|
|
4
4
|
#### Text
|
5
5
|
```rb
|
@@ -29,14 +29,10 @@ File.read('output.txt')
|
|
29
29
|
|
30
30
|
## Requirements
|
31
31
|
|
32
|
-
|
33
|
-
- Ruby 2.3.0 or newer
|
34
|
-
- [rjb](https://github.com/arton/rjb) 1.1.1 or newer
|
32
|
+
- [JRuby](https://github.com/jruby/jruby) 9.1.3.0 or later
|
35
33
|
- [Sudachi](https://github.com/WorksApplications/Sudachi)
|
36
34
|
|
37
|
-
|
38
|
-
- [JRuby](https://github.com/jruby/jruby) 9.1.3.0 or newer
|
39
|
-
- [Sudachi](https://github.com/WorksApplications/Sudachi)
|
35
|
+
For Ruby, please check [rudachi-rb](https://github.com/SongCastle/rudachi-rb).
|
40
36
|
|
41
37
|
## Installation
|
42
38
|
|
data/lib/rudachi/configurable.rb
CHANGED
@@ -27,16 +27,12 @@ module Rudachi
|
|
27
27
|
raise InvalidInclusion unless base.ancestors.include?(TextParser)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
Java::SudachiCommandLine.main(Option.cmds(@opts))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
30
|
+
private
|
31
|
+
|
32
|
+
def input_stream(io)
|
33
|
+
io.to_inputstream
|
38
34
|
end
|
39
35
|
|
40
|
-
LazyLoad.run_load_hooks(:stream_processor)
|
36
|
+
LazyLoad.run_load_hooks(:stream_processor, self)
|
41
37
|
end
|
42
38
|
end
|
data/lib/rudachi/file_parser.rb
CHANGED
data/lib/rudachi/lazy_load.rb
CHANGED
data/lib/rudachi/loader.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
module Rudachi
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
module Loader
|
3
|
+
class UnavailableError < StandardError; end;
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def load!
|
7
|
+
raise UnavailableError, 'jruby_required' unless jruby?
|
8
|
+
require 'rudachi/dependencies'
|
8
9
|
end
|
9
|
-
end
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
private
|
12
|
+
|
13
|
+
def jruby?
|
14
|
+
RUBY_PLATFORM == 'java'
|
15
|
+
end
|
13
16
|
end
|
14
17
|
end
|
15
18
|
end
|
data/lib/rudachi/version.rb
CHANGED
metadata
CHANGED
@@ -1,30 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rudachi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SongCastle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
name: rjb
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.1.1
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.1.1
|
27
|
-
description: A Ruby wrapper for Sudachi.
|
11
|
+
date: 2022-04-30 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A JRuby wrapper for Sudachi.
|
28
14
|
email: "-"
|
29
15
|
executables: []
|
30
16
|
extensions: []
|
@@ -34,8 +20,7 @@ files:
|
|
34
20
|
- lib/rudachi.rb
|
35
21
|
- lib/rudachi/config.rb
|
36
22
|
- lib/rudachi/configurable.rb
|
37
|
-
- lib/rudachi/dependencies
|
38
|
-
- lib/rudachi/dependencies/ruby.rb
|
23
|
+
- lib/rudachi/dependencies.rb
|
39
24
|
- lib/rudachi/file_parser.rb
|
40
25
|
- lib/rudachi/lazy_load.rb
|
41
26
|
- lib/rudachi/loader.rb
|
@@ -67,5 +52,5 @@ requirements: []
|
|
67
52
|
rubygems_version: 3.0.3
|
68
53
|
signing_key:
|
69
54
|
specification_version: 4
|
70
|
-
summary: A
|
55
|
+
summary: A JRuby wrapper for Sudachi
|
71
56
|
test_files: []
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'rjb'
|
2
|
-
require 'rudachi/lazy_load'
|
3
|
-
|
4
|
-
Rjb::load(Rudachi.jar_path.to_s)
|
5
|
-
|
6
|
-
module Rudachi
|
7
|
-
module Java
|
8
|
-
String = Rjb::import('java.lang.String')
|
9
|
-
System = Rjb::import('java.lang.System')
|
10
|
-
PrintStream = Rjb::import('java.io.PrintStream')
|
11
|
-
ByteArrayInputStream = Rjb::import('java.io.ByteArrayInputStream')
|
12
|
-
ByteArrayOutputStream = Rjb::import('java.io.ByteArrayOutputStream')
|
13
|
-
UTF_8 = Rjb::import('java.nio.charset.StandardCharsets').UTF_8
|
14
|
-
SudachiCommandLine = Rjb::import('com.worksap.nlp.sudachi.SudachiCommandLine')
|
15
|
-
end
|
16
|
-
|
17
|
-
module StreamProcessor
|
18
|
-
class InvalidInclusion < StandardError; end
|
19
|
-
|
20
|
-
TERM = ?\n
|
21
|
-
|
22
|
-
def self.included(base)
|
23
|
-
raise InvalidInclusion unless base.ancestors.include?(TextParser)
|
24
|
-
end
|
25
|
-
|
26
|
-
def parse(io)
|
27
|
-
ret = []
|
28
|
-
while data = io.gets
|
29
|
-
ret << super(data).strip
|
30
|
-
end
|
31
|
-
|
32
|
-
ret.join(TERM)
|
33
|
-
end
|
34
|
-
|
35
|
-
LazyLoad.run_load_hooks(:stream_processor)
|
36
|
-
end
|
37
|
-
end
|