vn_tagger 0.0.6 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85a479ff139ded04284fa4f95c5a543b54dcfe73
4
- data.tar.gz: ef4bbcd00b890c82cf86463183b3d420520d35de
3
+ metadata.gz: eb1eff57d9490c011b4d340c0d167a20245b8c5c
4
+ data.tar.gz: b411874dc1e8f7b574cc8995224f6f091bbb5206
5
5
  SHA512:
6
- metadata.gz: bfcf7a308500909e95a9be45bfbaf9a92959b8256723588b0bb097fef0c245e754d55367b940d7f5fbfe12c427469b5f0e70a349759496d93b485d9f4599b617
7
- data.tar.gz: 8a0f76c3df883c6b3a89e8f3bb4e9cb2ddc07fd477fb7b495ab40c1ac495f118354e01c43e12df4f404e47d005a7a30801493376b0178cbe7f35474d0b1bd5aa
6
+ metadata.gz: ddce5c31d971c282ba08599a5b49cd38d46ec5e0c178b5b455b47324c941470ef8b4f15fa0f5c8162460105fcaa39344809100a6e2b6f2a856e5df7e6412716b
7
+ data.tar.gz: 7c96f95660818f66a11607d5056546e188e18cdb7a504babe57bb27eb3fcd4102e244e9768982a442b624e3d4a1929f223c35970dd6349d843a4a2f62f67dc3d
data/README.md CHANGED
@@ -14,7 +14,7 @@ Or install it yourself as:
14
14
 
15
15
  $ gem install vn_tagger
16
16
 
17
- ## Usage
17
+ ## Usage Example
18
18
 
19
19
  ```ruby
20
20
  text = 'Mourinho là huấn luyện viên của Chelsea'
@@ -22,9 +22,11 @@ document = VnTagger::Tagger.tag(text)
22
22
 
23
23
  document.to_xml # => "<?xml version=\"1.0\"?>\n<doc>\n\t<s>\n\t\t<w pos=\"Np\">Mourinho</w>\n\t\t<w pos=\"V\">l&#xE0;</w>\n\t\t<w pos=\"N\">hu&#x1EA5;n luy&#x1EC7;n vi&#xEA;n</w>\n\t\t<w pos=\"E\">c&#x1EE7;a</w>\n\t\t<w pos=\"Np\">Chelsea</w>\n\t\t<w pos=\".\">.</w>\n\t</s>\n</doc>\n"
24
24
  document.class # => Nokogiri::Xml::Document
25
+ keys = document.xpath("//w")
26
+ keys.first.attr('pos') # => 'Np'
27
+ keys.first.child.text #=> 'Mourinho'
25
28
  ```
26
29
 
27
-
28
30
  ## Contributing
29
31
 
30
32
  1. Fork it ( https://github.com/hieuk09/vn_tagger/fork )
@@ -8,7 +8,7 @@ module VnTagger
8
8
  OUTPUT = File.join(ROOT_PATH, 'output.xml')
9
9
 
10
10
  def initialize(text)
11
- @text = text
11
+ @text = normalize(text)
12
12
  end
13
13
 
14
14
  def tag
@@ -39,5 +39,9 @@ module VnTagger
39
39
  file.close
40
40
  doc
41
41
  end
42
+
43
+ def normalize(string)
44
+ string.to_s.gsub(/(\"|\')/, '')
45
+ end
42
46
  end
43
47
  end
@@ -1,3 +1,3 @@
1
1
  module VnTagger
2
- VERSION = '0.0.6'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -5,9 +5,12 @@ describe VnTagger::Tagger do
5
5
  let(:text) { 'HLV cùa Chelsea không hối tiếc vì hành động bỏ về sớm trong trận gặp Aston Villa.' }
6
6
  let(:tagger) { described_class.new(text) }
7
7
  let(:result) { tagger.tag }
8
+ let(:key) { result.xpath("//w").first }
8
9
 
9
10
  it 'returns xml tagged text' do
10
11
  expect(result).to be_a(Nokogiri::XML::Document)
12
+ expect(key.attr('pos')).to eq 'Np'
13
+ expect(key.child.text).to eq 'HLV'
11
14
  end
12
15
  end
13
16
  end
data/vn_tagger.gemspec CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.version = VnTagger::VERSION
9
9
  spec.authors = ["Hieu Nguyen"]
10
10
  spec.email = ["hieuk09@gmail.com"]
11
- spec.summary = %q{This is a wrapper for vn_tagger library, a A POS tagger for Vietnamese texts.' }
12
- spec.description = %q{This is a wrapper for vn_tagger library, a A POS tagger for Vietnamese texts.' }
13
- spec.homepage = ""
11
+ spec.summary = %q{This is a wrapper for vn_tagger library, a A POS tagger for Vietnamese texts. }
12
+ spec.description = %q{This is a wrapper for vn_tagger library, a A POS tagger for Vietnamese texts. }
13
+ spec.homepage = "https://github.com/hieuk09/ruby_vn_tagger"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vn_tagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hieu Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2014-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: 'This is a wrapper for vn_tagger library, a A POS tagger for Vietnamese
70
- texts.'' '
70
+ texts. '
71
71
  email:
72
72
  - hieuk09@gmail.com
73
73
  executables: []
@@ -103,7 +103,7 @@ files:
103
103
  - vn.hus.nlp.tagger-4.2.0.jar
104
104
  - vnTagger.sh
105
105
  - vn_tagger.gemspec
106
- homepage: ''
106
+ homepage: https://github.com/hieuk09/ruby_vn_tagger
107
107
  licenses:
108
108
  - MIT
109
109
  metadata: {}
@@ -127,7 +127,7 @@ rubyforge_project:
127
127
  rubygems_version: 2.4.3
128
128
  signing_key:
129
129
  specification_version: 4
130
- summary: This is a wrapper for vn_tagger library, a A POS tagger for Vietnamese texts.'
130
+ summary: This is a wrapper for vn_tagger library, a A POS tagger for Vietnamese texts.
131
131
  test_files:
132
132
  - spec/spec_helper.rb
133
133
  - spec/vn_tagger/tagger_spec.rb