Spaces:
Sleeping
Sleeping
Commit
·
033a601
1
Parent(s):
62dbb98
Add anonymization app 3
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ generator = pipeline("text2text-generation", model="t5-small", tokenizer="t5-sma
|
|
7 |
# Function to construct the anonymization prompt
|
8 |
def construct_prompt(input_text):
|
9 |
prompt = f"""
|
10 |
-
You are a text anonymizer. Your task is to process a given text, identify all
|
11 |
|
12 |
The input text will be provided, and your output should follow this JSON structure:
|
13 |
{{
|
@@ -19,7 +19,7 @@ def construct_prompt(input_text):
|
|
19 |
}}
|
20 |
|
21 |
### Guidelines:
|
22 |
-
1. Only replace
|
23 |
2. Ensure the pseudonyms are realistic and appropriate for the type of name being replaced.
|
24 |
3. Keep all other parts of the text unchanged.
|
25 |
4. If no names are found, return the original text with an empty dictionary.
|
|
|
7 |
# Function to construct the anonymization prompt
|
8 |
def construct_prompt(input_text):
|
9 |
prompt = f"""
|
10 |
+
You are a text anonymizer. Your task is to process a given text, identify all entity or personnal names, replace them with unique and realistic pseudonyms, and return both the anonymized text and a dictionary linking the original names to the replacement names.
|
11 |
|
12 |
The input text will be provided, and your output should follow this JSON structure:
|
13 |
{{
|
|
|
19 |
}}
|
20 |
|
21 |
### Guidelines:
|
22 |
+
1. Only replace entity names.
|
23 |
2. Ensure the pseudonyms are realistic and appropriate for the type of name being replaced.
|
24 |
3. Keep all other parts of the text unchanged.
|
25 |
4. If no names are found, return the original text with an empty dictionary.
|