lhoestq HF staff commited on
Commit
3d1dbd3
1 Parent(s): ed8d0ba

Update analyze.py

Browse files
Files changed (1) hide show
  1. analyze.py +5 -6
analyze.py CHANGED
@@ -46,11 +46,10 @@ def batched(
46
 
47
 
48
  def mask(text: str) -> str:
49
- return text # don't apply mask for demo
50
- # return " ".join(
51
- # word[: min(2, len(word) - 1)] + re.sub("[A-Za-z0-9]", "*", word[min(2, len(word) - 1) :])
52
- # for word in text.split(" ")
53
- # )
54
 
55
 
56
  def get_strings(row_content: Any) -> str:
@@ -101,7 +100,7 @@ def analyze(
101
  ]
102
  return [
103
  PresidioEntity(
104
- text=mask(texts[i * len(scanned_columns) + j][recognizer_result.start : recognizer_result.end]),
105
  type=recognizer_result.entity_type,
106
  row_idx=row_idx,
107
  column_name=column_name,
 
46
 
47
 
48
  def mask(text: str) -> str:
49
+ return " ".join(
50
+ word[: min(2, len(word) - 1)] + re.sub("[A-Za-z0-9]", "*", word[min(2, len(word) - 1) :])
51
+ for word in text.split(" ")
52
+ )
 
53
 
54
 
55
  def get_strings(row_content: Any) -> str:
 
100
  ]
101
  return [
102
  PresidioEntity(
103
+ text=texts[i * len(scanned_columns) + j][recognizer_result.start : recognizer_result.end],
104
  type=recognizer_result.entity_type,
105
  row_idx=row_idx,
106
  column_name=column_name,