style-scanner 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -11,6 +11,7 @@ coverage
11
11
  doc/
12
12
  lib/bundler/man
13
13
  log/*
14
+ performance_report.html
14
15
  pkg
15
16
  rdoc
16
17
  spec/reports
data/bin/style-scanner CHANGED
@@ -5,7 +5,16 @@ options = Trollop::options do
5
5
  opt :html, "HTML input", :default => false
6
6
  opt :textile, "Textile input", :default => false
7
7
  opt :spellcheck, "Spell check", :default => false
8
+ opt :profile, "Peformance Profile (DEV)", :default => false
8
9
  end
10
+
11
+ if options[:profile]
12
+ include StyleScanner::ProfilingHelpers
13
+ start_profiling
14
+ end
15
+
9
16
  puts "=> Scanning for spelling error and style problems. May take a minute.\n".green
10
17
  puts ["Problem Type".red, "Original Sentence".green, "Offending Word".yellow].join(" | ")
11
18
  StyleScanner::Scanner.new(ARGF.read, options).scan
19
+
20
+ output_profilng_results if options[:profile]
@@ -0,0 +1,13 @@
1
+ # WHAT: Turn the cliches.txt file into stemmed cliches
2
+ # WHY: Faster to do the necessary stemming work in advance
3
+ # USAGE: ruby generate_stemmed_cliches.rb
4
+ #
5
+ require "style_scanner"
6
+
7
+ def self.generate_stemmed_cliches_file
8
+ stemmed_cliches_file = File.join(File.dirname(__FILE__), "lib", "dictionaries", "stemmed_cliches.txt")
9
+ stemmed_cliches = StyleScanner::SentenceScans::Cliche.stemmed_cliches
10
+ File.new(stemmed_cliches_file, "w").puts stemmed_cliches
11
+ end
12
+
13
+ generate_stemmed_cliches_file
@@ -0,0 +1,680 @@
1
+ tis the season
2
+ 2020 hindsight
3
+ 247
4
+ 800 pound gorilla
5
+ a few cans short of a six-pack
6
+ a leading provider of
7
+ a plus for all stakeholders
8
+ ace in the hole
9
+ ace up your sleeve
10
+ acid test
11
+ actionable
12
+ airing dirty laundry
13
+ all booster no payload
14
+ all foam no beer
15
+ all foam no beer
16
+ all hammer no nail
17
+ all hat no cattle
18
+ all icing no cake
19
+ all in a days work
20
+ all lime and salt no tequila
21
+ all missile no warhead
22
+ all shot no powder
23
+ all sizzle no steak
24
+ all talk no action
25
+ all that and a bag of chips
26
+ all thumbs
27
+ all wax and no wick
28
+ all wet
29
+ alls fair in love and war
30
+ almighty dollar
31
+ always a bridesmaid
32
+ ambulance chaser
33
+ another day another dollar
34
+ ants in your pants
35
+ apple-pie order
36
+ arm and a leg
37
+ armchair quarterback
38
+ army brat
39
+ art imitates life
40
+ artsy-craftsy
41
+ artsy-fartsy
42
+ as luck would have it
43
+ as old as time
44
+ at loggerheads
45
+ at the end of the day
46
+ babe in the woods
47
+ back against the wall
48
+ back in the saddle
49
+ back to squar one
50
+ back to the drawing board
51
+ bad to the bone
52
+ badge of honor
53
+ badonkadonk
54
+ ballpark figure
55
+ balls to the wall
56
+ baptism of fire
57
+ bare bones
58
+ bark is worse than the bite
59
+ bark up the wrong tree
60
+ bat out of hell
61
+ bats in the belfry
62
+ battle royal
63
+ beat around the bush
64
+ beat the bushes
65
+ beats me
66
+ behind the eight ball
67
+ benchmark
68
+ bent out of shape
69
+ best foot forward
70
+ best of breed
71
+ best practices
72
+ bet your bottom dollar
73
+ better half
74
+ better late than never
75
+ better mousetrap
76
+ better safe than sorry
77
+ better than ever
78
+ better the devil you know
79
+ between a rock and a hard place
80
+ beyond the pale
81
+ bib and tucker
82
+ big as life
83
+ big fish in a small pond
84
+ big man on campus
85
+ bigger they ar
86
+ bird in the hand
87
+ birds and the bees
88
+ birds of the feather
89
+ bite the dust
90
+ bite your tongue
91
+ bitter disappointment
92
+ black as coal
93
+ blast from the past
94
+ bleeding heart
95
+ blind as a bat
96
+ blood is thicker than water
97
+ blood money
98
+ blood on your hands
99
+ blood sweat and tears
100
+ blow this pop stand joint
101
+ blush bride
102
+ body by fisher brains by mattel
103
+ boil it down to
104
+ bone of contention
105
+ boots on the ground
106
+ booze and broads
107
+ bored to tears
108
+ born and rais
109
+ born with a silver spoon in your mouth
110
+ born yesterday
111
+ bottom line
112
+ brain drain
113
+ brain dump
114
+ brass tacks
115
+ bring home the bacon
116
+ bring our a game
117
+ bring a lot of value to the table
118
+ broken record
119
+ brothers keeper
120
+ bull by the horns
121
+ bull in a china shop
122
+ bump in the night
123
+ busy as a bee
124
+ but seriously
125
+ by and large
126
+ calm before the storm
127
+ cant cut the mustard
128
+ candle at both ends
129
+ case of mistaken identity
130
+ cast a wider net
131
+ cat got your tongue
132
+ cat out of the bag
133
+ caught red-handed
134
+ change agent
135
+ chapter and verse
136
+ checkered career
137
+ chickens come home to
138
+ chomp at the bit
139
+ circle back
140
+ cleanliness is next to
141
+ clear as a bell
142
+ clear as mud
143
+ client-centered
144
+ cold shoulder
145
+ communist conspiracy
146
+ conniption fit
147
+ core competency
148
+ could care less
149
+ couldnt care less
150
+ couldnt get to first base
151
+ count your blessings
152
+ countless hours
153
+ creature comfort
154
+ crime in the street
155
+ curiosity kill the cat
156
+ curri favor
157
+ cut a fine figure
158
+ cut and dri
159
+ cut to the chase
160
+ cut to the quick
161
+ cute as a button
162
+ darkest before the dawn
163
+ dead as a doornail
164
+ death and destruction
165
+ death and taxes
166
+ deaths doorstep
167
+ devil is in the details
168
+ dim view
169
+ do no evil
170
+ dog days
171
+ dog in the manger
172
+ dont count your chickens before theyre hatch
173
+ dont do the crime if you cant do the time
174
+ dont throw out the baby with the bathwater
175
+ doubt thomas
176
+ down and dirty
177
+ down in the dumps
178
+ down pat
179
+ down the draintoilet
180
+ down the hatch
181
+ down to earth
182
+ downsizing
183
+ drinking kool-aid
184
+ drive you up a wall
185
+ drop the ball
186
+ dutch uncle
187
+ dy in the wool
188
+ e-ticket
189
+ ear to the ground
190
+ early bird catch the worm
191
+ easier said than done
192
+ easy as 1-2-3
193
+ easy as pie
194
+ eat crow
195
+ eat humble pie
196
+ eco-anything
197
+ enough already
198
+ even money
199
+ every dog ha its day
200
+ every fiber of my being
201
+ everything but the kitchen sink
202
+ evil twin
203
+ existential angst
204
+ experts agre
205
+ eye for an eye
206
+ facts of life
207
+ fair weather friend
208
+ fair-haired one
209
+ fall off of a turnip truck
210
+ faster cheaper better
211
+ fat slob
212
+ favor us with a song
213
+ fear and loathing
214
+ feather your nest
215
+ fellow traveler
216
+ few and far between
217
+ field this one
218
+ fifteen minutes of fame
219
+ fish nor fowl
220
+ fly by night
221
+ fly the coop
222
+ for the birds
223
+ fox in the henhouse
224
+ freudian slip
225
+ from a professional standpoint
226
+ fun and games
227
+ fun in the sun
228
+ game changer
229
+ garbage in garbage out
230
+ get the sack
231
+ get your groove back
232
+ get my goat
233
+ gift horse in the mouth
234
+ gilding the lily
235
+ give a damn
236
+ give me a break
237
+ give me the creeps
238
+ give 110
239
+ go him one better
240
+ godliness
241
+ goe without sai
242
+ go forward
243
+ go from good to great
244
+ good deed for the day
245
+ good time wa had by all
246
+ greek to me
247
+ green thumb
248
+ green-eyed monster
249
+ grist for the mill
250
+ guiding light
251
+ hair of the dog
252
+ hard to believ
253
+ ha legs and can go really far
254
+ have a nice day
255
+ he couldnt pour water out of a boot with instructions print on the heel
256
+ he couldnt think his way out of a paper bag
257
+ he donat his brain to science science sent it back
258
+ he fell out of the stupid tree and hit every branch on his way down
259
+ hes a walking advertisementposter boy for birth controlplanned parenthood
260
+ hes as useful as tits on a wartboar hog
261
+ hes dumber than a bag of hammers
262
+ hes dumber than a box of rocks
263
+ hes not the brightest crayon in the box
264
+ hes not the sharpest knife in the drawer
265
+ head honcho
266
+ hearts content
267
+ hell-bent for leather
268
+ hidden agenda
269
+ high and the mighty
270
+ high on the hog
271
+ his bread aint done
272
+ his elevator doesnt go to the top floor
273
+ his pilot light isnt lit
274
+ his yeast went bad
275
+ hold a candle to
276
+ hold your horses
277
+ hold your tongue
278
+ hook or by crook
279
+ horse of a different color
280
+ hot knife through butter
281
+ how goe the battle
282
+ i beg to differ
283
+ i dont have the bandwidth
284
+ im not throw him under the bus but
285
+ im okay youre okay
286
+ if brains were dynamite he couldnt blow his nose
287
+ if the shoe fit
288
+ if you gave him a penny for his thoughts youd get change
289
+ impactful
290
+ improv roi
291
+ in a nutshell
292
+ in a pinch
293
+ in a wink
294
+ in harms way
295
+ in the tank
296
+ in todays highly competitive marketplace
297
+ in your dreams
298
+ in your face
299
+ industry leader
300
+ industry standard
301
+ inexorably drawn
302
+ influence peddling
303
+ info dump
304
+ integrated approach
305
+ intents and purposes
306
+ it is what it is
307
+ it take him an hour to cook minute rice
308
+ it wa a dark and stormy night
309
+ it wont fly
310
+ jack of all trades
311
+ jockey for position
312
+ johnny-come-lately
313
+ join at the hip
314
+ jump down your throat
315
+ jump herhis bones
316
+ jump in with both feet
317
+ jump on the bandwagon
318
+ jump the gun
319
+ junk in the trunk
320
+ jury is still out
321
+ justice is blind
322
+ keep an eye on you
323
+ keep it down
324
+ keep it simple stupid
325
+ keep up with the joneses
326
+ keep your cards close to vest
327
+ keep your chin up
328
+ keep your fingers cross
329
+ keep your powder dry
330
+ kick ass
331
+ kick the bucket
332
+ kick up your heels
333
+ kick you to the curb
334
+ kick your feet up
335
+ kickbutt
336
+ kid in a candy store
337
+ kill two birds with one stone
338
+ kings english
339
+ kings ransom
340
+ kiss and tell
341
+ kiss ass
342
+ kiss of death
343
+ kit and kaboodle
344
+ knee-high to a grasshopper
345
+ knock it out of the park
346
+ knock on wood
347
+ knock your socks off
348
+ knock up
349
+ know him from adam
350
+ know the ropes
351
+ know the score
352
+ knuckle down
353
+ knuckle sandwich
354
+ knuckle under
355
+ labor of love
356
+ lap of luxury
357
+ last but not least
358
+ last hurrah
359
+ last-ditch effort
360
+ law of the jungle
361
+ law of the land
362
+ lai down the law
363
+ leaps and bounds
364
+ let sleeping dogs lie
365
+ let the cat out of the bag
366
+ lets be proactive here people
367
+ lets get granular
368
+ lets hit the ground run
369
+ lets split
370
+ lets take this off-line
371
+ liberal media
372
+ lie like a rug
373
+ life and limb
374
+ life imitates art
375
+ lifes a bitch
376
+ lighten up
377
+ lights out
378
+ like a sore thumb
379
+ like butter
380
+ like the plagu
381
+ like theres no tomorrow
382
+ lions share
383
+ litmus test
384
+ little black book
385
+ live and learn
386
+ long and short of it
387
+ long lost love
388
+ look before you leap
389
+ lounge lizard
390
+ love and lost
391
+ low man on the totem pole
392
+ low-hanging fruit
393
+ luck of the draw
394
+ luck of the irish
395
+ make my day
396
+ male chauvinist
397
+ mans best friend
398
+ manag expectations
399
+ many moons
400
+ many-splendored thing
401
+ mark my words
402
+ marketing-driven
403
+ maxim customer satisfaction
404
+ maxim leverage
405
+ meaningful relationship
406
+ mellow out
407
+ moment of glory
408
+ moments respite
409
+ monday morning quarterback
410
+ monkey see monkey do
411
+ monkey suit
412
+ motherhood and apple pie
413
+ movers and shakers
414
+ move experience
415
+ move up the value chain
416
+ multi task
417
+ my two cents
418
+ neat as a pin
419
+ needless to sai
420
+ net-net
421
+ next generation
422
+ nip it in the bud
423
+ no guts no glory
424
+ no love lost
425
+ no pain no gain
426
+ no stone unturned
427
+ no time like the present
428
+ nose to the grindstone
429
+ not in my back yard
430
+ not on your tintype
431
+ now more than ever
432
+ number one fan
433
+ numerous to mention
434
+ off the wagon
435
+ offline
436
+ old college try
437
+ old meet new
438
+ older and wiser
439
+ older than dirt
440
+ older than methuselah
441
+ on steroids
442
+ on the bandwagon
443
+ on the nose
444
+ on the wagon
445
+ on thin ice
446
+ one born every minute
447
+ one brick shy of a load
448
+ one foot in the grave
449
+ one fry short of a happy meal
450
+ one in a million
451
+ one pickle short of a barrel
452
+ one sandwich short of a picnic
453
+ one step short of a flight
454
+ one taco short of a combination plate
455
+ only game in town
456
+ only to be met
457
+ out of pocket
458
+ out of the fry pan
459
+ out on a limb
460
+ out-of-pocket
461
+ ps and qs
462
+ pain and suffering
463
+ panic button
464
+ paradigm shift
465
+ party pooper
466
+ pass the sniff test
467
+ patter of little feet
468
+ pay through the nose
469
+ peas in a pod
470
+ perfect storm
471
+ pig in a poke
472
+ pillar of society
473
+ pinko
474
+ plenty of fish in the sea
475
+ poison pen
476
+ poor as a churchmouse
477
+ poor excuse for
478
+ pot calling the kettle black
479
+ proud possessor
480
+ pull through in the end
481
+ push the envelope
482
+ put a stake in the ground
483
+ put myyour foot down
484
+ put lipstick on a pig
485
+ quick and the dead
486
+ quick as a bunny
487
+ radical chic
488
+ rags to riches
489
+ rain buckets
490
+ rain cats and dogs
491
+ raise the bar
492
+ rank and file
493
+ read my lips
494
+ red herring
495
+ redheaded stepchild
496
+ reign supreme
497
+ rememb the alamo
498
+ reson
499
+ rightsiz
500
+ road to hell is pave with good intentions
501
+ rob peter to pai paul
502
+ robust
503
+ rock and a hard place
504
+ rocket sciencescientist
505
+ roost
506
+ rope a dope
507
+ run it up the flagpole
508
+ run it up the flagpole and see who salutes
509
+ run dog lackey
510
+ safe than sorry
511
+ salt of the earth
512
+ save face
513
+ scalable
514
+ scared stiff
515
+ scared to death
516
+ schools out
517
+ scream meemies
518
+ seamless integration
519
+ senses reel
520
+ set the record straight
521
+ shake a stick should of
522
+ shapes and forms
523
+ shoulder to the wheel
524
+ shouldered his way
525
+ shut your trap
526
+ sigh of relief
527
+ significant other
528
+ silence is golden
529
+ six sigma
530
+ slept like a log
531
+ small world
532
+ snake in the grass
533
+ snow job
534
+ snug as a bug
535
+ some of my best friends
536
+ something the cat drag in
537
+ somewhere a villiage is miss its idiot
538
+ spade a spade
539
+ spare the rod
540
+ spending more time with my family
541
+ spitting image
542
+ spring to life
543
+ squeaky wheel get the greaseoil
544
+ start from scratch
545
+ step up to the plate
546
+ stick in the mud
547
+ stick in your craw
548
+ still waters run deep
549
+ stop and smell the roses
550
+ store bought
551
+ stranger than fiction
552
+ strategic
553
+ straw that broke the camels back
554
+ stubborn as a mule
555
+ stuff that dreams ar made of
556
+ stuf shirt
557
+ synergy
558
+ take it to the next level
559
+ take one for the team
560
+ take the bull by the horns
561
+ take the plunge
562
+ take one to know one
563
+ talk turkey
564
+ team player
565
+ teamwork
566
+ ten foot pole
567
+ the 80-20 rule
568
+ the bottom line
569
+ the cheese slid off his cracker
570
+ the customer is always right
571
+ the earth move
572
+ the elephant in the room
573
+ the final analysis
574
+ the gates ar down the lights ar flash but there is no train
575
+ the light is on but nobody is home
576
+ the real mccoy
577
+ the same old story
578
+ the scenery only changes for the lead dog
579
+ the starting gate is open but hes still ask directions
580
+ the wheel is turn but the hamster is dead
581
+ theres nothing in the attic but cobwebs
582
+ these things happen
583
+ thick as thieves
584
+ think outside of the box
585
+ thinking outside of the box
586
+ third times the charm
587
+ this day and age
588
+ this point in time
589
+ thought leader
590
+ three strikes and youre out
591
+ through the grapevine
592
+ throw in the towel
593
+ tiger by the tail
594
+ till the fat lady sing
595
+ time and time again
596
+ time is of the essense
597
+ tip of the iceberg
598
+ to err is human
599
+ to the best of my knowledge
600
+ today more than ever
601
+ tongue-in-cheek
602
+ too hot to handl
603
+ too many chiefs and not enough indians
604
+ touch base
605
+ touch of blarney
606
+ tough as nails
607
+ tough luck
608
+ tough row to hoe
609
+ traditional family values
610
+ transparency
611
+ trials and tribulations
612
+ tri and true
613
+ trip down memory lane
614
+ true blue
615
+ turn your smilefrown upside-down
616
+ twist of fate
617
+ twists and turn
618
+ two to tango
619
+ under the gun
620
+ under the same roof
621
+ underst elegance
622
+ unexpected twist
623
+ until the cows come home
624
+ up his sleeve
625
+ up the creek
626
+ up the wrong tree
627
+ user-experience
628
+ user-focused
629
+ value-added proposition
630
+ very real concern
631
+ view with alarm
632
+ viral
633
+ wakeup call
634
+ wa my face red
635
+ watch your tongue
636
+ web 2 0
637
+ web of intrigue
638
+ week of sundays
639
+ what a bummer
640
+ what come around goe around
641
+ what the cat drag in
642
+ what the dickens
643
+ what the heckhell
644
+ what you see is what you get
645
+ whats not to like
646
+ wheeler-dealer
647
+ when in doubt punt
648
+ when push come to shove
649
+ when rubber meet the road
650
+ when the cats away
651
+ when the go get tough the tough get go
652
+ who ha everything
653
+ whole ball of wax
654
+ whole hog
655
+ whole nine yards
656
+ whole other story
657
+ wild goose chase
658
+ wild oats
659
+ will wonders never ceas
660
+ wimp
661
+ win friends and influence
662
+ win one for the gipper
663
+ win-win
664
+ win-win situation
665
+ wisdom of the ages
666
+ without benefit of clergy
667
+ wnning is everything
668
+ wolf at the door
669
+ words fail
670
+ work like a dog
671
+ worst nightmare
672
+ wrong side of the bed
673
+ years young
674
+ yellow journalism
675
+ you ar what you eat
676
+ you can run but you cant hide
677
+ you know what they sai
678
+ young and foolish
679
+ young and restless
680
+ yuppie
@@ -0,0 +1,18 @@
1
+ module StyleScanner
2
+ module ProfilingHelpers
3
+
4
+ def start_profiling
5
+ require 'ruby-prof'
6
+ RubyProf.start
7
+ end
8
+
9
+ def output_profilng_results
10
+ result = RubyProf.stop
11
+ printer = RubyProf::GraphHtmlPrinter.new(result)
12
+ output_file = File.new("performance_report.html", "w")
13
+ printer.print(output_file, :min_percent=>0)
14
+ puts "Output performance report to performance_report.html".green
15
+ end
16
+
17
+ end
18
+ end
@@ -11,7 +11,6 @@ module StyleScanner
11
11
  @sentences = split_into_sentences
12
12
  end
13
13
 
14
-
15
14
  def scan
16
15
  sentences.each do |sentence|
17
16
  desired_scans.each do |scanner_type|
@@ -16,18 +16,18 @@ module StyleScanner
16
16
  end
17
17
 
18
18
  def tagged_words
19
- @tagged_words ||= Tagger.new(text).tagged_words
19
+ tagger.tagged_words
20
20
  end
21
21
 
22
22
  def adverbs
23
23
  part_of_speech("RB")
24
24
  end
25
25
 
26
- def contains?(word, options = {})
27
- options = {:strip_case=> true}.merge(options)
26
+ def contains?(word, option_modifications = {})
27
+ options = {:strip_case => true}.merge(option_modifications)
28
28
  text_to_scan = text
29
+ text_to_scan = stemmed_verbs if options[:stem_verbs]
29
30
  text_to_scan = text_to_scan.downcase if options[:strip_case]
30
- text_to_scan = text_to_scan.stem_verbs if options[:stem_verbs]
31
31
  text_to_scan.match /\b#{word}\b/
32
32
  end
33
33
 
@@ -53,6 +53,14 @@ module StyleScanner
53
53
  tagged_words.select {|tagged_word| tagged_word.tag == pos }.map(&:word)
54
54
  end
55
55
 
56
+ def stemmed_verbs
57
+ @stemmed_verbs ||= text.stem_verbs
58
+ end
59
+
60
+ def tagger
61
+ @tagger ||= Tagger.new(text)
62
+ end
63
+
56
64
  # we don't want to modify the original text
57
65
  def copy_of_text
58
66
  text.dup
@@ -48,7 +48,7 @@ module StyleScanner
48
48
 
49
49
  def flag_lowercase(collection)
50
50
  collection.each do |word|
51
- create_problem(word.upcase) if sentence.contains?(word, :strip_case => false)
51
+ create_problem(word.capitalize) if sentence.contains?(word, :strip_case => false)
52
52
  end
53
53
  end
54
54
 
@@ -2,17 +2,22 @@ module StyleScanner
2
2
  module SentenceScans
3
3
  class Cliche < Base
4
4
 
5
+ STEMMED_CLICHES = load_file("stemmed_cliches.txt")
5
6
  CLICHES = load_file("cliches.txt")
6
7
 
7
8
  def scan
8
- Cliche.stemmed_cliches.each.with_index do |cliche, index|
9
+ STEMMED_CLICHES.each.with_index do |cliche, index|
9
10
  create_problem(CLICHES[index]) if sentence.contains?(cliche, :stem_verbs => true)
10
11
  end
11
12
  end
12
13
 
13
- def self.stemmed_cliches
14
- @@stemmed_cliches ||= CLICHES.map do |cliche|
15
- cliche.stem_verbs
14
+ class << self
15
+
16
+ # used for generating new cliches. see generate_stemmed_cliches.rb
17
+ def stemmed_cliches
18
+ CLICHES.map do |cliche|
19
+ cliche.stem_verbs
20
+ end
16
21
  end
17
22
  end
18
23
 
@@ -16,6 +16,10 @@ module StyleScanner
16
16
  scan(/[A-Z][a-z]*/).join(" ")
