ridic 0.5.1
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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +42 -0
- data/Rakefile +1 -0
- data/lib/ridic/dictionary.rb +3167 -0
- data/lib/ridic/version.rb +3 -0
- data/lib/ridic.rb +14 -0
- data/ridic.gemspec +19 -0
- data/spec/ridic_spec.rb +24 -0
- data/spec/spec_helper.rb +2 -0
- metadata +58 -0
data/lib/ridic.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "ridic/version"
|
2
|
+
require "ridic/dictionary"
|
3
|
+
|
4
|
+
module RiDic
|
5
|
+
def self.word_match(text_word)
|
6
|
+
RiDic::Dictionary.words[text_word.upcase]
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.stem_match(text_word)
|
10
|
+
text_word.upcase!
|
11
|
+
RiDic::Dictionary.word_stems.each {|key, value| (return key) if text_word.match("^#{key}")}
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
end
|
data/ridic.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ridic/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "ridic"
|
8
|
+
gem.version = RiDic::VERSION
|
9
|
+
gem.authors = ["Arne Fostvedt"]
|
10
|
+
gem.email = ["fostvedt.arne@gmail.com"]
|
11
|
+
gem.description = %q{Ruby gem wrapper for the Regressive Imagery Dictionary}
|
12
|
+
gem.summary = %q{Exposes methods to access and search RID}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
data/spec/ridic_spec.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'RiDic' do
|
4
|
+
describe '.word_match' do
|
5
|
+
it 'retrieves word if found in dictionary' do
|
6
|
+
RiDic.word_match('ale').should eql(["ORALITY", "NEED", "PRIMARY"])
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'returns nil if word does not exist in dictionary' do
|
10
|
+
RiDic.word_match('huzahzah').should eql(nil)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.stem_match' do
|
15
|
+
it 'retrives word if stem found in dictionary' do
|
16
|
+
RiDic.stem_match('poetically').should eql(["POET", ["EXPRESSIVE_BEH", "", "EMOTIONS"]])
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'returns il if stem does not exist in dictionary' do
|
20
|
+
RiDic.stem_match('mxyzptlk').should eql(nil)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ridic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Arne Fostvedt
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-17 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Ruby gem wrapper for the Regressive Imagery Dictionary
|
15
|
+
email:
|
16
|
+
- fostvedt.arne@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/ridic.rb
|
27
|
+
- lib/ridic/dictionary.rb
|
28
|
+
- lib/ridic/version.rb
|
29
|
+
- ridic.gemspec
|
30
|
+
- spec/ridic_spec.rb
|
31
|
+
- spec/spec_helper.rb
|
32
|
+
homepage: ''
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.8.24
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: Exposes methods to access and search RID
|
56
|
+
test_files:
|
57
|
+
- spec/ridic_spec.rb
|
58
|
+
- spec/spec_helper.rb
|