yahoo-japanese-analysis 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d5c8d8e7afe24df7e078292d15bd5548ddfeb8a3
4
+ data.tar.gz: e367c442b190fb0388a36a73da939763ff75b0bb
5
+ SHA512:
6
+ metadata.gz: 08f56b2a40a4bcd628180e7ef50075c2c4d07459d749ad32e07a87f6ebc842ef577ef24f65ac94dfb72607462be46e575d92f1b3f96fdc8f793a79525aab17d2
7
+ data.tar.gz: fa26efc4a2bef414cd9535fec460709641a0c0259c6e54b96d00fa91a26b1ef9a9d7cc5db306db55371b9ded797402164c5d821d398c41128c8bef3dbef6bf77
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  credential.yaml
2
+ credential.yml
data/README.md CHANGED
@@ -1,17 +1,34 @@
1
1
  #Yahoo Japanese Analysis Library
2
2
 
3
- This is Yahoo! Japan Text Analysis Wrapper for Ruby.
3
+ This is Yahoo! Japan Text Analysis API Wrapper for Ruby.
4
+
4
5
  See below to get more info.
5
- http://developer.yahoo.co.jp/webapi/jlp/
6
+
7
+ http://developer.yahoo.co.jp/webapi/jlp/
6
8
 
7
9
  #Installation
8
10
 
9
11
  ##Yahoo! Japan Developers' Network Registration
10
12
 
11
13
  You must register at http://developer.yahoo.co.jp/ .
14
+
12
15
  And you can get appid to access APIs
13
16
 
14
- ##Installtion gem
17
+ ##Gem Installation
18
+ % gem install yahoo-japanese-analysis
19
+
20
+ #Features
21
+
22
+ - 日本語形態素解析
23
+ - かな漢字変換
24
+ - ルビ振り
25
+ - 校正支援
26
+ - 日本語係り受け解析
27
+ - 特長語抽出
28
+
29
+ check below URL to get more detail.
30
+
31
+ http://developer.yahoo.co.jp/webapi/jlp/
15
32
 
16
33
  #Example
17
34
 
@@ -23,10 +40,20 @@ see https://gist.github.com/2605666
23
40
 
24
41
  Copyright (c) 2012 rhysd
25
42
 
26
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
27
-
28
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
43
+ Permission is hereby granted, free of charge, to any person obtaining a copy
44
+ of this software and associated documentation files (the "Software"), to deal
45
+ in the Software without restriction, including without limitation the rights
46
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
47
+ of the Software, and to permit persons to whom the Software is furnished to do so,
48
+ subject to the following conditions:
29
49
 
30
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
50
 
51
+ The above copyright notice and this permission notice shall be included in all
52
+ copies or substantial portions of the Software.
32
53
 
54
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
55
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
56
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
57
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
58
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
59
+ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+ - OAuth を使って認証できるようにする
2
+ - method_missing へのアクセスは遅いので,2度目以降はアクセスを高速化できるように処理を書く.
@@ -2,13 +2,15 @@ module YahooJA
2
2
  module ServiceBase
3
3
 
4
4
  require 'rexml/document'
5
+ require 'open-uri'
5
6
 
6
7
  require 'yahoo-japanese-analysis/request'
7
8
  include YahooJA::Request
8
9
 
9
10
  def use_service url,appid,text,opts={}
10
11
  raise "appid is needed" unless appid
11
- params = {:sentence => text}.merge(opts) do |k,v1,v2|
12
+ encoded_text = URI.encode text
13
+ params = {:sentence => encoded_text}.merge(opts) do |k,v1,v2|
12
14
  raise "you shouldn't set #{k} as opts. it is already set."
13
15
  end
14
16
  res = request url, appid, params
@@ -11,7 +11,7 @@ module YahooJA
11
11
  end
12
12
 
13
13
  def patch
14
- 1
14
+ 2
15
15
  end
16
16
 
17
17
  def pre
@@ -1,2 +1,3 @@
1
1
  path = Dir.pwd+'/../lib'
2
2
  $LOAD_PATH.push path unless $LOAD_PATH.include? path
3
+ raise "You must write your appid to credential.yml ." unless File.exists? "credential.yml"
@@ -9,7 +9,7 @@ require 'yaml'
9
9
  class TestBase < Test::Unit::TestCase
10
10
 
11
11
  def setup
12
- @appid = YAML.load(File.open('credential.yaml').read)['my_appid']
12
+ @appid = YAML.load(File.open('credential.yml').read)['my_appid']
13
13
  @client = YahooJA::Client.new
14
14
  end
15
15
 
@@ -31,16 +31,13 @@ class TestBase < Test::Unit::TestCase
31
31
  assert_equal YahooJA::Version.minor.class,Fixnum
32
32
  assert_equal YahooJA::Version.patch.class,Fixnum
33
33
  assert( !YahooJA::Version.pre || (YahooJA::Version.pre.class == String) )
34
- assert YahooJA::Version.to_s =~ /^\d+?\.\d+?\.\d+?.*?$/
34
+ assert YahooJA::Version.to_s =~ /^\d+?\.\d+?\.\d+?.*$/
35
35
  end
36
36
 
37
37
  # test YahooJA class methods for lightweight-use
38
38
  def test_gateway
39
- [ :configure, :options, :reset,
40
- :keyphrase, :morpheme_analysis, :furigana,
41
- :kanji_conv, :kousei_support, :kakari_uke
42
- ].each do |m|
43
- assert YahooJA.respond_to?(m),"#{m} is missing."
39
+ YahooJA::Client.instance_methods.each do |m|
40
+ assert YahooJA.respond_to?(m),"instance method, #{m}, is missing."
44
41
  end
45
42
  end
46
43
 
@@ -69,7 +66,7 @@ end
69
66
  class TestFeatures < Test::Unit::TestCase
70
67
 
71
68
  def setup
72
- @appid = YAML.load(File.open('credential.yaml').read)['my_appid']
69
+ @appid = YAML.load(File.open('credential.yml').read)['my_appid']
73
70
  @client = YahooJA::Client.new
74
71
  end
75
72
 
@@ -3,7 +3,7 @@ require File.expand_path '../lib/yahoo-japanese-analysis/version',__FILE__
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'yahoo-japanese-analysis'
5
5
  s.version = YahooJA::Version.to_s
6
- s.date = '2012-05-06'
6
+ s.date = Time.now.to_s.split.first
7
7
  s.summary = "Japanese Analysis API Wrapper."
8
8
  s.description = "Yahoo! Japan Text Analysis API Wrapper."
9
9
  s.authors = ["rhysd"]
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahoo-japanese-analysis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ version: 0.1.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - rhysd
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-06 00:00:00.000000000 Z
11
+ date: 2013-09-11 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Yahoo! Japan Text Analysis API Wrapper.
15
14
  email: lin90162@yahoo.co.jp
@@ -19,6 +18,7 @@ extra_rdoc_files: []
19
18
  files:
20
19
  - .gitignore
21
20
  - README.md
21
+ - TODO
22
22
  - lib/yahoo-japanese-analysis.rb
23
23
  - lib/yahoo-japanese-analysis/client.rb
24
24
  - lib/yahoo-japanese-analysis/client/furigana.rb
@@ -33,31 +33,32 @@ files:
33
33
  - lib/yahoo-japanese-analysis/version.rb
34
34
  - test/pre_test.rb
35
35
  - test/test_all.rb
36
+ - yahoo-japanese-analysis-0.1.1.gem
36
37
  - yahoo-japanese-analysis.gemspec
37
38
  homepage: https://github.com/rhysd/yahoo-japanese-analysis
38
39
  licenses:
39
40
  - MIT
41
+ metadata: {}
40
42
  post_install_message:
41
43
  rdoc_options: []
42
44
  require_paths:
43
45
  - lib
44
46
  required_ruby_version: !ruby/object:Gem::Requirement
45
- none: false
46
47
  requirements:
47
- - - ! '>='
48
+ - - '>='
48
49
  - !ruby/object:Gem::Version
49
50
  version: 1.9.2
50
51
  required_rubygems_version: !ruby/object:Gem::Requirement
51
- none: false
52
52
  requirements:
53
- - - ! '>='
53
+ - - '>='
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  requirements: []
57
57
  rubyforge_project:
58
- rubygems_version: 1.8.23
58
+ rubygems_version: 2.0.2
59
59
  signing_key:
60
- specification_version: 3
60
+ specification_version: 4
61
61
  summary: Japanese Analysis API Wrapper.
62
62
  test_files:
63
63
  - test/test_all.rb
64
+ has_rdoc: