rundown 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5e54ef59d983a7d1f98f55bcc4fbf694d7e7769c
4
+ data.tar.gz: 096954c27519ba7beba4c869aebaba0e6d6b101b
5
+ SHA512:
6
+ metadata.gz: ce18b0c8c376fd9dc1f5ea669666654f96fcde8e20f6aefa60fada8322bf1baf96c26123e3adfbde9c68edf3fae2f1357054406dca7664da6e527c1769905c95
7
+ data.tar.gz: e81780b0f744a42b73b5a1e4217276643c98083b7f4ea03df91b0204138a822f9ee17a6dd413fccbee84efb5b603b8e0f7a70ac546dc074f6172b88be913963f
@@ -10,6 +10,7 @@ require 'rundown/processors/email'
10
10
  require 'rundown/processors/dates'
11
11
  require 'rundown/processors/links'
12
12
  require 'rundown/processors/phone'
13
+ require 'rundown/processors/reading_time'
13
14
  require 'rundown/processors/sentiment'
14
15
  require 'rundown/processors/twitter'
15
16
 
@@ -21,5 +21,13 @@ module Rundown
21
21
  def sentiment
22
22
  @sentiment ||= Processors::Sentiment.new(text).process
23
23
  end
24
+
25
+ def usernames
26
+ @usernames ||= Processors::Twitter.new(text).process
27
+ end
28
+
29
+ def hashtags
30
+ @hashtags ||= Processors::Hashtags.new(text).process
31
+ end
24
32
  end
25
33
  end
@@ -0,0 +1,9 @@
1
+ module Rundown
2
+ module Processors
3
+ class Hashtags < Rundown::Processor
4
+ def process
5
+ words.select { |word| word.start_with?('#') }
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ module Rundown
2
+ module Processors
3
+ class ReadingTime < Rundown::Processor
4
+ RATE = 0.312
5
+
6
+ attr_accessor :reading_rate
7
+
8
+ def initialize(words, reading_rate=RATE)
9
+ super(words)
10
+ @reading_rate = reading_rate
11
+ end
12
+
13
+ def process
14
+ words.size * reading_rate
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Rundown
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ module Rundown
4
+ module Processors
5
+ describe ReadingTime do
6
+ describe 'reading time' do
7
+ {
8
+ "I will see you on 12/15/2013" => 1.87,
9
+ " the 28th of december." => 1.56
10
+ }.each do |input, expected|
11
+ it "parse '#{input}' to '#{expected}'" do
12
+ expect(Rundown::Processors::ReadingTime.new(input).process.round(2)).to eql(expected)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -41,6 +41,12 @@ David (david32@gmail.com)"
41
41
  expect(subject.emails).to eql(["me@example.com"])
42
42
  end
43
43
 
44
+ it 'extracts dates' do
45
+ now = Date.today
46
+ expected = "#{now.year}#{now.month.to_s.rjust(2, '0')}18"
47
+ expect(subject.dates.map(&:start_date).map(&:date)).to eql([expected])
48
+ end
49
+
44
50
  it 'extracts phone numbers' do
45
51
  expect(subject.phones).to eql(["07912345678"])
46
52
  end
metadata CHANGED
@@ -1,110 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rundown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jared Fraser
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-07 00:00:00.000000000 Z
11
+ date: 2014-11-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: nickel
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: phony
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: sentiment_parser
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: bundler
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: '1.3'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: '1.3'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rake
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rspec
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  description: Extracts dates, phone numbers, sentiment and other items from naturally
@@ -115,9 +102,9 @@ executables: []
115
102
  extensions: []
116
103
  extra_rdoc_files: []
117
104
  files:
118
- - .gitignore
119
- - .rspec
120
- - .travis.yml
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".travis.yml"
121
108
  - Gemfile
122
109
  - README.md
123
110
  - Rakefile
@@ -126,8 +113,10 @@ files:
126
113
  - lib/rundown/processor.rb
127
114
  - lib/rundown/processors/dates.rb
128
115
  - lib/rundown/processors/email.rb
116
+ - lib/rundown/processors/hashtags.rb
129
117
  - lib/rundown/processors/links.rb
130
118
  - lib/rundown/processors/phone.rb
119
+ - lib/rundown/processors/reading_time.rb
131
120
  - lib/rundown/processors/sentiment.rb
132
121
  - lib/rundown/processors/twitter.rb
133
122
  - lib/rundown/version.rb
@@ -137,6 +126,7 @@ files:
137
126
  - spec/processors/dates_spec.rb
138
127
  - spec/processors/email_spec.rb
139
128
  - spec/processors/phone_spec.rb
129
+ - spec/processors/reading_time_spec.rb
140
130
  - spec/processors/sentiment_spec.rb
141
131
  - spec/processors/twitter_spec.rb
142
132
  - spec/rundown_spec.rb
@@ -144,39 +134,33 @@ files:
144
134
  homepage: ''
145
135
  licenses:
146
136
  - MIT
137
+ metadata: {}
147
138
  post_install_message:
148
139
  rdoc_options: []
149
140
  require_paths:
150
141
  - lib
151
142
  required_ruby_version: !ruby/object:Gem::Requirement
152
- none: false
153
143
  requirements:
154
- - - ! '>='
144
+ - - ">="
155
145
  - !ruby/object:Gem::Version
156
146
  version: '0'
157
- segments:
158
- - 0
159
- hash: -2020343493529302066
160
147
  required_rubygems_version: !ruby/object:Gem::Requirement
161
- none: false
162
148
  requirements:
163
- - - ! '>='
149
+ - - ">="
164
150
  - !ruby/object:Gem::Version
165
151
  version: '0'
166
- segments:
167
- - 0
168
- hash: -2020343493529302066
169
152
  requirements: []
170
153
  rubyforge_project:
171
- rubygems_version: 1.8.25
154
+ rubygems_version: 2.2.2
172
155
  signing_key:
173
- specification_version: 3
156
+ specification_version: 4
174
157
  summary: Natural Language Processor
175
158
  test_files:
176
159
  - spec/processor_spec.rb
177
160
  - spec/processors/dates_spec.rb
178
161
  - spec/processors/email_spec.rb
179
162
  - spec/processors/phone_spec.rb
163
+ - spec/processors/reading_time_spec.rb
180
164
  - spec/processors/sentiment_spec.rb
181
165
  - spec/processors/twitter_spec.rb
182
166
  - spec/rundown_spec.rb