chimp_rewriter 1.0.0.pre1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{README.adoc → README.md} +17 -7
- data/example/raven.rb +157 -0
- data/lib/chimp_rewriter/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88ae9dfec0f37c5b8f3735e31ab4786762681d67
|
4
|
+
data.tar.gz: 7ec0032ab4ada635d8a514cbbbe62ed06adbbf85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d60cd21992645021149bb9e290e1d5592d5f33d8433ef35d335030c7ea0f318dba6d6001e59d48128c64f41408bf404ae81e8496dc975c041ff27a254b011f66
|
7
|
+
data.tar.gz: ca67becac50d008536ee52ee826f317be33c6b1f605323cf02313f9accbdf25b3b8b8e4c7da42b5b21ab500d96473431121210df7bcc9c3d525c502aedaeeae2
|
data/{README.adoc → README.md}
RENAMED
@@ -1,6 +1,8 @@
|
|
1
1
|
ChimpRewriter
|
2
2
|
=============
|
3
3
|
|
4
|
+
[![Gem Version](https://img.shields.io/gem/v/chimp_rewriter.svg?style=flat-square)](https://rubygems.org/gems/chimp_rewriter)
|
5
|
+
|
4
6
|
The project provides tools to make requests to the Chimp Rewriter API. The API
|
5
7
|
is used to automatically spin and rewrite articles using a host of intelligent
|
6
8
|
algorithms, phrases and synonyms.
|
@@ -20,13 +22,15 @@ arbitrary string, however it will change in future). Two methods:
|
|
20
22
|
return text as well. Additional options may be passed in optional hash.
|
21
23
|
+#statistics+ returns account usage statistics, limits etc.
|
22
24
|
|
23
|
-
|
25
|
+
All actions raise +ChimpRewriter::ChimpRewriterError+ with descriptive
|
26
|
+
message when API response indicates failure.
|
27
|
+
|
28
|
+
For detailed description of each action and allowed options, refer
|
29
|
+
to: http://chimprewriter.com/api/documentation/
|
24
30
|
|
25
|
-
|
26
|
-
failure.
|
31
|
+
Brief usage example:
|
27
32
|
|
28
|
-
|
29
|
-
-------------
|
33
|
+
```ruby
|
30
34
|
client = ChimpRewriter.new(email, application_identifier, api_key) }
|
31
35
|
client.statistics
|
32
36
|
# => OpenStruct, contains statistics
|
@@ -34,8 +38,14 @@ client.chimp_rewrite "I wandered lonely as a cloud", quality: 4
|
|
34
38
|
# => String, spin results
|
35
39
|
client.create_spin "I wandered lonely as a cloud", reorderparagraphs: true
|
36
40
|
# => String, spin results
|
37
|
-
|
41
|
+
```
|
42
|
+
|
43
|
+
Another example in +example/raven.rb+. To run it just clone the repo and run
|
44
|
+
in that directory.
|
38
45
|
|
46
|
+
```bash
|
47
|
+
/usr/bin/env CR_EMAIL="my@email.com" CR_APP_ID="app.id" CR_API_KEY="api_key" ruby -Ilib example/raven.rb
|
48
|
+
```
|
39
49
|
|
40
50
|
Installation
|
41
51
|
------------
|
@@ -56,7 +66,7 @@ Or install it yourself as:
|
|
56
66
|
Contributing
|
57
67
|
------------
|
58
68
|
|
59
|
-
1. Fork it
|
69
|
+
1. Fork it
|
60
70
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
61
71
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
62
72
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/example/raven.rb
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
# Chimp Rewriter is not designed to write poetry, so results may look bit odd.
|
2
|
+
#
|
3
|
+
# Run this example from project root with:
|
4
|
+
#
|
5
|
+
# /usr/bin/env CR_EMAIL="my@email.com" CR_APP_ID="app.id" CR_API_KEY="api_key" ruby -Ilib example/raven.rb
|
6
|
+
|
7
|
+
require "chimp_rewriter"
|
8
|
+
|
9
|
+
email, app_id, api_key = %w[CR_EMAIL CR_APP_ID CR_API_KEY].map{ |var| ENV[var] }
|
10
|
+
poem = DATA.read
|
11
|
+
|
12
|
+
client = ChimpRewriter.new(email, app_id, api_key)
|
13
|
+
|
14
|
+
puts "*" * 80
|
15
|
+
puts
|
16
|
+
puts "CHIMP REWRITE:"
|
17
|
+
puts client.chimp_rewrite poem, quality: 3, reorderparagraphs: true,
|
18
|
+
rewrite: true, phrase_quality: 3,
|
19
|
+
sentencerewrite: true
|
20
|
+
puts
|
21
|
+
puts "*" * 80
|
22
|
+
puts
|
23
|
+
puts "CREATE SPIN:"
|
24
|
+
puts client.chimp_rewrite poem, reorderparagraphs: true
|
25
|
+
puts
|
26
|
+
puts "*" * 80
|
27
|
+
puts
|
28
|
+
puts "STATISTICS:"
|
29
|
+
puts client.statistics.to_h.to_yaml
|
30
|
+
puts "*" * 80
|
31
|
+
|
32
|
+
__END__
|
33
|
+
Once upon a midnight dreary, while I pondered, weak and weary,
|
34
|
+
Over many a quaint and curious volume of forgotten lore,
|
35
|
+
While I nodded, nearly napping, suddenly there came a tapping,
|
36
|
+
As of some one gently rapping, rapping at my chamber door.
|
37
|
+
'Tis some visitor, I muttered, tapping at my chamber door-
|
38
|
+
Only this, and nothing more.
|
39
|
+
|
40
|
+
Ah, distinctly I remember it was in the bleak December,
|
41
|
+
And each separate dying ember wrought its ghost upon the floor.
|
42
|
+
Eagerly I wished the morrow;- vainly I had sought to borrow
|
43
|
+
From my books surcease of sorrow- sorrow for the lost Lenore-
|
44
|
+
For the rare and radiant maiden whom the angels name Lenore-
|
45
|
+
Nameless here for evermore.
|
46
|
+
|
47
|
+
And the silken sad uncertain rustling of each purple curtain
|
48
|
+
Thrilled me- filled me with fantastic terrors never felt before;
|
49
|
+
So that now, to still the beating of my heart, I stood repeating,
|
50
|
+
'Tis some visitor entreating entrance at my chamber door-
|
51
|
+
Some late visitor entreating entrance at my chamber door;-
|
52
|
+
This it is, and nothing more.
|
53
|
+
|
54
|
+
Presently my soul grew stronger; hesitating then no longer,
|
55
|
+
Sir, said I, or Madam, truly your forgiveness I implore;
|
56
|
+
But the fact is I was napping, and so gently you came rapping,
|
57
|
+
And so faintly you came tapping, tapping at my chamber door,
|
58
|
+
That I scarce was sure I heard you- here I opened wide the door;-
|
59
|
+
Darkness there, and nothing more.
|
60
|
+
|
61
|
+
Deep into that darkness peering, long I stood there wondering, fearing,
|
62
|
+
Doubting, dreaming dreams no mortals ever dared to dream before;
|
63
|
+
But the silence was unbroken, and the stillness gave no token,
|
64
|
+
And the only word there spoken was the whispered word, Lenore!
|
65
|
+
This I whispered, and an echo murmured back the word, Lenore!-
|
66
|
+
Merely this, and nothing more.
|
67
|
+
|
68
|
+
Back into the chamber turning, all my soul within me burning,
|
69
|
+
Soon again I heard a tapping somewhat louder than before.
|
70
|
+
Surely, said I, surely that is something at my window lattice:
|
71
|
+
Let me see, then, what thereat is, and this mystery explore-
|
72
|
+
Let my heart be still a moment and this mystery explore;-
|
73
|
+
'Tis the wind and nothing more.
|
74
|
+
|
75
|
+
Open here I flung the shutter, when, with many a flirt and flutter,
|
76
|
+
In there stepped a stately raven of the saintly days of yore;
|
77
|
+
Not the least obeisance made he; not a minute stopped or stayed he;
|
78
|
+
But, with mien of lord or lady, perched above my chamber door-
|
79
|
+
Perched upon a bust of Pallas just above my chamber door-
|
80
|
+
Perched, and sat, and nothing more.
|
81
|
+
|
82
|
+
Then this ebony bird beguiling my sad fancy into smiling,
|
83
|
+
By the grave and stern decorum of the countenance it wore.
|
84
|
+
Though thy crest be shorn and shaven, thou, I said, art sure no craven,
|
85
|
+
Ghastly grim and ancient raven wandering from the Nightly shore-
|
86
|
+
Tell me what thy lordly name is on the Night's Plutonian shore!
|
87
|
+
Quoth the Raven, Nevermore.
|
88
|
+
|
89
|
+
Much I marvelled this ungainly fowl to hear discourse so plainly,
|
90
|
+
Though its answer little meaning- little relevancy bore;
|
91
|
+
For we cannot help agreeing that no living human being
|
92
|
+
Ever yet was blest with seeing bird above his chamber door-
|
93
|
+
Bird or beast upon the sculptured bust above his chamber door,
|
94
|
+
With such name as Nevermore.
|
95
|
+
|
96
|
+
But the raven, sitting lonely on the placid bust, spoke only
|
97
|
+
That one word, as if his soul in that one word he did outpour.
|
98
|
+
Nothing further then he uttered- not a feather then he fluttered-
|
99
|
+
Till I scarcely more than muttered, other friends have flown before-
|
100
|
+
On the morrow he will leave me, as my hopes have flown before.
|
101
|
+
Then the bird said, Nevermore.
|
102
|
+
|
103
|
+
Startled at the stillness broken by reply so aptly spoken,
|
104
|
+
Doubtless, said I, what it utters is its only stock and store,
|
105
|
+
Caught from some unhappy master whom unmerciful Disaster
|
106
|
+
Followed fast and followed faster till his songs one burden bore-
|
107
|
+
Till the dirges of his Hope that melancholy burden bore
|
108
|
+
Of 'Never- nevermore'.
|
109
|
+
|
110
|
+
But the Raven still beguiling all my fancy into smiling,
|
111
|
+
Straight I wheeled a cushioned seat in front of bird, and bust and door;
|
112
|
+
Then upon the velvet sinking, I betook myself to linking
|
113
|
+
Fancy unto fancy, thinking what this ominous bird of yore-
|
114
|
+
What this grim, ungainly, ghastly, gaunt and ominous bird of yore
|
115
|
+
Meant in croaking Nevermore.
|
116
|
+
|
117
|
+
This I sat engaged in guessing, but no syllable expressing
|
118
|
+
To the fowl whose fiery eyes now burned into my bosom's core;
|
119
|
+
This and more I sat divining, with my head at ease reclining
|
120
|
+
On the cushion's velvet lining that the lamplight gloated o'er,
|
121
|
+
But whose velvet violet lining with the lamplight gloating o'er,
|
122
|
+
She shall press, ah, nevermore!
|
123
|
+
|
124
|
+
Then methought the air grew denser, perfumed from an unseen censer
|
125
|
+
Swung by Seraphim whose footfalls tinkled on the tufted floor.
|
126
|
+
Wretch, I cried, thy God hath lent thee- by these angels he hath sent thee
|
127
|
+
Respite- respite and nepenthe, from thy memories of Lenore!
|
128
|
+
Quaff, oh quaff this kind nepenthe and forget this lost Lenore!
|
129
|
+
Quoth the Raven, Nevermore.
|
130
|
+
|
131
|
+
Prophet! said I, thing of evil!- prophet still, if bird or devil!-
|
132
|
+
Whether Tempter sent, or whether tempest tossed thee here ashore,
|
133
|
+
Desolate yet all undaunted, on this desert land enchanted-
|
134
|
+
On this home by horror haunted- tell me truly, I implore-
|
135
|
+
Is there- is there balm in Gilead?- tell me- tell me, I implore!
|
136
|
+
Quoth the Raven, Nevermore.
|
137
|
+
|
138
|
+
Prophet! said I, thing of evil- prophet still, if bird or devil!
|
139
|
+
By that Heaven that bends above us- by that God we both adore-
|
140
|
+
Tell this soul with sorrow laden if, within the distant Aidenn,
|
141
|
+
It shall clasp a sainted maiden whom the angels name Lenore-
|
142
|
+
Clasp a rare and radiant maiden whom the angels name Lenore.
|
143
|
+
Quoth the Raven, Nevermore.
|
144
|
+
|
145
|
+
Be that word our sign in parting, bird or fiend, I shrieked, upstarting-
|
146
|
+
Get thee back into the tempest and the Night's Plutonian shore!
|
147
|
+
Leave no black plume as a token of that lie thy soul hath spoken!
|
148
|
+
Leave my loneliness unbroken!- quit the bust above my door!
|
149
|
+
Take thy beak from out my heart, and take thy form from off my door!
|
150
|
+
Quoth the Raven, Nevermore.
|
151
|
+
|
152
|
+
And the Raven, never flitting, still is sitting, still is sitting
|
153
|
+
On the pallid bust of Pallas just above my chamber door;
|
154
|
+
And his eyes have all the seeming of a demon's that is dreaming,
|
155
|
+
And the lamplight o'er him streaming throws his shadow on the floor;
|
156
|
+
And my soul from out that shadow that lies floating on the floor
|
157
|
+
Shall be lifted- nevermore!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chimp_rewriter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Skałacki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -111,9 +111,10 @@ files:
|
|
111
111
|
- COPYING-RUBY
|
112
112
|
- Gemfile
|
113
113
|
- Guardfile
|
114
|
-
- README.
|
114
|
+
- README.md
|
115
115
|
- Rakefile
|
116
116
|
- chimp_rewriter.gemspec
|
117
|
+
- example/raven.rb
|
117
118
|
- lib/chimp_rewriter.rb
|
118
119
|
- lib/chimp_rewriter/version.rb
|
119
120
|
- spec/api_actions_spec.rb
|
@@ -134,9 +135,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
135
|
version: '0'
|
135
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
137
|
requirements:
|
137
|
-
- - "
|
138
|
+
- - ">="
|
138
139
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
140
|
+
version: '0'
|
140
141
|
requirements: []
|
141
142
|
rubyforge_project:
|
142
143
|
rubygems_version: 2.2.2
|