cw 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cw_config +18 -0
- data/.gitignore +10 -1
- data/LICENSE +2 -1
- data/README.md +212 -96
- data/Rakefile +15 -2
- data/VERSION +1 -1
- data/Vagrantfile +45 -0
- data/cw.gemspec +6 -1
- data/data/text/book_to_read.txt +4 -0
- data/data/text/english.txt +10000 -0
- data/example.rb +172 -106
- data/lib/cw.rb +10 -126
- data/lib/cw/alphabet.rb +53 -46
- data/lib/cw/audio_player.rb +83 -72
- data/lib/cw/book.rb +160 -185
- data/lib/cw/book_details.rb +38 -49
- data/lib/cw/cl.rb +101 -95
- data/lib/cw/common_words.rb +76 -0
- data/lib/cw/config.rb +50 -0
- data/lib/cw/current_word.rb +23 -24
- data/lib/cw/cw_dsl.rb +264 -131
- data/lib/cw/cw_encoding.rb +63 -69
- data/lib/cw/cw_stream.rb +86 -82
- data/lib/cw/cw_threads.rb +132 -22
- data/lib/cw/element.rb +60 -54
- data/lib/cw/file_details.rb +26 -11
- data/lib/cw/key_input.rb +53 -35
- data/lib/cw/numbers.rb +26 -19
- data/lib/cw/os.rb +13 -0
- data/lib/cw/play.rb +92 -0
- data/lib/cw/print.rb +102 -100
- data/lib/cw/process.rb +3 -0
- data/lib/cw/progress.rb +20 -17
- data/lib/cw/randomize.rb +56 -52
- data/lib/cw/repeat_word.rb +59 -66
- data/lib/cw/reveal.rb +32 -31
- data/lib/cw/rss.rb +52 -48
- data/lib/cw/sentence.rb +83 -76
- data/lib/cw/speak.rb +8 -4
- data/lib/cw/spoken.rb +8 -4
- data/lib/cw/str.rb +62 -30
- data/lib/cw/test_letters.rb +20 -28
- data/lib/cw/test_words.rb +25 -31
- data/lib/cw/tester.rb +219 -226
- data/lib/cw/text_helpers.rb +19 -15
- data/lib/cw/timing.rb +63 -67
- data/lib/cw/tone_generator.rb +176 -153
- data/lib/cw/tone_helpers.rb +15 -23
- data/lib/cw/voice.rb +12 -8
- data/lib/cw/words.rb +136 -106
- data/run_script_tests.rb +165 -0
- data/test/my_words.txt +1 -0
- data/test/test_common_words.rb +71 -0
- data/test/test_config.rb +98 -0
- data/test/test_current_word.rb +62 -0
- data/test/test_cw.rb +87 -120
- data/test/test_cw_threads.rb +123 -0
- data/test/test_filtering.rb +439 -0
- data/test/test_params.rb +28 -0
- data/test/test_play.rb +51 -0
- data/test/test_stream.rb +83 -83
- data/test/test_tester.rb +9 -27
- data/test/test_timing.rb +212 -0
- metadata +94 -12
- data/lib/cw/config_file.rb +0 -69
- data/lib/cw/monitor_keys.rb +0 -37
- data/lib/cw/params.rb +0 -104
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e3d3d2ac3c6f0d0768543c4140ca14035c23c65
|
4
|
+
data.tar.gz: c110606d40f04c564262883c565fe38c99fed9f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4794a516a4b8881d24d1bebc9f0c9bc63921b8a4eca97a8ce551ac111055d9afbd86fc290502ba36f8bec78f20ef2f6036303060c1b826430137725d03d6c7b4
|
7
|
+
data.tar.gz: 20cf42901391040da1865eb6cf6092e8ba22e707578b7fc7ae19d8df091a8f1c23a47741f27670883ebd8e93973e0374b2cb928195cf55eef7f8f0aea70709b0
|
data/.cw_config
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
wpm = 25
|
2
|
+
frequency = 450
|
3
|
+
volume = 1
|
4
|
+
book_name = book.txt
|
5
|
+
book_dir = data/text/
|
6
|
+
success_colour = green
|
7
|
+
fail_colour = red
|
8
|
+
list_colour = default
|
9
|
+
ebook2cw_path = /usr/bin/ebook2cw
|
10
|
+
run_default = test_letters
|
11
|
+
dictionary_dir = data/text/
|
12
|
+
dictionary_name = english.txt
|
13
|
+
audio_filename = audio_output
|
14
|
+
audio_dir = audio
|
15
|
+
book_name = book.txt
|
16
|
+
book_dir = data/text/
|
17
|
+
run_default = test_letters
|
18
|
+
word_count = 16
|
data/.gitignore
CHANGED
@@ -8,7 +8,8 @@ Gemfile.lock
|
|
8
8
|
*.gem
|
9
9
|
*.rbc
|
10
10
|
.bundle
|
11
|
-
.cw_config
|
11
|
+
# .cw_config
|
12
|
+
test.sqlite
|
12
13
|
coverage
|
13
14
|
InstalledFiles
|
14
15
|
lib/bundler/man
|
@@ -32,3 +33,11 @@ audio/audio_output.wav
|
|
32
33
|
/audio/e_space.wav
|
33
34
|
/audio/space.wav
|
34
35
|
/audio/audio_output.wav0000.mp3
|
36
|
+
/_audio/
|
37
|
+
/_books/
|
38
|
+
/audio/audio_output
|
39
|
+
/audio/audio_output.mp30000.mp3
|
40
|
+
/data/text/book3.txt
|
41
|
+
/.yardoc/
|
42
|
+
/.yardoc/
|
43
|
+
/.yardoc/
|
data/LICENSE
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
CW
|
2
|
-
|
2
|
+
|
3
|
+
Copyright (c) 2016 Martyn Jago <martyn.jago@btinternet.com>
|
3
4
|
|
4
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
6
|
of this software and associated documentation files (the "Software"), to
|
data/README.md
CHANGED
@@ -16,113 +16,229 @@ addition to generating random words, letters, and numbers that possibly match so
|
|
16
16
|
|
17
17
|
**CW** also allows for real-time progress marking by indicating correct and incorrect characters and words copied in real-time. A follow mode also exists which prints the output just after it has played it (for `in head' practice).
|
18
18
|
|
19
|
-
**CW** is thoroughly [documented](http://mjago.github.io/CW/), and includes a [hands-on tutorial](http://
|
19
|
+
**CW** is thoroughly [documented](http://mjago.github.io/CW/), and includes a [hands-on tutorial](http://martynjago.co.uk/CW/mydoc_learning_the_alphabet/).
|
20
20
|
|
21
21
|
# Installation:
|
22
22
|
|
23
23
|
```sh
|
24
24
|
gem install cw
|
25
|
-
|
25
|
+
cw example.rb
|
26
26
|
```
|
27
27
|
|
28
|
-
|
28
|
+
### Note:
|
29
29
|
|
30
|
-
|
30
|
+
- Requires Ruby 2+
|
31
|
+
- Tested on OS X, and Linux.
|
32
|
+
|
33
|
+
# Example CW Script
|
31
34
|
|
32
35
|
```ruby
|
33
36
|
|
34
|
-
# example.rb
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
test
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
test
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
test
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
test
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
test
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
37
|
+
# example.rb
|
38
|
+
|
39
|
+
require 'cw'
|
40
|
+
|
41
|
+
cw do
|
42
|
+
comment 'test single element letters'
|
43
|
+
wpm 15
|
44
|
+
load_alphabet :size, 1
|
45
|
+
shuffle
|
46
|
+
end
|
47
|
+
|
48
|
+
cw do
|
49
|
+
comment 'test 2 element letters'
|
50
|
+
wpm 15
|
51
|
+
load_alphabet :size, 2
|
52
|
+
shuffle
|
53
|
+
end
|
54
|
+
|
55
|
+
cw do
|
56
|
+
comment 'test less than 3 element letters'
|
57
|
+
wpm 15
|
58
|
+
load_alphabet :less_than, 3
|
59
|
+
shuffle
|
60
|
+
end
|
61
|
+
|
62
|
+
cw do
|
63
|
+
comment 'test 3 element letters'
|
64
|
+
wpm 15
|
65
|
+
load_alphabet :size, 3
|
66
|
+
shuffle
|
67
|
+
end
|
68
|
+
|
69
|
+
cw do
|
70
|
+
comment 'test less than 4 element letters'
|
71
|
+
wpm 15
|
72
|
+
load_alphabet :less_than, 4
|
73
|
+
shuffle
|
74
|
+
end
|
75
|
+
|
76
|
+
cw do
|
77
|
+
comment 'test 4 element letters'
|
78
|
+
wpm 15
|
79
|
+
load_alphabet :size, 4
|
80
|
+
shuffle
|
81
|
+
end
|
82
|
+
|
83
|
+
cw do
|
84
|
+
comment 'test alphabet vowels'
|
85
|
+
wpm 15
|
86
|
+
load_vowels
|
87
|
+
shuffle
|
88
|
+
end
|
89
|
+
|
90
|
+
cw do
|
91
|
+
comment 'test letters a..m'
|
92
|
+
wpm 18
|
93
|
+
load_alphabet("a".."m")
|
94
|
+
shuffle
|
95
|
+
end
|
96
|
+
|
97
|
+
cw do
|
98
|
+
comment 'test 8 words made with letters a..m - test by letter'
|
99
|
+
wpm 18
|
100
|
+
containing('a'..'m')
|
101
|
+
shuffle
|
102
|
+
word_count 8
|
103
|
+
end
|
104
|
+
|
105
|
+
cw do
|
106
|
+
comment 'test letters n..z'
|
107
|
+
wpm 18
|
108
|
+
load_letters('n'..'z')
|
109
|
+
shuffle
|
110
|
+
end
|
111
|
+
|
112
|
+
cw do
|
113
|
+
comment 'test 8 words made with letters n..z - test by word'
|
114
|
+
wpm 18
|
115
|
+
containing('n'..'z')
|
116
|
+
shuffle
|
117
|
+
word_count 8
|
118
|
+
test_words
|
119
|
+
end
|
120
|
+
|
121
|
+
cw do
|
122
|
+
comment 'test numbers'
|
123
|
+
wpm 20
|
124
|
+
load_numbers
|
125
|
+
shuffle
|
126
|
+
end
|
127
|
+
|
128
|
+
cw do
|
129
|
+
comment 'test alphabet - repeat until correct'
|
130
|
+
wpm 25
|
131
|
+
load_alphabet
|
132
|
+
shuffle
|
133
|
+
repeat_word
|
134
|
+
end
|
135
|
+
|
136
|
+
cw do
|
137
|
+
comment 'test 8 most common words no longer than 4 letters'
|
138
|
+
wpm 20
|
139
|
+
load_most_common_words
|
140
|
+
shuffle
|
141
|
+
no_longer_than 4
|
142
|
+
word_count 8
|
143
|
+
end
|
144
|
+
|
145
|
+
cw do
|
146
|
+
comment 'test 4 most common words no shorter than 4 letters'
|
147
|
+
wpm 20
|
148
|
+
load_most_common_words
|
149
|
+
shuffle
|
150
|
+
no_shorter_than 4
|
151
|
+
word_count 8
|
152
|
+
end
|
153
|
+
|
154
|
+
cw do
|
155
|
+
comment 'test 8 words including letter sequence "ing"'
|
156
|
+
shuffle
|
157
|
+
including('ing')
|
158
|
+
word_size 6
|
159
|
+
end
|
160
|
+
|
161
|
+
cw do
|
162
|
+
comment 'test 8 words having 6 letters - play each word twice'
|
163
|
+
shuffle
|
164
|
+
word_size 6
|
165
|
+
word_count 8
|
166
|
+
double_words
|
167
|
+
end
|
168
|
+
|
169
|
+
cw do
|
170
|
+
comment 'test 8 words beginning with "qu" - repeat whole sequence once'
|
171
|
+
wpm 20
|
172
|
+
shuffle
|
173
|
+
beginning_with 'qu'
|
174
|
+
word_count 8
|
175
|
+
repeat 1
|
176
|
+
end
|
177
|
+
|
178
|
+
cw do
|
179
|
+
comment 'test 8 words ending with "tion" - test by word'
|
180
|
+
wpm 15
|
181
|
+
shuffle
|
182
|
+
ending_with 'tion'
|
183
|
+
word_count 8
|
184
|
+
test_words
|
185
|
+
end
|
186
|
+
|
187
|
+
cw do
|
188
|
+
comment 'read one sentence of book'
|
189
|
+
wpm 20
|
190
|
+
read_book(sentences: 1)
|
191
|
+
end
|
192
|
+
|
193
|
+
cw do
|
194
|
+
comment 'read rss feed (quote of the day)'
|
195
|
+
wpm 18
|
196
|
+
read_rss(:quotation, 1)
|
197
|
+
end
|
198
|
+
|
199
|
+
cw do
|
200
|
+
comment 'test 6 common cw abbreviations'
|
201
|
+
wpm 15
|
202
|
+
load_abbreviations
|
203
|
+
shuffle
|
204
|
+
word_count 6
|
205
|
+
end
|
206
|
+
|
207
|
+
cw do
|
208
|
+
comment "test 8 Q codes by ear (no keyboard test)"
|
209
|
+
wpm 20
|
210
|
+
load_codes
|
211
|
+
shuffle
|
212
|
+
word_count 8
|
213
|
+
print_words
|
214
|
+
end
|
215
|
+
|
216
|
+
cw do
|
217
|
+
comment "test 8 words by ear - reveal words at end of test"
|
218
|
+
wpm 20
|
219
|
+
shuffle
|
220
|
+
word_count 8
|
221
|
+
reveal
|
222
|
+
end
|
223
|
+
|
224
|
+
cw do
|
225
|
+
comment "reverse alphabet"
|
226
|
+
wpm 20
|
227
|
+
load_alphabet
|
228
|
+
reverse
|
229
|
+
end
|
230
|
+
|
231
|
+
cw do
|
232
|
+
comment "load my own word set"
|
233
|
+
wpm 20
|
234
|
+
load_text("test/my_words.txt")
|
235
|
+
shuffle
|
236
|
+
word_count 4
|
237
|
+
end
|
238
|
+
|
239
|
+
# See documentation for more details - and more commands.
|
240
|
+
|
241
|
+
puts 'done'
|
126
242
|
|
127
243
|
```
|
128
244
|
|
data/Rakefile
CHANGED
@@ -1,10 +1,23 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rake/testtask'
|
3
|
-
|
4
3
|
require 'rake/version_task'
|
4
|
+
require 'yard'
|
5
|
+
|
5
6
|
Rake::VersionTask.new
|
6
7
|
|
7
8
|
Rake::TestTask.new do |t|
|
9
|
+
|
8
10
|
t.pattern = "test/test_*.rb"
|
9
|
-
# t.pattern = "test/
|
11
|
+
# t.pattern = "test/test_play.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
YARD::Rake::YardocTask.new do |t|
|
15
|
+
t.files = ['lib/**/*.rb'] # optional
|
16
|
+
t.options = ['--any', '--extra', '--opts'] # optional
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Test cw_scripts and check timings"
|
20
|
+
task :test_scripts do
|
21
|
+
system "bundle exec ruby run_script_tests.rb"
|
22
|
+
puts "done"
|
10
23
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/Vagrantfile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |config|
|
5
|
+
config.ssh.forward_x11 = true # useful since some audio testing programs use x11
|
6
|
+
config.vm.box = "precise64"
|
7
|
+
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
8
|
+
config.vm.provision :shell, :inline => $BOOTSTRAP_SCRIPT # see below
|
9
|
+
|
10
|
+
# enable audio drivers on VM settings
|
11
|
+
config.vm.provider :virtualbox do |vb|
|
12
|
+
if RUBY_PLATFORM =~ /darwin/
|
13
|
+
vb.customize ["modifyvm", :id, '--audio', 'coreaudio', '--audiocontroller', 'hda'] # choices: hda sb16 ac97
|
14
|
+
elsif RUBY_PLATFORM =~ /mingw|mswin|bccwin|cygwin|emx/
|
15
|
+
vb.customize ["modifyvm", :id, '--audio', 'dsound', '--audiocontroller', 'ac97']
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
$BOOTSTRAP_SCRIPT = <<EOF
|
22
|
+
set -e # Stop on any error
|
23
|
+
|
24
|
+
# --------------- SETTINGS ----------------
|
25
|
+
# Other settings
|
26
|
+
export DEBIAN_FRONTEND=noninteractive
|
27
|
+
|
28
|
+
sudo apt-get update
|
29
|
+
|
30
|
+
# ---- OSS AUDIO
|
31
|
+
sudo usermod -a -G audio vagrant
|
32
|
+
sudo apt-get install -y oss4-base oss4-dkms oss4-source oss4-gtk linux-headers-3.2.0-23 debconf-utils
|
33
|
+
sudo ln -s /usr/src/linux-headers-$(uname -r)/ /lib/modules/$(uname -r)/source || echo ALREADY SYMLINKED
|
34
|
+
sudo module-assistant prepare
|
35
|
+
sudo module-assistant auto-install -i oss4 # this can take 2 minutes
|
36
|
+
sudo debconf-set-selections <<< "linux-sound-base linux-sound-base/sound_system select OSS"
|
37
|
+
echo READY.
|
38
|
+
|
39
|
+
# have to reboot for drivers to kick in, but only the first time of course
|
40
|
+
if [ ! -f ~/runonce ]
|
41
|
+
then
|
42
|
+
sudo reboot
|
43
|
+
touch ~/runonce
|
44
|
+
fi
|
45
|
+
EOF
|