triphthong 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +2 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +30 -0
- data/LICENCE +661 -0
- data/README.md +31 -0
- data/Rakefile +13 -0
- data/bin/triphthong +4 -0
- data/db.yml +22702 -0
- data/lib/triphthong.rb +13 -0
- data/lib/triphthong/executable.rb +73 -0
- data/lib/triphthong/text.rb +9 -0
- data/lib/triphthong/verse.rb +75 -0
- data/spec/fixtures/db.yml +27 -0
- data/spec/fixtures/pan-tadeusz.intro.txt +4 -0
- data/spec/fixtures/pan-tadeusz.txt +10428 -0
- data/spec/fixtures/vcr/test_0002_creates_structure_and_rhyme_keyed_verse_database_from_api.yml +197 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/triphthong/executable_spec.rb +46 -0
- data/spec/triphthong/text_spec.rb +28 -0
- data/spec/triphthong/verse_slow_spec.rb +27 -0
- data/spec/triphthong/verse_spec.rb +104 -0
- data/triphthong.gemspec +21 -0
- metadata +153 -0
data/spec/fixtures/vcr/test_0002_creates_structure_and_rhyme_keyed_verse_database_from_api.yml
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: http://www.wolnelektury.pl:80/api/books/
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 200
|
11
|
+
message: OK
|
12
|
+
headers:
|
13
|
+
content-type:
|
14
|
+
- application/json; charset=utf-8
|
15
|
+
content-length:
|
16
|
+
- '226298'
|
17
|
+
keep-alive:
|
18
|
+
- timeout=15, max=100
|
19
|
+
cache-control:
|
20
|
+
- max-age=600
|
21
|
+
content-language:
|
22
|
+
- pl
|
23
|
+
date:
|
24
|
+
- Thu, 10 Nov 2011 18:52:28 GMT
|
25
|
+
etag:
|
26
|
+
- ! '"b86792444cdffe36e75daff096c429b3"'
|
27
|
+
expires:
|
28
|
+
- Thu, 10 Nov 2011 19:02:29 GMT
|
29
|
+
last-modified:
|
30
|
+
- Thu, 10 Nov 2011 18:52:29 GMT
|
31
|
+
server:
|
32
|
+
- Apache/2.2.16 (Debian)
|
33
|
+
vary:
|
34
|
+
- Authorization,Accept-Language,Cookie
|
35
|
+
body: ! "[\n {\n \"href\": \"http://www.wolnelektury.pl/api/books/sonety-krymskie-ajudah/\",\n
|
36
|
+
\ \"title\": \"Ajudah\"\n }\n]"
|
37
|
+
http_version: '1.1'
|
38
|
+
- !ruby/struct:VCR::HTTPInteraction
|
39
|
+
request: !ruby/struct:VCR::Request
|
40
|
+
method: :get
|
41
|
+
uri: http://www.wolnelektury.pl:80/api/books/sonety-krymskie-ajudah/
|
42
|
+
body:
|
43
|
+
headers:
|
44
|
+
response: !ruby/struct:VCR::Response
|
45
|
+
status: !ruby/struct:VCR::ResponseStatus
|
46
|
+
code: 200
|
47
|
+
message: OK
|
48
|
+
headers:
|
49
|
+
content-type:
|
50
|
+
- application/json; charset=utf-8
|
51
|
+
transfer-encoding:
|
52
|
+
- chunked
|
53
|
+
keep-alive:
|
54
|
+
- timeout=15, max=100
|
55
|
+
cache-control:
|
56
|
+
- max-age=600
|
57
|
+
content-language:
|
58
|
+
- pl
|
59
|
+
date:
|
60
|
+
- Thu, 10 Nov 2011 18:56:50 GMT
|
61
|
+
etag:
|
62
|
+
- ! '"df7ac7d6468ca474687e2f7da23bd38d"'
|
63
|
+
expires:
|
64
|
+
- Thu, 10 Nov 2011 19:06:50 GMT
|
65
|
+
last-modified:
|
66
|
+
- Thu, 10 Nov 2011 18:56:50 GMT
|
67
|
+
server:
|
68
|
+
- Apache/2.2.16 (Debian)
|
69
|
+
vary:
|
70
|
+
- Authorization,Accept-Language,Cookie
|
71
|
+
body: ! "{\n \"xml\": \"http://www.wolnelektury.pl/media/lektura/sonety-krymskie-ajudah_______.xml\",\n
|
72
|
+
\ \"themes\": [],\n \"genres\": [\n {\n \"href\": \"http://www.wolnelektury.pl/api/genres/sonet/\",\n
|
73
|
+
\ \"name\": \"Sonet\"\n }\n ],\n \"mobi\": \"http://www.wolnelektury.pl/media/book/mobi/ajudah.mobi\",\n
|
74
|
+
\ \"kinds\": [\n {\n \"href\": \"http://www.wolnelektury.pl/api/kinds/liryka/\",\n
|
75
|
+
\ \"name\": \"Liryka\"\n }\n ],\n \"parent\": {\n \"slug\":
|
76
|
+
\"sonety-krymskie\",\n \"title\": \"Sonety krymskie\"\n },\n \"title\":
|
77
|
+
\"Ajudah\",\n \"media\": \"<django.db.models.fields.related.RelatedManager
|
78
|
+
object at 0x7fe7d0ffc690>\",\n \"epochs\": [\n {\n \"href\":
|
79
|
+
\"http://www.wolnelektury.pl/api/epochs/romantyzm/\",\n \"name\":
|
80
|
+
\"Romantyzm\"\n }\n ],\n \"html\": \"http://www.wolnelektury.pl/media/book/html/ajudah.html\",\n
|
81
|
+
\ \"books\": [\n {\n \"href\": \"http://www.wolnelektury.pl/api/books/l-sonety-krymskie/\",\n
|
82
|
+
\ \"name\": \"Sonety krymskie\"\n }\n ],\n \"authors\":
|
83
|
+
[\n {\n \"href\": \"http://www.wolnelektury.pl/api/authors/adam-mickiewicz/\",\n
|
84
|
+
\ \"name\": \"Adam Mickiewicz\"\n }\n ],\n \"pdf\": \"http://www.wolnelektury.pl/media/lektura/sonety-krymskie-ajudah_1.pdf\",\n
|
85
|
+
\ \"txt\": \"http://www.wolnelektury.pl/media/lektura/ajudah.txt\",\n \"epub\":
|
86
|
+
\"\"\n}"
|
87
|
+
http_version: '1.1'
|
88
|
+
- !ruby/struct:VCR::HTTPInteraction
|
89
|
+
request: !ruby/struct:VCR::Request
|
90
|
+
method: :get
|
91
|
+
uri: http://www.wolnelektury.pl:80/media/lektura/ajudah.txt
|
92
|
+
body:
|
93
|
+
headers:
|
94
|
+
response: !ruby/struct:VCR::Response
|
95
|
+
status: !ruby/struct:VCR::ResponseStatus
|
96
|
+
code: 200
|
97
|
+
message: OK
|
98
|
+
headers:
|
99
|
+
content-type:
|
100
|
+
- text/plain
|
101
|
+
transfer-encoding:
|
102
|
+
- chunked
|
103
|
+
keep-alive:
|
104
|
+
- timeout=15, max=100
|
105
|
+
accept-ranges:
|
106
|
+
- bytes
|
107
|
+
date:
|
108
|
+
- Thu, 10 Nov 2011 18:56:50 GMT
|
109
|
+
last-modified:
|
110
|
+
- Mon, 24 Jan 2011 15:56:04 GMT
|
111
|
+
server:
|
112
|
+
- Apache/2.2.16 (Debian)
|
113
|
+
vary:
|
114
|
+
- Accept-Encoding
|
115
|
+
warning:
|
116
|
+
- 214 warkaz-fe03 "Transformation applied"
|
117
|
+
body: ! 'Adam Mickiewicz
|
118
|
+
|
119
|
+
|
120
|
+
Sonety krymskie
|
121
|
+
|
122
|
+
Ajudah
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
Lubię poglądać wsparty na Judahu skale,
|
128
|
+
|
129
|
+
Jak spienione bałwany, to w czarne szeregi
|
130
|
+
|
131
|
+
Ścisnąwszy się, buchają, to jak srébrne śniegi
|
132
|
+
|
133
|
+
W milionowych tęczach kołują wspaniale.
|
134
|
+
|
135
|
+
|
136
|
+
Trącą się o mieliznę, rozbiją na fale,
|
137
|
+
|
138
|
+
Jak wojsko wielorybów, zalegając brzegi,
|
139
|
+
|
140
|
+
Zdobędą ląd w tryumfie, i na powrót zbiegi,
|
141
|
+
|
142
|
+
Miecą za sobą muszle, perły i korale.
|
143
|
+
|
144
|
+
|
145
|
+
Podobnie na twe serce, o poeto młody!
|
146
|
+
|
147
|
+
Namiętność często groźne wzburza niepogody;
|
148
|
+
|
149
|
+
Lecz gdy podniesiesz bardon, ona bez twéj szkody
|
150
|
+
|
151
|
+
|
152
|
+
Ucieka w zapomnienia pogrążyć się toni,
|
153
|
+
|
154
|
+
I nieśmiertelne pieśni za sobą uroni,
|
155
|
+
|
156
|
+
Z których wieki uplotą ozdobę twych skroni.
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
-----
|
163
|
+
|
164
|
+
Ta lektura, podobnie jak tysiące innych, dostępna jest na stronie wolnelektury.pl.
|
165
|
+
|
166
|
+
Wersja lektury w opracowaniu merytorycznym i krytycznym (przypisy i motywy)
|
167
|
+
dostępna jest na stronie http://wolnelektury.pl/katalog/lektura/sonety-krymskie-ajudah.
|
168
|
+
|
169
|
+
|
170
|
+
Utwór opracowany został w ramach projektu Wolne Lektury przez fundację Nowoczesna
|
171
|
+
Polska.
|
172
|
+
|
173
|
+
|
174
|
+
Ten utwór nie jest chroniony prawem autorskim i znajduje się w domenie publicznej,
|
175
|
+
co oznacza że możesz go swobodnie wykorzystywać, publikować i rozpowszechniać.
|
176
|
+
Jeśli utwór opatrzony jest dodatkowymi materiałami (przypisy, motywy literackie
|
177
|
+
etc.), które podlegają prawu autorskiemu, to te dodatkowe materiały udostępnione
|
178
|
+
są na licencji Creative Commons Uznanie Autorstwa – Na Tych Samych Warunkach
|
179
|
+
3.0 PL (http://creativecommons.org/licenses/by-sa/3.0/).
|
180
|
+
|
181
|
+
|
182
|
+
Tekst opracowany na podstawie: Mickiewicz, Adam (1798-1855), Poezje, tom 2,
|
183
|
+
Wiersze z lat 1825-1855 (Pieśni - Sonety - Poezje patrjotyczne, religijne i
|
184
|
+
filozoficzne - Wiersze okolicznościowe - Bajki), wstęp i układ Józefa Kallenbacha,
|
185
|
+
objaśn. zaopatrzył Jan Bystrzycki, Krakowska Spółdzielnia Wydawnicza, wyd. 2
|
186
|
+
popr., druk. W. L. Anczyca, Kraków, 1928
|
187
|
+
|
188
|
+
|
189
|
+
Publikacja zrealizowana w ramach projektu Wolne Lektury (http://wolnelektury.pl).
|
190
|
+
Reprodukcja cyfrowa wykonana przez Bibliotekę Narodową z egzemplarza pochodzącego
|
191
|
+
ze zbiorów BN.
|
192
|
+
|
193
|
+
|
194
|
+
Opracowanie redakcyjne i przypisy: Aleksandra Sekuła, Olga Sutkowska
|
195
|
+
|
196
|
+
'
|
197
|
+
http_version: '1.1'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
gem 'minitest'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
require 'vcr'
|
7
|
+
|
8
|
+
require_relative '../lib/triphthong'
|
9
|
+
|
10
|
+
VCR.config do |config|
|
11
|
+
config.cassette_library_dir = 'spec/fixtures/vcr'
|
12
|
+
config.default_cassette_options = { record: :new_episodes }
|
13
|
+
config.stub_with :fakeweb
|
14
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module Triphthong describe Executable do
|
6
|
+
describe '.new' do
|
7
|
+
it 'validates --structure’s structure' do
|
8
|
+
error = '--structure must be of the form m+n (where m and n are numbers)'
|
9
|
+
-> { Executable.new ['build-db-from-txt', '-s', '1+2'] }
|
10
|
+
capture_io { -> { Executable.new ['build-db-from-txt', '-s', '1 + 2'] }.must_raise SystemExit }.last.must_include error
|
11
|
+
capture_io { -> { Executable.new ['build-db-from-txt', '-s', 'a+b'] }.must_raise SystemExit }.last.must_include error
|
12
|
+
capture_io { -> { Executable.new ['build-db-from-txt', '-s', '+1'] }.must_raise SystemExit }.last.must_include error
|
13
|
+
capture_io { -> { Executable.new ['build-db-from-txt', '-s', 'foo'] }.must_raise SystemExit }.last.must_include error
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#run' do
|
18
|
+
before { VCR.insert_cassette __name__ }
|
19
|
+
after { VCR.eject_cassette }
|
20
|
+
|
21
|
+
it 'creates structure- and rhyme-keyed Verse database' do
|
22
|
+
file = Tempfile.new ''
|
23
|
+
Executable.new(['build-db-from-txt', '-d', file.path, '-s', '6+17', '-s', '9+13', 'spec/fixtures/pan-tadeusz.intro.txt']).run
|
24
|
+
db = YAML::Store.new file.path
|
25
|
+
db.transaction(true) do
|
26
|
+
db['6+17']['acił'].must_equal [Verse.new('ty jesteś jak zdrowie: Ile cię trzeba cenić, ten tylko się dowie, Kto cię stracił.', 'pan-tadeusz.intro.txt')]
|
27
|
+
db['9+13']['obie'].must_equal [Verse.new('Dziś piękność twą w całej ozdobie Widzę i opisuję, bo tęsknię po tobie.', 'pan-tadeusz.intro.txt')]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'creates structure- and rhyme-keyed Verse database from API' do
|
32
|
+
file = Tempfile.new ''
|
33
|
+
Executable.new(['build-db-from-api', '-d', file.path]).run
|
34
|
+
db = YAML::Store.new file.path
|
35
|
+
db.transaction(true) do
|
36
|
+
db['7+6']['ody'].must_equal [Verse.new('Podobnie na twe serce, o poeto młody!', 'Ajudah (Adam Mickiewicz)')]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'rhymes!' do
|
41
|
+
stdout = capture_io { Executable.new(['rhyme', '-c', '400', '-d', 'spec/fixtures/db.yml', '-s', '7+6']).run }.first
|
42
|
+
stdout.size.must_be :<=, 400
|
43
|
+
stdout.count("\n").must_equal 4+1+4
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module Triphthong describe Text do
|
6
|
+
before do
|
7
|
+
@text = File.read('spec/fixtures/pan-tadeusz.intro.txt').extend Text
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#sentences' do
|
11
|
+
it 'returns an Enumerator' do
|
12
|
+
@text.sentences.must_be_instance_of Enumerator
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'yields Verses' do
|
16
|
+
@text.sentences.each { |s| s.must_be_instance_of Verse }
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'yields consecutive stentences from the given text' do
|
20
|
+
@text.sentences.map(&:text).must_equal [
|
21
|
+
'Litwo!',
|
22
|
+
'Ojczyzno moja!',
|
23
|
+
'ty jesteś jak zdrowie: Ile cię trzeba cenić, ten tylko się dowie, Kto cię stracił.',
|
24
|
+
'Dziś piękność twą w całej ozdobie Widzę i opisuję, bo tęsknię po tobie.',
|
25
|
+
]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module Triphthong describe Verse do
|
6
|
+
def pan_tadeusz_lines
|
7
|
+
@pan_tadeusz_lines ||= File.read('spec/fixtures/pan-tadeusz.txt').lines.map(&:chomp).reject do |line|
|
8
|
+
line.empty? or line.start_with? ' '
|
9
|
+
end.map { |line| Verse.new line }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#has_caesura_after?' do
|
13
|
+
it 'works with Pan Tadeusz cæsuræ' do
|
14
|
+
pan_tadeusz_lines.each do |line|
|
15
|
+
assert line.has_caesura_after?(7), "no cæsura after 7th syllable in ‘#{line}’"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#syllable_count' do
|
21
|
+
it 'works with Pan Tadusz verses' do
|
22
|
+
pan_tadeusz_lines.each do |line|
|
23
|
+
line.syllable_count.must_equal 13, "not 13 syllables in ‘#{line}’"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module Triphthong describe Verse do
|
6
|
+
describe '#has_caesura_after?' do
|
7
|
+
it 'returns a Boolean on whether the given String has a cæsura after the given syllable' do
|
8
|
+
verse = Verse.new 'Litwo! Ojczyzno moja! ty jesteś jak zdrowie!'
|
9
|
+
assert verse.has_caesura_after? 0
|
10
|
+
refute verse.has_caesura_after? 6
|
11
|
+
assert verse.has_caesura_after? 7
|
12
|
+
refute verse.has_caesura_after? 9
|
13
|
+
refute verse.has_caesura_after? 12
|
14
|
+
assert verse.has_caesura_after? 13
|
15
|
+
refute verse.has_caesura_after? 14
|
16
|
+
assert Verse.new('Podług niej później Karol-Kochanku-Radziwiłł').has_caesura_after? 7
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#has_structure?' do
|
21
|
+
it 'is a predicate whether a Verse has a given Structure' do
|
22
|
+
assert Verse.new('Litwo! Ojczyzno moja! ty jesteś jak zdrowie!').has_structure? '0+13'
|
23
|
+
refute Verse.new('Litwo! Ojczyzno moja! ty jesteś jak zdrowie!').has_structure? '0+14'
|
24
|
+
refute Verse.new('Litwo! Ojczyzno moja! ty jesteś jak zdrowie!').has_structure? '6+7'
|
25
|
+
assert Verse.new('Litwo! Ojczyzno moja! ty jesteś jak zdrowie!').has_structure? '7+6'
|
26
|
+
assert Verse.new('Podług niej później Karol-Kochanku-Radziwiłł').has_structure? '7+6'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#rhyme_pattern' do
|
31
|
+
it 'returns the rhyme pattern' do
|
32
|
+
Verse.new('Litwo! Ojczyzno moja! ty jesteś jak zdrowie!').rhyme_pattern.must_equal 'owie'
|
33
|
+
Verse.new('Nowogródzki ochraniasz z jego wiernym ludem!').rhyme_pattern.must_equal 'udem'
|
34
|
+
Verse.new('Bo je zbliżała dzieciom do ust po kolei;').rhyme_pattern.must_equal 'ei'
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'doesn’t care for word boundaries' do
|
38
|
+
Verse.new('…ją, Kasię!').rhyme_pattern.must_equal 'asię'
|
39
|
+
Verse.new('jjjąka się…').rhyme_pattern.must_equal 'asię'
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#rhymes_with?' do
|
45
|
+
it 'is a predicate whether two Verses rhyme' do
|
46
|
+
assert Verse.new('wyjaśnienie').rhymes_with? Verse.new 'wyżółcenie'
|
47
|
+
refute Verse.new('siejąc ferment').rhymes_with? Verse.new 'niczym Reymont'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'rejects rhymes based on repetition' do
|
51
|
+
refute Verse.new('Panowie').rhymes_with? Verse.new 'panowie'
|
52
|
+
refute Verse.new('nie odjechał!').rhymes_with? Verse.new 'z nami jechał.'
|
53
|
+
refute Verse.new('z nami jechał.').rhymes_with? Verse.new 'nie odjechał!'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe '#size' do
|
58
|
+
it 'returns the Verse’s size' do
|
59
|
+
Verse.new('ty jesteś jak zdrowie!').size.must_equal 22
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#source' do
|
64
|
+
it 'returns the source of the Verse' do
|
65
|
+
Verse.new('Litwo! Ojczyzno moja!', 'Pan Tadeusz').source.must_equal 'Pan Tadeusz'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#syllable_count' do
|
70
|
+
it 'returns the number of syllables' do
|
71
|
+
Verse.new('Litwo! Ojczyzno moja! ty jesteś jak zdrowie!').syllable_count.must_equal 13
|
72
|
+
end
|
73
|
+
|
74
|
+
def check_counts issue, hash
|
75
|
+
hash.each do |word, count|
|
76
|
+
Verse.new(word).syllable_count.must_equal count, "not #{count} syllables in ‘#{word}’ (#{issue} issue?)"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'handles edge cases' do
|
81
|
+
check_counts 'non-pl','Müller' => 2, 'Raphaël' => 3, 'Störch' => 1, 'Vorwärts' => 2
|
82
|
+
check_counts 'ae', 'aequo' => 2, 'aere' => 2, 'aerobic' => 4, 'irae' => 2
|
83
|
+
check_counts 'ai', 'betaina' => 4, 'Fontain' => 2
|
84
|
+
check_counts 'au', 'auto' => 2, 'inauguracja' => 5, 'kauczuk' => 2, 'naubijać' => 4, 'naubliżać' => 4, 'nauczanie' => 4, 'nauczka' => 3
|
85
|
+
check_counts 'au', 'nauka' => 3, 'nausznik' => 3, 'niezaułkowy' => 5, 'paranauka' => 5, 'zaułek' => 3, 'zauroczenie' => 5
|
86
|
+
check_counts 'eau', 'Escabeau' => 3, 'Fontainbleau' => 3, 'nieautoryzowany' => 7, 'nouveau' => 2, 'teleaudycja' => 5
|
87
|
+
check_counts 'eu', 'Contrôleur' => 3, 'Docteur' => 2, 'Eugeniusz' => 3, 'eunuch' => 3, 'Europa' => 3, 'muzeum' => 3, 'neutralny' => 4, 'nieuczciwy' => 4
|
88
|
+
check_counts 'eu', 'nieustraszony' => 5, 'Odyseusz' => 4, 'przeuczony' => 4, 'reumatyzm' => 3, 'seulski' => 3, 'Tadeusz' => 3, 'trofeum' => 3
|
89
|
+
check_counts 'ey', 'Doweyko' => 3
|
90
|
+
check_counts 'ia', 'akademia' => 4, 'Mia' => 2
|
91
|
+
check_counts 'ią', 'akademią' => 4, 'Mią' => 2
|
92
|
+
check_counts 'ie', 'akademie' => 4, 'Mie' => 2
|
93
|
+
check_counts 'ię', 'akademię' => 4, 'mię' => 1
|
94
|
+
check_counts 'ii', 'akademii' => 4, 'Mii' => 2
|
95
|
+
check_counts 'oi', 'foi' => 1
|
96
|
+
check_counts 'ou', 'jednousi' => 4, 'vous' => 1
|
97
|
+
check_counts 'oy', 'Soyez' => 2, 'Zamoyski' => 3
|
98
|
+
check_counts 'oyce', 'Joyce' => 1
|
99
|
+
check_counts 'ui', 'qui' => 1, 'quiz' => 1
|
100
|
+
check_counts 'uille', 'tranquille' => 2
|
101
|
+
check_counts 'uo', 'quo' => 1
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end end
|
data/triphthong.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Gem::Specification.new do |gem|
|
2
|
+
gem.name = 'triphthong'
|
3
|
+
gem.version = '0.0.0'
|
4
|
+
gem.summary = 'Triphthong: a syllable counter'
|
5
|
+
gem.description = 'Triphthong counts syllables in Polish text'
|
6
|
+
gem.homepage = 'https://github.com/chastell/triphthong'
|
7
|
+
gem.author = 'Piotr Szotkowski'
|
8
|
+
gem.email = 'chastell@chastell.net'
|
9
|
+
|
10
|
+
gem.files = `git ls-files -z`.split "\0"
|
11
|
+
gem.executables = `git ls-files -z -- bin/*`.split("\0").map { |file| File.basename file }
|
12
|
+
gem.test_files = `git ls-files -z -- spec/*`.split "\0"
|
13
|
+
|
14
|
+
gem.add_dependency 'srx-polish'
|
15
|
+
gem.add_dependency 'trollop'
|
16
|
+
gem.add_dependency 'unicode'
|
17
|
+
gem.add_development_dependency 'fakeweb'
|
18
|
+
gem.add_development_dependency 'minitest', '>= 2.3'
|
19
|
+
gem.add_development_dependency 'rake'
|
20
|
+
gem.add_development_dependency 'vcr'
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: triphthong
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Piotr Szotkowski
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: srx-polish
|
16
|
+
requirement: &22261340 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *22261340
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: trollop
|
27
|
+
requirement: &22278920 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *22278920
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: unicode
|
38
|
+
requirement: &22278420 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *22278420
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: fakeweb
|
49
|
+
requirement: &22277980 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *22277980
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: minitest
|
60
|
+
requirement: &22277460 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '2.3'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *22277460
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: &22276960 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *22276960
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: vcr
|
82
|
+
requirement: &22276360 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *22276360
|
91
|
+
description: Triphthong counts syllables in Polish text
|
92
|
+
email: chastell@chastell.net
|
93
|
+
executables:
|
94
|
+
- triphthong
|
95
|
+
extensions: []
|
96
|
+
extra_rdoc_files: []
|
97
|
+
files:
|
98
|
+
- .rvmrc
|
99
|
+
- Gemfile
|
100
|
+
- Gemfile.lock
|
101
|
+
- LICENCE
|
102
|
+
- README.md
|
103
|
+
- Rakefile
|
104
|
+
- bin/triphthong
|
105
|
+
- db.yml
|
106
|
+
- lib/triphthong.rb
|
107
|
+
- lib/triphthong/executable.rb
|
108
|
+
- lib/triphthong/text.rb
|
109
|
+
- lib/triphthong/verse.rb
|
110
|
+
- spec/fixtures/db.yml
|
111
|
+
- spec/fixtures/pan-tadeusz.intro.txt
|
112
|
+
- spec/fixtures/pan-tadeusz.txt
|
113
|
+
- spec/fixtures/vcr/test_0002_creates_structure_and_rhyme_keyed_verse_database_from_api.yml
|
114
|
+
- spec/spec_helper.rb
|
115
|
+
- spec/triphthong/executable_spec.rb
|
116
|
+
- spec/triphthong/text_spec.rb
|
117
|
+
- spec/triphthong/verse_slow_spec.rb
|
118
|
+
- spec/triphthong/verse_spec.rb
|
119
|
+
- triphthong.gemspec
|
120
|
+
homepage: https://github.com/chastell/triphthong
|
121
|
+
licenses: []
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 1.8.10
|
141
|
+
signing_key:
|
142
|
+
specification_version: 3
|
143
|
+
summary: ! 'Triphthong: a syllable counter'
|
144
|
+
test_files:
|
145
|
+
- spec/fixtures/db.yml
|
146
|
+
- spec/fixtures/pan-tadeusz.intro.txt
|
147
|
+
- spec/fixtures/pan-tadeusz.txt
|
148
|
+
- spec/fixtures/vcr/test_0002_creates_structure_and_rhyme_keyed_verse_database_from_api.yml
|
149
|
+
- spec/spec_helper.rb
|
150
|
+
- spec/triphthong/executable_spec.rb
|
151
|
+
- spec/triphthong/text_spec.rb
|
152
|
+
- spec/triphthong/verse_slow_spec.rb
|
153
|
+
- spec/triphthong/verse_spec.rb
|