light-mecab 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/light-mecab.rb +3 -3
- data/lib/light-mecab/version.rb +1 -1
- data/locale/morpheme.yml +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68e3e72d4f025c81ade1963d6d0d556ceb91e2ad
|
4
|
+
data.tar.gz: f2d313ced0c67a085dcc1a4a33c0b500b4225f23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1abeafdabb72ba2056735ff8d7473802c04ce8be5b81b2a9efebb54605d4b5d47e59fb61e326819ee0802a692d547f12916832816b51bcd1f44aab83332a173
|
7
|
+
data.tar.gz: eaba3a9e21dc751204e59e3bdf16243ae333e50a94354bf3a1c04d2f165ae04c957ae1ffcaa8e84a1d1fb0503be66513d4d4f2a16ca6378c1d1bfe2119e26745
|
data/lib/light-mecab.rb
CHANGED
@@ -4,6 +4,7 @@ require 'yaml'
|
|
4
4
|
|
5
5
|
module LightMecab
|
6
6
|
class Morpheme
|
7
|
+
@@tagger = ::MeCab::Tagger.new
|
7
8
|
@@i18n = ::YAML.load_file(File.expand_path(File.join(__FILE__, '..', '..', 'locale', 'morpheme.yml')))
|
8
9
|
|
9
10
|
class << self
|
@@ -11,7 +12,7 @@ module LightMecab
|
|
11
12
|
# @return [Array <MeCab::Node>]
|
12
13
|
def analyze(text)
|
13
14
|
nodes = Array.new
|
14
|
-
node =
|
15
|
+
node = @@tagger.parseToNode(text)
|
15
16
|
while node
|
16
17
|
nodes << node
|
17
18
|
node = node.next
|
@@ -21,7 +22,6 @@ module LightMecab
|
|
21
22
|
nodes
|
22
23
|
end
|
23
24
|
|
24
|
-
# @param key [String or Symbol]
|
25
25
|
# @return [Hash]
|
26
26
|
def i18n
|
27
27
|
@@i18n
|
@@ -53,7 +53,7 @@ module LightMecab
|
|
53
53
|
def extract(name)
|
54
54
|
morpheme = Array.new
|
55
55
|
@nodes.each do |node|
|
56
|
-
if name == node.feature.
|
56
|
+
if name == node.feature.force_encoding('UTF-8').split(',').first
|
57
57
|
morpheme << node.surface.force_encoding('UTF-8')
|
58
58
|
end
|
59
59
|
end
|
data/lib/light-mecab/version.rb
CHANGED
data/locale/morpheme.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: light-mecab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kei Tsuchiya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Execute morphological analysis by MeCab
|
14
14
|
email:
|