cowordinate 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/cowordinate.rb +2 -0
- data/lib/cowordinate/word.rb +39 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b5d4b19e6e2a75c6599d1e41f48a2c58fdd774ae
|
4
|
+
data.tar.gz: 7f6b138d04e7d3dceac403aa66ed93549ca7a56e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b3866ec0f6331c7205c8780f3e80e91919cbf0e664174222648264196844e83e10a9f1ac94a3d253a671b399177231a2cfc3366aa4a0ae6134db0bc65acea042
|
7
|
+
data.tar.gz: e32b62d4d434e3817808240debb01335c3b48eb667ea7516d6084e735e6429bf6e8b235e11fa51011b8d42ab1a39bd4facdb18f18fa7c9b4869a26fb7b244b2e
|
data/lib/cowordinate.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Cowordinate
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def Word(name)
|
8
|
+
Cowordinate::Word.search(name)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Word
|
13
|
+
|
14
|
+
attr_accessor :name, :parts, :updated_at
|
15
|
+
|
16
|
+
def self.search(name)
|
17
|
+
raw_json = HTTParty.get("http://cowordinate.com/words/#{name}.json")
|
18
|
+
attrs = JSON.parse(raw_json.body)
|
19
|
+
Cowordinate::Word.new(attrs["word"])
|
20
|
+
rescue
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(options)
|
25
|
+
self.name = options["name"]
|
26
|
+
self.parts = options["parts"]
|
27
|
+
self.updated_at = options["updated_at"]
|
28
|
+
end
|
29
|
+
|
30
|
+
['adjective', 'adverb', 'preposition', 'pronoun', 'noun', 'verb'].each do |pos|
|
31
|
+
define_method "#{pos}?" do
|
32
|
+
parts.split(",").include?(pos.to_s)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cowordinate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aubrey Goodman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Easily determine parts of speech that describe any word
|
14
|
+
email: aubrey@migrantstudios.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/cowordinate/word.rb
|
20
|
+
- lib/cowordinate.rb
|
21
|
+
homepage: https://github.com/agoodman/cowordinate-ruby
|
22
|
+
licenses: []
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.0.3
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Semantic text processing
|
44
|
+
test_files: []
|