17
17
  end
18
18
 
19
+ def stemmed_verbs?
20
+ @stemmed_verbs
21
+ end
22
+
19
23
  private
20
24
 
21
25
  def is_a_verb?(word)
@@ -2,9 +2,9 @@ module StyleScanner
2
2
  class TaggedWord
3
3
  #TODO add tests for all the new methods added here.
4
4
 
5
- STRUCTURAL_TAGS = %{
6
- WRB WPS WP WDT UH TO SYM PRPS CC DET EX IN LS PDT POS PRP PRPS
7
- }
5
+ STRUCTURAL_TAGS = %{
6
+ WRB WPS WP WDT UH TO SYM PRPS CC DET EX IN LS PDT POS PRP PRPS
7
+ }
8
8
 
9
9
  attr_reader :tag, :word
10
10
 
@@ -8,7 +8,7 @@ module StyleScanner
8
8
  end
9
9
 
10
10
  def tagged_words
11
- Tagger.parts_of_speech_tagger.
11
+ @tagged_words ||= Tagger.parts_of_speech_tagger.
12
12
  add_tags(input_text).
13
13
  scan(/\<(?<tag>\w+)>(?<text>[^(<\)]+)</).
14
14
  map {|tag, word| TaggedWord.new(tag,word)}
@@ -1,3 +1,3 @@
1
1
  module StyleScanner
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/readme.textile CHANGED
@@ -31,7 +31,7 @@ h2. Installation
31
31
 
