scrabble_score 0.1.0 → 0.1.2
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 +4 -4
- data/README.md +23 -2
- data/bin/scrabble_score +17 -0
- data/lib/scrabble_score/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf44addb3ee1c546c0aee36c4be5bda714426451
|
4
|
+
data.tar.gz: ef48a9a6e74a9593ac1431418df8c823a3c67124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 275409b0a3ae76dcb55e130a2179c1aaf814026fca815bc2fa20211060aaa2ca760fded447a642d12afbc6cd0f7f02af94cf441280010cfa22342aa32ff1c33b
|
7
|
+
data.tar.gz: 6f7e6c89b38fc1bea2858f14fb7031ae888fcbbdeab305756698bcf98735567f7f6357e919b0ddede120c291ccaa0ccf7ba3ec7a346a11b20ab5de8273dcb8ea
|
data/README.md
CHANGED
@@ -13,6 +13,22 @@ Which returns:
|
|
13
13
|
{"qi"=>11, "za"=>11, "ai"=>2, "qua"=>12, "quiz"=>22, "quai"=>13}
|
14
14
|
```
|
15
15
|
|
16
|
+
Also, there is a command line interface:
|
17
|
+
|
18
|
+
```
|
19
|
+
> scrabble_score dafs
|
20
|
+
fads, 8
|
21
|
+
fad, 7
|
22
|
+
fas, 6
|
23
|
+
fa, 5
|
24
|
+
sad, 4
|
25
|
+
das, 4
|
26
|
+
ads, 4
|
27
|
+
da, 3
|
28
|
+
ad, 3
|
29
|
+
as, 2
|
30
|
+
```
|
31
|
+
|
16
32
|
## Installation
|
17
33
|
|
18
34
|
Add this line to your application's Gemfile:
|
@@ -29,10 +45,13 @@ Or install it yourself as:
|
|
29
45
|
|
30
46
|
## Usage
|
31
47
|
|
32
|
-
One can search for words in the dictionary without score via:
|
48
|
+
One can search for words in the dictionary without score estimates via the following Ruby script:
|
33
49
|
|
34
50
|
```
|
35
|
-
|
51
|
+
require 'scrabble_score'
|
52
|
+
|
53
|
+
finder = ScrabbleScore::WordFinder.new
|
54
|
+
p finder.search('foobar')
|
36
55
|
```
|
37
56
|
|
38
57
|
While the WordFinder uses the SOWPODS dictionary, it's possible to replace it with your own:
|
@@ -58,6 +77,8 @@ letters.permutations # returns ["xy", "xz", "yx", "yz", "zx", "zy", "xyz", "xzy"
|
|
58
77
|
|
59
78
|
Note that this will only show permutations from two letters up to the size of the input string.
|
60
79
|
|
80
|
+
|
81
|
+
|
61
82
|
## Contributing
|
62
83
|
|
63
84
|
1. Fork it ( https://github.com/[my-github-username]/scrabble_score/fork )
|
data/bin/scrabble_score
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'scrabble_score'
|
4
|
+
|
5
|
+
begin
|
6
|
+
word = ARGV[0]
|
7
|
+
scorer = ScrabbleScore::WordFinder.new
|
8
|
+
words_n_scores = scorer.search_with_score(word).to_a
|
9
|
+
words_n_scores.sort! do |a, b|
|
10
|
+
b[1] <=> a[1] # by score
|
11
|
+
end
|
12
|
+
words_n_scores.each do |word, score|
|
13
|
+
puts "#{word}, #{score}"
|
14
|
+
end
|
15
|
+
rescue
|
16
|
+
puts "Usage: scrabble_score [letters]"
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrabble_score
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Aschenbach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,7 +56,8 @@ description: An engine that finds words from a set of letters and calculates the
|
|
56
56
|
score
|
57
57
|
email:
|
58
58
|
- nick.aschenbach@gmail.com
|
59
|
-
executables:
|
59
|
+
executables:
|
60
|
+
- scrabble_score
|
60
61
|
extensions: []
|
61
62
|
extra_rdoc_files: []
|
62
63
|
files:
|
@@ -65,6 +66,7 @@ files:
|
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|
67
68
|
- assets/dictionary.txt
|
69
|
+
- bin/scrabble_score
|
68
70
|
- lib/scrabble_score.rb
|
69
71
|
- lib/scrabble_score/dictionary.rb
|
70
72
|
- lib/scrabble_score/letters.rb
|
@@ -96,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
98
|
version: '0'
|
97
99
|
requirements: []
|
98
100
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.4.
|
101
|
+
rubygems_version: 2.4.2
|
100
102
|
signing_key:
|
101
103
|
specification_version: 4
|
102
104
|
summary: A scrabble cheater scoring library
|