aliyun-nlp_api 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04be641c96dbd8dbcfd60f06b10cfec579891447
4
+ data.tar.gz: 71cf427d115b5fdf2e1e948a0a8a0c807a54ebe4
5
+ SHA512:
6
+ metadata.gz: 46b455f415e4df785ad9676098e977f8f75b879c36ae2f72c6258bda1f127ae5a8cec79440f8245583628c3eddba972611d7447ea3b81be06074065912be6114
7
+ data.tar.gz: 6e6654c463cd198bcd325fa917e6f075966d63108b9230378eea948274c3af5d53aa0e33bcc86baf8777542bd7e05c639e945a6bb0c6ca10272afa2ad1967edc
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ /Gemfile.lock
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
14
+ .idea
15
+ aliyun-nlp_api-*.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.4
5
+ before_install: gem install bundler -v 1.16.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at lewislinlin@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in aliyun-nlp_api.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 liuxianglin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,60 @@
1
+ # Aliyun::NlpApi
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/aliyun/nlp_api`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'aliyun-nlp_api'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install aliyun-nlp_api
22
+
23
+ ## Usage
24
+
25
+ $ require 'aliyun/nlp_api'
26
+
27
+ #### create client
28
+
29
+ $ client = Aliyun::NlpApi::Client.new(access_key_id,access_key_secret, endpoint)
30
+
31
+ default endpoint: nlp.cn-shanghai.aliyuncs.com
32
+
33
+ #### common API
34
+
35
+ $ body = {"lang"=>"ZH", "text"=>"Iphone专用数据线"}
36
+ $ client.common_api(body , api_path="/nlp/api/wordsegment/general")
37
+
38
+ #### The specified API
39
+
40
+ $ body = {"lang"=>"ZH", "text"=>"Iphone专用数据线"}
41
+ $ client.wordsegment(body, domian="general")
42
+
43
+
44
+ ## Development
45
+
46
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
47
+
48
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
+
50
+ ## Contributing
51
+
52
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/aliyun-nlp_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
53
+
54
+ ## License
55
+
56
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
57
+
58
+ ## Code of Conduct
59
+
60
+ Everyone interacting in the Aliyun::NlpApi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/aliyun-nlp_api/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,38 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "aliyun/nlp_api/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "aliyun-nlp_api"
8
+ spec.version = Aliyun::NlpApi::VERSION
9
+ spec.authors = ["lewislinlin"]
10
+ spec.email = ["lewislinlin@gmail.com"]
11
+
12
+ spec.summary = %q{Aliyun NLP SDK for Ruby.}
13
+ spec.description = %q{ref_link: https://help.aliyun.com/document_detail/60866.html}
14
+ spec.homepage = "https://github.com/cs-cj/aliyun-nlp_api"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ # Specify which files should be added to the gem when it is released.
27
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
29
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
+ end
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ spec.add_development_dependency "bundler", "~> 1.16"
36
+ spec.add_development_dependency "rake", "~> 10.0"
37
+ spec.add_development_dependency "rspec", "~> 3.0"
38
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "aliyun/nlp_api"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,309 @@
1
+ require "aliyun/nlp_api/version"
2
+ require 'json'
3
+ # require 'rest-client'
4
+ require 'base64'
5
+ require 'digest/md5'
6
+ require 'securerandom'
7
+ require 'uri'
8
+ require 'net/http'
9
+ require 'net/https'
10
+ require 'time'
11
+
12
+ module Aliyun
13
+ module NlpApi
14
+ # Your code goes here...
15
+ class Client
16
+ attr_accessor :ak_id, :ak_secret, :host
17
+
18
+ def initialize(ak_id, ak_secret, endpoint = 'nlp.cn-shanghai.aliyuncs.com')
19
+ @ak_id = ak_id
20
+ @ak_secret = ak_secret
21
+ @host = endpoint
22
+ end
23
+
24
+
25
+ # Aliyun::NlpApi::Client.example()
26
+ def self.example(ak_id,ak_secret)
27
+ client = Aliyun::NlpApi::Client.new(ak_id,ak_secret)
28
+ body = {
29
+ "lang"=>"ZH",
30
+ "text"=>"Iphone专用数据线"
31
+ }
32
+ client.common_api(body, "/nlp/api/wordpos/general" )
33
+ # client.wordsegment(body)
34
+ # client.wordpos(body)
35
+
36
+ end
37
+
38
+
39
+ def post_api(url, body)
40
+ body = body.force_encoding("utf-8") rescue "请求数据编码请使用 UTF-8 字符集"
41
+ # 计算body的MD5值,然后再对其进行base64编码,编码后的值设置到 Header中。
42
+ puts net_url = URI.parse("#{url}")
43
+ path = net_url.request_uri
44
+ host = net_url.host
45
+ http_or_https = net_url.scheme
46
+
47
+ method = "POST"
48
+ accept = "application/json"
49
+ body_md5 = Base64.strict_encode64(OpenSSL::Digest::MD5.digest(body)) ## 1.对body做MD5+BASE64加密
50
+ content_type = "application/json;chrset=utf-8"
51
+ date = Time.now.httpdate #Time.new(20181116).httpdate
52
+ uuid = SecureRandom.uuid
53
+
54
+ # puts "stringToSign==========>"
55
+ stringToSign = method + "\n" + accept + "\n" + body_md5+ "\n" + content_type + "\n" + date + "\n" + "x-acs-signature-method:HMAC-SHA1\n" + "x-acs-signature-nonce:" + uuid + "\n" + path
56
+ # + "x-acs-version:2018-04-04\n"
57
+ # 2.计算 HMAC-SHA1
58
+
59
+ signature = Base64.strict_encode64(OpenSSL::HMAC.digest('sha1', ak_secret, stringToSign))
60
+
61
+ # 3.得到 authorization header
62
+ authHeader = "acs " + ak_id + ":" + signature
63
+
64
+ #
65
+ # header = {
66
+ # "Accept"=> accept,
67
+ # "Content-MD5"=> body_md5,
68
+ # "Content-Type"=> content_type,
69
+ # "Date"=> date,
70
+ # "x-acs-signature-nonce"=> uuid,
71
+ # "x-acs-signature-method"=> "HMAC-SHA1",
72
+ # "Content-Length"=> "#{body.length}",
73
+ # "Host"=> host,
74
+ # "Authorization"=> authHeader
75
+ # }
76
+
77
+ if http_or_https == "https"
78
+ use_ssl = true
79
+ else
80
+ use_ssl = false
81
+ end
82
+ # todo 待完善 post https
83
+ response = Net::HTTP.start(net_url.host, net_url.port, use_ssl: use_ssl) do |http|
84
+ # req = Net::HTTP::Post.new(uri)
85
+ if use_ssl
86
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
87
+ end
88
+
89
+ request = Net::HTTP::Post.new(net_url)
90
+
91
+ request["Accept"] = accept
92
+ request["Content-Type"] = content_type
93
+ request["Content-MD5"] = body_md5
94
+
95
+ request["Date"] = date
96
+ request["Host"] = host
97
+ request["Authorization"] = authHeader
98
+ request["x-acs-signature-nonce"] = uuid
99
+ request["x-acs-signature-method"] = "HMAC-SHA1"
100
+ # request["x-acs-version"] = '2018-04-04'
101
+ request["Content-Length"] = "#{body.length}"
102
+
103
+ # puts "header==========>"
104
+ # # p header
105
+ # request.each_header do |head|
106
+ # p "#{head}: #{request[head]}"
107
+ # end
108
+
109
+ # puts "body==========>"
110
+ request.body = body
111
+ http.request(request)
112
+ end
113
+
114
+ response.read_body.force_encoding("utf-8")
115
+
116
+ end
117
+
118
+ # api 列表
119
+
120
+ def common_api(body , api_path="/nlp/api/wordpos/general")
121
+ whole_url = "http://" + host + api_path
122
+ post_api( whole_url , body.to_json)
123
+ end
124
+
125
+ # todo 待完善 post https
126
+ # def common_api_https(body = {"text"=> "真丝韩都衣舍连衣裙"}, api_path="/nlp/api/wordpos/general")
127
+ # whole_url = "https://" + host + api_path
128
+ # post_api( whole_url , body.to_json)
129
+ # end
130
+
131
+ # 多语言分词
132
+ # https://nlp.cn-shanghai.aliyuncs.com/nlp/api/wordsegment/{Domain}
133
+ # Domain: general
134
+ # body :
135
+ # {
136
+ # "lang"=>"ZH",
137
+ # "text"=>"Iphone专用数据线"
138
+ # }
139
+ def wordsegment(body, domian="general")
140
+ api_path = "/nlp/api/wordsegment/#{domian}"
141
+ whole_url = "http://" + host + api_path
142
+ post_api( whole_url , body.to_json)
143
+ end
144
+
145
+ # def wordsegment_https(body, domian="general")
146
+ # api_path = "/nlp/api/wordsegment/#{domian}"
147
+ # whole_url = "https://" + host + api_path
148
+ # post_api( whole_url , body.to_json)
149
+ # end
150
+
151
+
152
+ # 词性标注
153
+ # [http|https]://nlp.cn-shanghai.aliyuncs.com/nlp/api/wordpos/{Domain}
154
+ # Domain: general
155
+ # body: { "text"=>"真丝韩都衣舍连衣裙" }
156
+
157
+ def wordpos(body, domian="general")
158
+ api_path = "/nlp/api/wordpos/#{domian}"
159
+ whole_url = "http://" + host + api_path
160
+ post_api( whole_url , body.to_json)
161
+ end
162
+
163
+ # 命名实体
164
+ # [http|https]://nlp.cn-shanghai.aliyuncs.com/nlp/api/entity/{Domain}
165
+ # Domain: ecommerce
166
+ # body:
167
+ # {
168
+ # "text"=>"真丝韩都衣舍连衣裙",
169
+ # "type"=>"full" # simple, full
170
+ # }
171
+
172
+ def entity(body, domian="ecommerce")
173
+ api_path = "/nlp/api/entity/#{domian}"
174
+ whole_url = "http://" + host + api_path
175
+ post_api( whole_url , body.to_json)
176
+ end
177
+
178
+ # 情感分析
179
+ # [http|https]://nlp.cn-shanghai.aliyuncs.com/nlp/api/sentiment/{Domain}
180
+ # Domain: ecommerce
181
+ # body: { "text"=>"真丝韩都衣舍连衣裙" }
182
+
183
+ def sentiment(body, domian="ecommerce")
184
+ api_path = "/nlp/api/sentiment/#{domian}"
185
+ whole_url = "http://" + host + api_path
186
+ post_api( whole_url , body.to_json)
187
+ end
188
+
189
+ # 机器翻译 作为自然语言处理的一个基础应用,提供中文、英文、俄语、葡萄牙语、西班牙语、法语的翻译服务,支持通用场景和电商垂直场
190
+ # [http|https]://nlp.cn-shanghai.aliyuncs.com/nlp/api/translate/[Domain]
191
+ # Domain: standard,general, ecommerce
192
+ # body:
193
+ # {
194
+ # "q"=>"hello",
195
+ # "source"=>"en",
196
+ # "target"=>"zh",
197
+ # "format"=>"text"
198
+ # }
199
+
200
+ def translate(body, domian="standard")
201
+ api_path = "/nlp/api/translate/#{domian}"
202
+ whole_url = "http://" + host + api_path
203
+ post_api( whole_url , body.to_json)
204
+ end
205
+
206
+ # 信息抽取 信息抽取领域(目前支持contract,合同信息抽取)
207
+ # https://nlp.cn-shanghai.aliyuncs.com/nlp/api/ie/{Domain}
208
+ # Domain: contract
209
+ # body:
210
+ # {
211
+ # "lang"=> "ZH",
212
+ # "content"=> "合同内容字符串",
213
+ # }
214
+ def ie(body, domian="contract")
215
+ api_path = "/nlp/api/ie/#{domian}"
216
+ whole_url = "http://" + host + api_path
217
+ post_api( whole_url , body.to_json)
218
+ end
219
+
220
+ # 中心词识别
221
+ # https://nlp.cn-shanghai.aliyuncs.com/nlp/api/kwe/{Domain}
222
+ # Domain: ecommerce
223
+ # body:
224
+ # {
225
+ # "lang"=>"ZH",
226
+ # "text"=>"新鲜桔子"
227
+ # }
228
+ def kwe(body, domian="ecommerce")
229
+ api_path = "/nlp/api/kwe/#{domian}"
230
+ whole_url = "http://" + host + api_path
231
+ post_api( whole_url , body.to_json)
232
+ end
233
+
234
+
235
+ # 商品评价解析 商品评价解析主要用于分析消费者反馈的评价、点评内容,同时也可以对类似微博的口语化、短文本进行分析。对于长篇幅的新闻篇章不适用。
236
+ # [http|https]://nlp.cn-shanghai.aliyuncs.com/nlp/api/reviewanalysis/{Domain}
237
+ # Domain: ecommerce
238
+ # body:
239
+ # {
240
+ # "text"=> "面料舒适,款式好,只是尺码偏小,好在我看了其他买家的评价,在原尺码上加了一号,正合适,很满意!给满分!服务好,发货快!",
241
+ # "cate"=> "clothing"
242
+ # }
243
+ # cate: 行业类别,
244
+ # “clothing”:服装, “makeup”:美妆, “snacks”:零食, “milkpowder”:奶粉, “paperdiaper”:纸尿裤, “shoes”:鞋类, “furniture”:住宅家具, “bedding”:床上用品, “underwear”:内衣, “bags”:箱包, “cellphone”:手机, “cycling”:骑行配饰, “bicycle”:自行车, “bigball”:大型球类, “littleball”:小型球类, “watch”:手表, “glasses”:眼镜, “television”:电视机, “refrigeration”:制冷设备, “washingmachine”:洗衣机, “waterheater”:热水器, “decoration”:家装主材, “wine”:酒类, “ballacessory”:球类配件"
245
+ # 行业逐步增加中,请关注文档更新或咨询客服人员
246
+ def reviewanalysis(body, domian="ecommerce")
247
+ api_path = "/nlp/api/reviewanalysis/#{domian}"
248
+ whole_url = "http://" + host + api_path
249
+ post_api( whole_url , body.to_json)
250
+ end
251
+
252
+ # 智能文档分类 对用户输入的一段文本,映射到具体的类目上。
253
+ # https://nlp.cn-shanghai.aliyuncs.com/nlp/api/textstructure/{Domain}
254
+ # Domain: ecommerce(电商领域), news(新闻领域)
255
+ # body:
256
+ # {
257
+ # "text"=>"脚蹬Mra,帅里帅气Mra是2013年新崛起的新锐品牌,作为Mra的大Boss福叔他爱鞋如痴,从皮料到包装他都严格把关,当收集到足够多的意见后,他总会用纯手工打扮出第一双样鞋,然后再不断 的调整改进,>每双都能精益求精!福叔常说要用品质为顾客撑腰,因此Mra都是选用的上等小牛皮加工,由经验丰富的老工匠在一边亲自操刀。",
258
+ # "tag_flag"=>"true" #是否需要关键词抽取功能
259
+ # }
260
+ def textstructure(body, domian="ecommerce")
261
+ api_path = "/nlp/api/textstructure/#{domian}"
262
+ whole_url = "http://" + host + api_path
263
+ post_api( whole_url , body.to_json)
264
+ end
265
+
266
+
267
+ # 词性列表
268
+ def wordpos_k_cn
269
+ {
270
+ VA: "谓词性形容词",
271
+ VC: "系动词,如:是",
272
+ VE: "存在性动词,如:有,没{有},无",
273
+ VV: "其他动词",
274
+ NR: "专有名词",
275
+ NT: "时间名词",
276
+ NN: "其他名词",
277
+ LC: "方位词",
278
+ PN: "代词",
279
+ DT: "限定词",
280
+ CD: "基数词",
281
+ OD: "序列词",
282
+ M: "度量词",
283
+ AD: "副词",
284
+ P: "介词",
285
+ CC: "并列连接词",
286
+ CS: "从属连接词",
287
+ DEC: "“的”作为补语标记/名词化标记,如:吃的",
288
+ DEG: "“的”作为关联标记/所有格标记,如:淡淡的花香",
289
+ DER: "“得”,如:穿得好看",
290
+ DEV: "“地”,如:不断地提醒",
291
+ AS: "动词助词,仅包括:着,了,过,的",
292
+ SP: "句末助词,如:了,呢,吧,啊,呀,吗",
293
+ ETC: "“等”,“等等”",
294
+ MSP: "其他助词,如:所,以,来,而",
295
+ IJ: "感叹词,如:啊",
296
+ ON: "拟声词,如:哗啦啦,咯吱",
297
+ LB: "长“被”结构,如:他被我训了一顿",
298
+ SB: "短“被”结构,如:他被训了一顿",
299
+ BA: "把字结构,如:他把你骗了",
300
+ JJ: "其他名词修饰词",
301
+ FW: "外来词",
302
+ PU: "标点",
303
+ }
304
+ end
305
+ end
306
+
307
+
308
+ end
309
+ end
@@ -0,0 +1,5 @@
1
+ module Aliyun
2
+ module NlpApi
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aliyun-nlp_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - lewislinlin
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-11-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: 'ref_link: https://help.aliyun.com/document_detail/60866.html'
56
+ email:
57
+ - lewislinlin@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - aliyun-nlp_api.gemspec
71
+ - bin/console
72
+ - bin/setup
73
+ - lib/aliyun/nlp_api.rb
74
+ - lib/aliyun/nlp_api/version.rb
75
+ homepage: https://github.com/cs-cj/aliyun-nlp_api
76
+ licenses:
77
+ - MIT
78
+ metadata:
79
+ allowed_push_host: https://rubygems.org
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.5.1
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Aliyun NLP SDK for Ruby.
100
+ test_files: []