32
32
  Install Style using Ruby gems:
33
33
 
34
- @gem install style@
34
+ @gem install style-scanner@
35
35
 
36
36
  Next install Hunspell, an open source spell-checker that Style depends upon.
37
37
 
@@ -41,27 +41,27 @@ h2. Usage
41
41
 
42
42
  Style is command line only. Cd into the directory with the files you'd like to scan, then type
43
43
 
44
- @style filename@
44
+ @style-scanner filename@
45
45
 
46
46
  After a few seconds Style will print a list problems it finds.
47
47
 
48
48
  Style is pipe friendly.
49
49
 
50
- @cat filename | style@
50
+ @cat filename | style-scanner@
51
51
 
52
52
  See all command line options
53
53
 
54
- @style -h@
54
+ @style-scanner -h@
55
55
 
56
56
  By default some scans, such as the Adverb scan, are turned off. Use command line options to enable them.
57
57
 
58
- @style -a filename@ #scan for adverbs
58
+ @style-scanner -a filename@ #scan for adverbs
59
59
 
60
60
  Scan HTML files
61
- @style filename.html --help@
61
+ @style-scanner filename.html --help@
62
62
 
63
63
  Scan Textile files
64
- @style filename.html -t@
64
+ @style-scanner filename.html -t@
65
65
 
66
66
  h2. Dependencies
67
67
 
@@ -12,7 +12,7 @@ module StyleScanner
12
12
 
13
13
  it "calls the scanner when cmd line called with an echoed sentence" do
14
14
  # mispelling error should show
15
- %x(echo '#{text}' | style -s).should match "dlog"
15
+ %x(echo '#{text}' | style-scanner -s).should match "dlog"
16
16
  end
17
17
 
18
18
  it "calls the scanner when cmd line called with a file" do
@@ -21,20 +21,20 @@ module StyleScanner
21
21
 
22
22
  it "works with HTML input" do
23
23
  # mispelling in html should not show if stripper properly
24
- %x(echo '#{html}' | style -h -s).should_not match "dlog"
24
+ %x(echo '#{html}' | style-scanner -h -s).should_not match "dlog"
25
25
  end
26
26
 
27
27
  it "doesn't do adverbs by default" do
28
- %x(echo '#{adverb_text}' | style).should_not match "quietly"
28
+ %x(echo '#{adverb_text}' | style-scanner).should_not match "quietly"
29
29
  end
30
30
 
31
31
  it "can turn on adverbs as needed using command line options" do
32
- %x(echo '#{adverb_text}' | style -a).should match "quietly"
32
+ %x(echo '#{adverb_text}' | style-scanner -a).should match "quietly"
33
33
  end
