pretty_strings 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -9
- data/lib/pretty_strings/version.rb +1 -1
- data/pretty_strings.gemspec +3 -3
- data/spec/pretty_strings_spec.rb +142 -0
- data/spec/spec_helper.rb +2 -0
- metadata +8 -6
- data/bin/console +0 -14
- data/bin/setup +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ff8178afecac1b22dae2a3f3aa53af39f3521a5
|
4
|
+
data.tar.gz: 5c907cc787b34369cefe91d1af62157d8dfcf02b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b83673da5b1c6f9f3ff3207cf547fb513dfbbf6a61bd95ce489fcae2d330901d72f29b45b13f342af5768e9c307bc91bb949480a6e680f7f0575db12f9c6536d
|
7
|
+
data.tar.gz: bbb30c81a6ca195531cf103b1ab85f0760808adc7760c5e2fa96551535cbd5f31e5487fa0afbcd3076235b485a9935455521f88cf8d574128b87a310e7644b1b
|
data/README.md
CHANGED
@@ -8,17 +8,16 @@ Some strings have been abused by being run through many a CAT tool (one too many
|
|
8
8
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
**Ruby**
|
12
|
+
```
|
13
|
+
gem install pretty_strings
|
13
14
|
```
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
$ gem install pretty_strings
|
16
|
+
**Ruby on Rails**
|
17
|
+
Add this line to your application’s Gemfile:
|
18
|
+
```ruby
|
19
|
+
gem 'pretty_strings'
|
20
|
+
```
|
22
21
|
|
23
22
|
## Usage
|
24
23
|
|
data/pretty_strings.gemspec
CHANGED
@@ -13,9 +13,9 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.description = %q{Clean up strings (html entities, html/xml code, unnecessary whitespace, etc.) to prep them to be better searched or analyzed.}
|
14
14
|
spec.homepage = "https://github.com/diasks2/pretty_strings"
|
15
15
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.
|
18
|
-
spec.
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_runtime_dependency "rails-html-sanitizer"
|
@@ -0,0 +1,142 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PrettyStrings do
|
4
|
+
it 'has a version number' do
|
5
|
+
expect(PrettyStrings::VERSION).not_to be nil
|
6
|
+
end
|
7
|
+
|
8
|
+
it "prettifies example #001" do
|
9
|
+
text = "Hello World. My name is Jonas."
|
10
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Hello World. My name is Jonas.")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "prettifies example #002" do
|
14
|
+
text = "<ut>{\cs6\f1\cf6\lang1024 </ut><cf size="8" complexscriptssize="8"><ut>}</ut>Determination of time point of wound closure <ut>{\cs6\f1\cf6\lang1024 </ut></cf><cf size="8" complexscriptssize="8" superscript="on"><ut>}</ut>K<ut>{\cs6\f1\cf6\lang1024 </ut></cf><ut>}</ut>"
|
15
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Determination of time point of wound closure K")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "prettifies example #003" do
|
19
|
+
text = "<ut>{\cs6\f1\cf6\lang1024 </ut></cf><cf font="Arial" size="11" complexscriptsfont="Arial" complexscriptssize="11"><ut>}</ut>DermaPro<ut>{\cs6\f1\cf6\lang1024 </ut></cf><cf font="Arial" size="11" complexscriptsfont="Arial" complexscriptssize="11" superscript="on"><ut>}</ut>®<ut>{\cs6\f1\cf6\lang1024 </ut></cf><cf font="Arial" size="11" complexscriptsfont="Arial" complexscriptssize="11"><ut>}</ut> versus isotonic sodium chloride solution in patients with diabetic foot ulcers<ut>{\cs6\f1\cf6\lang1024 </ut></cf><ut>}</ut>"
|
20
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("DermaPro® versus isotonic sodium chloride solution in patients with diabetic foot ulcers")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "prettifies example #004" do
|
24
|
+
text = "HS will not refund any applied registration fees or backorder fees for a backordered domain that has been allocated into a Customer's ownership and account."
|
25
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("HS will not refund any applied registration fees or backorder fees for a backordered domain that has been allocated into a Customer's ownership and account.")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "prettifies example #005" do
|
29
|
+
text = "40 Hz nominal for a standard kit (48"/12"); &gt;200 Hz for sensor alone"
|
30
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq('40 Hz nominal for a standard kit (48"/12"); >200 Hz for sensor alone')
|
31
|
+
end
|
32
|
+
|
33
|
+
it "prettifies example #006" do
|
34
|
+
text = "The Edwards SAPIEN transcatheter heart valve is indicated for use in patients with symptomatic aortic stenosis (aortic valve area &amp;lt;0.8 cm2) requiring aortic valve replacement who have high risk for operative mortality, or are “non-operable”, as determined by either or both of the following risk assessments:"
|
35
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("The Edwards SAPIEN transcatheter heart valve is indicated for use in patients with symptomatic aortic stenosis (aortic valve area <0.8 cm2) requiring aortic valve replacement who have high risk for operative mortality, or are “non-operable”, as determined by either or both of the following risk assessments:")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "prettifies example #007" do
|
39
|
+
text = "{\f23 3.2.1} {\f23 SCUF (Slow Continuous Ultra-filtration):}"
|
40
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("3.2.1 SCUF (Slow Continuous Ultra-filtration):")
|
41
|
+
end
|
42
|
+
|
43
|
+
it "prettifies example #008" do
|
44
|
+
text = nil
|
45
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "prettifies example #009" do
|
49
|
+
text = "&amp;lt;CharStyle:&amp;gt;&amp;lt;CharStyle:credit&amp;gt;Reuter et al&amp;lt;cSize:6.000000&amp;gt;&amp;lt;cBaselineShift:4.000000&amp;gt;5&amp;lt;cBaselineShift:&amp;gt;&amp;lt;cSize:&amp;gt;"
|
50
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Reuter et al5")
|
51
|
+
end
|
52
|
+
|
53
|
+
it "prettifies example #010" do
|
54
|
+
text = "Lifesciences S.A. · Ch. du Glapin 6 · 1162 Saint-Prex · Switzerland · 41.21.823.4300&amp;lt;SoftReturn&amp;gt;Edwards"
|
55
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Lifesciences S.A. · Ch. du Glapin 6 · 1162 Saint-Prex · Switzerland · 41.21.823.4300Edwards")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "prettifies example #011" do
|
59
|
+
text = "&amp;lt;CharStyle:legal&amp;gt;5."
|
60
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("5.")
|
61
|
+
end
|
62
|
+
|
63
|
+
it "prettifies example #012" do
|
64
|
+
text = "{0}No other express or implied warranty exists, including any warranty of merchantability or fitness for a particular purpose.{1}"
|
65
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("No other express or implied warranty exists, including any warranty of merchantability or fitness for a particular purpose.")
|
66
|
+
end
|
67
|
+
|
68
|
+
it "prettifies example #013" do
|
69
|
+
text = "&amp;lt;CharStyle:legal&amp;gt;"
|
70
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("")
|
71
|
+
end
|
72
|
+
|
73
|
+
it "prettifies example #014" do
|
74
|
+
text = "&amp;lt;CharStyle:bullets&amp;gt;&amp;lt;cColor:PANTONE 561 C&amp;gt;• &amp;lt;cColor:&amp;gt;Validated against the clinical gold-standard Swan-Ganz pulmonary artery catheter&amp;lt;cSize:6.000000&amp;gt;&amp;lt;cBaselineShift:4.000000&amp;gt;&amp;lt;cLeading:14.000000&amp;gt;1&amp;lt;cLeading:&amp;gt;&amp;lt;cBaselineShift:&amp;gt;&amp;lt;cSize:&amp;gt;"
|
75
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq( "• Validated against the clinical gold-standard Swan-Ganz pulmonary artery catheter1")
|
76
|
+
end
|
77
|
+
|
78
|
+
it "prettifies example #015" do
|
79
|
+
text = "Hello\n\n\n\n\rWorld"
|
80
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Hello World")
|
81
|
+
end
|
82
|
+
|
83
|
+
it "prettifies example #016" do
|
84
|
+
text = "{\f23 3.2.1}"
|
85
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("3.2.1")
|
86
|
+
end
|
87
|
+
|
88
|
+
it "prettifies example #017" do
|
89
|
+
text = "&lt;CharStyle:body copy&gt;The Fl&lt;cTracking:-75&gt;o&lt;cTracking:&gt;Trac system is easy to set up and use, providing real-time &lt;SoftReturn&gt;hemodynamic insight from pre-op to the operating room and to the ICU."
|
90
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("The FloTrac system is easy to set up and use, providing real-time hemodynamic insight from pre-op to the operating room and to the ICU.")
|
91
|
+
end
|
92
|
+
|
93
|
+
it "prettifies example #018" do
|
94
|
+
text = "Tabulka 1 ukazuje počet pozorovaných časných komplikací (< 30 dnů u nežádoucích účinků týkajících se chlopně), linearizované počty pozdních komplikací (> 30 dnů po operaci) a počty komplikací 1, 5 a 8 let po operaci."
|
95
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Tabulka 1 ukazuje počet pozorovaných časných komplikací (< 30 dnů u nežádoucích účinků týkajících se chlopně), linearizované počty pozdních komplikací (> 30 dnů po operaci) a počty komplikací 1, 5 a 8 let po operaci.")
|
96
|
+
end
|
97
|
+
|
98
|
+
it "prettifies example #019" do
|
99
|
+
text = "&lt;z6cW&gt;33 - 47 mL/beat/m&lt;V&gt;2"
|
100
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("33 - 47 mL/beat/m2")
|
101
|
+
end
|
102
|
+
|
103
|
+
it "prettifies example #020" do
|
104
|
+
text = "Hello\t\tworld."
|
105
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("Hello world.")
|
106
|
+
end
|
107
|
+
|
108
|
+
it "prettifies example #021" do
|
109
|
+
text = "&lt;CharStyle:body copy&gt;The Supe&lt;cTracking:-75&gt;r&lt;cTracking:&gt;Track system is easy to set up and use, providing real-time &lt;SoftReturn&gt;insight and stats."
|
110
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("The SuperTrack system is easy to set up and use, providing real-time insight and stats.")
|
111
|
+
end
|
112
|
+
|
113
|
+
it "prettifies example #022" do
|
114
|
+
text = "The following tools are included: Déjà Vu X2 (Atril), memoQ (Kilgray), SDL Trados Studio 2009 (SDL) and Wordfast Pro (Wordfast)."
|
115
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("The following tools are included: Déjà Vu X2 (Atril), memoQ (Kilgray), SDL Trados Studio 2009 (SDL) and Wordfast Pro (Wordfast).")
|
116
|
+
end
|
117
|
+
|
118
|
+
it "prettifies example #023" do
|
119
|
+
text = "こんにちは、今日は土曜日。"
|
120
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("こんにちは、今日は土曜日。")
|
121
|
+
end
|
122
|
+
|
123
|
+
it "prettifies example #024" do
|
124
|
+
text = "**{date}** **{number}** **{email}** **{url}** test"
|
125
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("**{date}** **{number}** **{email}** **{url}** test")
|
126
|
+
end
|
127
|
+
|
128
|
+
it "prettifies example #025" do
|
129
|
+
text = "How satisfied were you with the way in which the car was handed over to you?<it pos='begin'><6></it>"
|
130
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("How satisfied were you with the way in which the car was handed over to you?")
|
131
|
+
end
|
132
|
+
|
133
|
+
it "prettifies example #026" do
|
134
|
+
text = "hello..........................................................................................................................................................................................................................................................................................................................................................."
|
135
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("hello")
|
136
|
+
end
|
137
|
+
|
138
|
+
it "prettifies example #027" do
|
139
|
+
text = "hello...what is your name."
|
140
|
+
expect(PrettyStrings::Cleaner.new(text).pretty).to eq("hello...what is your name.")
|
141
|
+
end
|
142
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty_strings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin S. Dias
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-html-sanitizer
|
@@ -81,11 +81,11 @@ files:
|
|
81
81
|
- LICENSE.txt
|
82
82
|
- README.md
|
83
83
|
- Rakefile
|
84
|
-
- bin/console
|
85
|
-
- bin/setup
|
86
84
|
- lib/pretty_strings.rb
|
87
85
|
- lib/pretty_strings/version.rb
|
88
86
|
- pretty_strings.gemspec
|
87
|
+
- spec/pretty_strings_spec.rb
|
88
|
+
- spec/spec_helper.rb
|
89
89
|
homepage: https://github.com/diasks2/pretty_strings
|
90
90
|
licenses: []
|
91
91
|
metadata: {}
|
@@ -110,4 +110,6 @@ signing_key:
|
|
110
110
|
specification_version: 4
|
111
111
|
summary: Take strings that have been abused in the wild and clean them up (for translation
|
112
112
|
tools)
|
113
|
-
test_files:
|
113
|
+
test_files:
|
114
|
+
- spec/pretty_strings_spec.rb
|
115
|
+
- spec/spec_helper.rb
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "pretty_strings"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|