guillaume 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.rspec +1 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.markdown +46 -0
- data/Rakefile +4 -0
- data/bin/guillaume +38 -0
- data/config/database.yaml.example +1 -0
- data/data/call_of_the_wild.txt +400 -0
- data/data/heart_of_darkness.txt +228 -0
- data/data/moby_dick.txt +21712 -0
- data/data/the_picture_of_dorian_gray.txt +3118 -0
- data/guillaume.gemspec +23 -0
- data/lib/guillaume/base.rb +2 -0
- data/lib/guillaume/line.rb +29 -0
- data/lib/guillaume/poem.rb +51 -0
- data/lib/guillaume/poetics.rb +13 -0
- data/lib/guillaume/source_text.rb +34 -0
- data/lib/guillaume/version.rb +3 -0
- data/lib/guillaume.rb +13 -0
- data/spec/data/zone.txt +4 -0
- data/spec/source_text_spec.rb +23 -0
- data/spec/spec_helper.rb +5 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e6a5298af00338822dae0cdb50b064b657c1eef4
|
4
|
+
data.tar.gz: e3f29364c026d37449a65863ac2c417b8b29e120
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 691281cfe1cc370b8b6b6c0527cd059eaba9a8cdc14161d6aeef0b20da4d9598fd9f0c3b37ddab5a475e58c5b6fcef2a4df20c8250d9b1f44d38b0885647cf27
|
7
|
+
data.tar.gz: 5f328a7ac6368bd20117fa095656ff2ef0d05ec2b8ed92a5fc07c8fa2b9a186bd620374a49c91049e5988688a8a1557ee506ac248f13f2812f1470c761a5f752
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Jamey J. DeOrio
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Guillaume
|
2
|
+
|
3
|
+
Guillaume is a generative poetry creation tool.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem "guillaume"
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install guillaume
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### Command line
|
22
|
+
|
23
|
+
Usage: guillaume /path/to/text_source.txt
|
24
|
+
-v, --verbose Verbose output while writing
|
25
|
+
-m, --max-stanzas STANZAS Maximum number of stanzas to write
|
26
|
+
|
27
|
+
### Gem
|
28
|
+
|
29
|
+
require "guillaume"
|
30
|
+
source_text_file = Guillaume::SourceText.new("/path/to/text_source.txt")
|
31
|
+
poem = Guillaume::Poem.new(source_text_file, max_stanzas: 5)
|
32
|
+
puts poem.formatted
|
33
|
+
|
34
|
+
## TODO
|
35
|
+
|
36
|
+
- establish data storage
|
37
|
+
- write separate parsing methods for poetry (linebreak-aware) and literature (linebreak-agnostic)
|
38
|
+
- write functionality for staying/straying from topics
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
1. Fork it
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/guillaume
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
require "guillaume"
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
option_parser = OptionParser.new do |opts|
|
8
|
+
opts.banner = "Usage: guillaume /path/to/text_source.txt"
|
9
|
+
|
10
|
+
opts.on("-v", "--verbose", "Verbose output while writing") do
|
11
|
+
$LOGGER.level = Logger::INFO
|
12
|
+
end
|
13
|
+
|
14
|
+
options[:max_stanzas] = 10
|
15
|
+
opts.on("-m", "--max-stanzas STANZAS", Integer, "Maximum number of stanzas to write") do |m|
|
16
|
+
options[:max_stanzas] = m
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
option_parser.parse!
|
21
|
+
|
22
|
+
source_text_file = ARGV.pop
|
23
|
+
|
24
|
+
if !source_text_file && options.empty?
|
25
|
+
puts option_parser.help
|
26
|
+
exit
|
27
|
+
end
|
28
|
+
|
29
|
+
# required
|
30
|
+
unless source_text_file
|
31
|
+
raise ArgumentError, "Please point to a source text file"
|
32
|
+
end
|
33
|
+
|
34
|
+
# validations
|
35
|
+
|
36
|
+
poem = Guillaume::Poem.new(Guillaume::SourceText.new(source_text_file), max_stanzas: options[:max_stanzas])
|
37
|
+
puts ""
|
38
|
+
puts poem.formatted
|
@@ -0,0 +1 @@
|
|
1
|
+
connection_string: "sqlite://development.db"
|