34
34
 
35
35
  it "works with Textile input" do
36
36
  # this test works because the software will visit the image link if the html is not stripped
37
- %x(echo '#{textile}' | style -t -s).should_not match "dlog"
37
+ %x(echo '#{textile}' | style-scanner -t -s).should_not match "dlog"
38
38
  end
39
39
 
40
40
  end
data/spec/scanner_spec.rb CHANGED
@@ -7,12 +7,6 @@ module StyleScanner
7
7
  let(:text) { "My name is Roboticus. I am a really powerful robot." }
8
8
  subject {Scanner.new(text)}
9
9
 
10
- it "#find_sentence" do
11
- text = "Sentence Number 1. Sentence Number 2"
12
- sentence = Scanner.new(text).find_sentence("Sentence Number 2")
13
- sentence.text.should == "Sentence Number 2"
14
- end
15
-
16
10
  context "#scan" do
17
11
  it "calls a variety of scans on its sentences" do
18
12
  SentenceScans::UselessWord.should_receive(:scan).with(an_instance_of(Sentence)).twice.and_return(double(:sentence))
@@ -30,12 +24,5 @@ module StyleScanner
30
24
  end
31
25
  end
32
26
 
33
- context "unclosed parenthesis"
34
- context "uncapitalized starting lines"
35
- context "forgotten full stop"
36
- context "overused words"
37
- context "long words"
38
- context "passive tense"
39
-
40
27
  end
