Skip to content

Commit

Permalink
added link_batch and removed an unused function (#6)
Browse files Browse the repository at this point in the history
* added link_batch and removed an unused function

* removed test file
  • Loading branch information
ketakipai committed Dec 1, 2022
1 parent 5b2804b commit f3aa7ef
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions pii_check/pii_check_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ def get_payload(content, enabled_entity_list):
if len(enabled_entity_list) == 0:
payload = {
"text": content,
"link_batch": True,
"entity_detection": {
"accuracy": "high",
},
}
else:
payload = {
"text": content,
"link_batch": True,
"entity_detection": {
"accuracy": "high",
"entity_types": [{"type": "ENABLE", "value": enabled_entity_list}],
Expand Down Expand Up @@ -48,14 +50,6 @@ def get_flagged_lines(files):
return flagged


def check_whether_flagged_line(line, flagged, file):
for item in flagged:
if line > item[0] and line < item[1] and item[2] == file:
return True
else:
return False


def get_response_from_api(content, url, api_key, enabled_entity_list):
payload = get_payload(content, enabled_entity_list)
headers = {"Content-Type": "application/json", "X-API-KEY": api_key}
Expand Down

0 comments on commit f3aa7ef

Please sign in to comment.