33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import textwrap
|
|
|
|
def get_masking_prompt(text: str) -> str:
|
|
"""
|
|
Returns the prompt for masking sensitive information in legal documents.
|
|
|
|
Args:
|
|
text (str): The input text to be masked
|
|
|
|
Returns:
|
|
str: The formatted prompt with the input text
|
|
"""
|
|
prompt = textwrap.dedent("""
|
|
您是一位专业的法律文档脱敏专家。请按照以下规则对文本进行脱敏处理:
|
|
|
|
规则:
|
|
1. 人名:
|
|
- 两字名改为"姓+某"(如:张三 → 张某)
|
|
- 三字名改为"姓+某某"(如:张三丰 → 张某某)
|
|
2. 公司名:
|
|
- 保留地理位置信息(如:北京、上海等)
|
|
- 保留公司类型(如:有限公司、股份公司等)
|
|
- 用"某"替换核心名称
|
|
3. 保持原文其他部分不变
|
|
4. 确保脱敏后的文本保持原有的语言流畅性和可读性
|
|
|
|
输入文本:
|
|
{text}
|
|
|
|
请直接输出脱敏后的文本,无需解释或其他备注。
|
|
""")
|
|
|
|
return prompt.format(text=text) |