41
28
  end
@@ -1,9 +1,11 @@
1
1
  require "spec_helper"
2
2
  module StyleScanner
3
3
  describe Sentence do
4
+
4
5
  let(:text) {"Christmas shopping shopping for a very big dinosaur."}
5
6
  let(:repeated_word_problem) {Problems::ConsecutivelyRepeatedWord.new("shopping shopping", text)}
6
7
  let(:ugly_word_problem) {Problems::UglyWord.new("utilize", text)}
8
+
7
9
  subject { Sentence.new(text) }
8
10
 
9
11
  it "hold a collection of problems" do
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'ruby-debug'
3
3
  require 'bundler/setup'
4
4
  # Use this when it's a full gem
5
- require 'style'
5
+ require 'style_scanner'
6
6
 
7
7
  module StyleScannerTestingHelpers
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: style-scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: punkt-segmenter
17
- requirement: &2152692900 !ruby/object:Gem::Requirement
17
+ requirement: &2152642100 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152692900
25
+ version_requirements: *2152642100
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: engtagger
28
- requirement: &2152692380 !ruby/object:Gem::Requirement
28
+ requirement: &2152641680 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2152692380
36
+ version_requirements: *2152641680
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: colorize
39
- requirement: &2152691900 !ruby/object:Gem::Requirement
39
+ requirement: &2152641260 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2152691900
47
+ version_requirements: *2152641260
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: sanitize
50
- requirement: &2152691400 !ruby/object:Gem::Requirement
50
+ requirement: &2152640780 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2152691400
58
+ version_requirements: *2152640780
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: trollop
61
- requirement: &2152690940 !ruby/object:Gem::Requirement
61
+ requirement: &2152640240 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2152690940
69
+ version_requirements: *2152640240
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: RedCloth
72
- requirement: &2152690520 !ruby/object:Gem::Requirement
72
+ requirement: &2152639800 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2152690520
80
+ version_requirements: *2152639800
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rspec
83
- requirement: &2152690080 !ruby/object:Gem::Requirement
83
+ requirement: &2152639380 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *2152690080
91
+ version_requirements: *2152639380
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: rake
94
- requirement: &2152689640 !ruby/object:Gem::Requirement
94
+ requirement: &2152638940 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *2152689640
102
+ version_requirements: *2152638940
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: ruby-debug19
105
- requirement: &2152689180 !ruby/object:Gem::Requirement
105
+ requirement: &2152638480 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *2152689180
113
+ version_requirements: *2152638480
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: looksee
116
- requirement: &2152688740 !ruby/object:Gem::Requirement
116
+ requirement: &2152638060 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *2152688740
124
+ version_requirements: *2152638060
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: ruby-prof
127
- requirement: &2152688240 !ruby/object:Gem::Requirement
127
+ requirement: &2152637620 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,7 +132,7 @@ dependencies:
132
132
  version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *2152688240
135
+ version_requirements: *2152637620
136
136
  description: Flag errors with your writing Style
137
137
  email:
138
138
  - jack.kinsella@gmail.com
@@ -147,11 +147,14 @@ files:
147
147
  - Gemfile
148
148
  - Rakefile
149
149
  - bin/style-scanner
150
+ - generate_stemmed_cliches.rb
150
151
  - lib/dictionaries/acronyms.txt
151
152
  - lib/dictionaries/cliches.txt
152
153
  - lib/dictionaries/nationalities.txt
154
+ - lib/dictionaries/stemmed_cliches.txt
153
155
  - lib/style_scanner.rb
154
156
  - lib/style_scanner/problems/base.rb
157
+ - lib/style_scanner/profiling_helpers.rb
155
158
  - lib/style_scanner/scanner.rb
156
159
  - lib/style_scanner/sentence.rb
157
160
  - lib/style_scanner/sentence_scans/adverb.rb