confidential_info_redactor_lite 0.0.15 → 0.0.16
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2d69531dae1c3c8931201a67c912ace893219c9
|
4
|
+
data.tar.gz: ce209b425e478c9e4f8db0bb5539be5ca2914594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae27ad9ca0c94ac48852758c633990c9e80a0d2ad88022201593617f70849c16544a2a8d43557699e644228f1a92dec42d73324a65efef8832be1075e5af4c71
|
7
|
+
data.tar.gz: 1fcad2249e91fc1076fecff92c6243cd408afcacd4b31c7770f4351da34694e09ffc3854617e7bd535c02a8068640bbf6d5e97836617fed5f35e75f82aa7cd15
|
@@ -174,7 +174,7 @@ module ConfidentialInfoRedactorLite
|
|
174
174
|
|
175
175
|
def redact_tokens(txt)
|
176
176
|
tokens.sort_by{ |x| x.split.count }.reverse.each do |token|
|
177
|
-
txt.gsub!(
|
177
|
+
txt.gsub!(/(?<=\s|^|\")#{Regexp.escape(token)}/, "#{token_text}")
|
178
178
|
end
|
179
179
|
txt
|
180
180
|
end
|
@@ -232,5 +232,11 @@ RSpec.describe ConfidentialInfoRedactorLite::Redactor do
|
|
232
232
|
text = 'Coca-Cola announced a merger with Pepsi that will happen on on December 15th, 2020 for $200,000,000,000. Find out more at https://www.merger.com or contact john@merger.com.'
|
233
233
|
expect(described_class.new(text: text, language: 'en', tokens: tokens, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr, email_text: '**email**', number_text: '**number**', date_text: '**date**', hyperlink_text: '**url**', token_text: '*****').redact).to eq("***** announced a merger with ***** that will happen on on **date** for **number**. Find out more at **url** or contact **email**.")
|
234
234
|
end
|
235
|
+
|
236
|
+
it 'redacts all confidential information from a text #002' do
|
237
|
+
tokens = ['CLA']
|
238
|
+
text = 'LEGAL DISCLAIMER - CLA will not be held reponsible for changes.'
|
239
|
+
expect(described_class.new(text: text, language: 'en', tokens: tokens, dow: en_dow, dow_abbr: en_dow_abbr, months: en_months, months_abbr: en_month_abbr, email_text: '**email**', number_text: '**number**', date_text: '**date**', hyperlink_text: '**url**', token_text: '*****').redact).to eq("LEGAL DISCLAIMER - ***** will not be held reponsible for changes.")
|
240
|
+
end
|
235
241
|
end
|
236
242
|
end
|