confidential_info_redactor 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2aba4fe814eb5d71124ad7a1b5f53840f1831d23
4
- data.tar.gz: f682003e08e11ef4747255034fb40baed2fcf639
3
+ metadata.gz: a7c9a3022b0122037ea64027a97f943cc753ac89
4
+ data.tar.gz: 77397cc9d846338bb693f1fc809c3811b286cc85
5
5
  SHA512:
6
- metadata.gz: e39b8a938438e920cdfc2c158048dd779168fa16ff7a47ba29e5d7bc604c1d12f71ea626875aa805b83c12143a20fa256da33d594e332c279b99d5e049c07e99
7
- data.tar.gz: 6b0096fe0d4b85068edc78326274d1a3d4a3b8bafe1f32bfe8d847623a9af65ff058d53dc004a28457e2eb33057065a62ce4277ef6b79ad83876d82c41334a47
6
+ metadata.gz: e07f637b20ca03bb595f540a9e631d2b78fd8f1b739073d79b06b2fa1caafde0882c6190b4d572b278779fddf7a7a49a69f2c96690de9410a57bbd17b364b738
7
+ data.tar.gz: 5ce788d7905e95ee76f92a9edd572e015d68e794986e1c26a9bb1a74e9cce0edd285dedcafd828d2a8ec71e8f632a04fa8295b07fdea4a5e23454b4de317d59f
@@ -75,7 +75,7 @@ module ConfidentialInfoRedactor
75
75
 
76
76
  def redact_tokens(txt)
77
77
  tokens.sort_by{ |x| x.split.count }.reverse.each do |token|
78
- txt.gsub!(/#{Regexp.escape(token)}/, "#{token_text}")
78
+ txt.gsub!(/(?<=\s|^|\")#{Regexp.escape(token)}/, "#{token_text}")
79
79
  end
80
80
  txt
81
81
  end
@@ -1,3 +1,3 @@
1
1
  module ConfidentialInfoRedactor
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -169,5 +169,11 @@ RSpec.describe ConfidentialInfoRedactor::Redactor do
169
169
  text = 'Coca-Cola announced a merger with Pepsi that will happen on December 15th, 2020 for $200,000,000,000. Please contact John Smith at j.smith@example.com or visit http://www.super-fake-merger.com.'
170
170
  expect(described_class.new(text: text, language: 'en', tokens: tokens, number_text: '**redacted number**', date_text: '^^redacted date^^', token_text: '*****').redact).to eq('***** announced a merger with ***** that will happen on ^^redacted date^^ for **redacted number**. Please contact ***** at ***** or visit *****.')
171
171
  end
172
+
173
+ it 'redacts all confidential information from a text #006' do
174
+ tokens = ['CLA']
175
+ text = 'LEGAL DISCLAIMER - CLA will not be held reponsible for changes.'
176
+ expect(described_class.new(text: text, language: 'en', tokens: tokens, number_text: '**redacted number**', date_text: '^^redacted date^^', token_text: '*****').redact).to eq("LEGAL DISCLAIMER - ***** will not be held reponsible for changes.")
177
+ end
172
178
  end
173
179
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confidential_info_redactor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias