common.skipToContent

AI 实体创建

在 AI 协助下创建自定义实体模式

使用 AI 生成正则表达式模式,以检测内置识别器未覆盖的自定义实体类型。

AI实体创建在基础计划及以上可用。免费计划用户可以手动使用正则表达式模式创建自定义实体。

AI Entity Creation is available on Basic plan and above. Free plan users can create custom entities manually using regex patterns.


工作原理

1

提供 3-5 个您希望检测的模式示例

用简单的语言告诉AI您想检测的内容

2

AI 分析示例并生成正则表达式模式

AI根据您的描述创建正则表达式模式

3

使用示例文本测试该模式

使用示例文本测试模式,并在需要时进行调整

4

查看质量指标并在必要时进行调整

保存您的自定义实体以供分析使用


创建AI实体

步骤1:打开自定义实体

  1. Go to Settings → Custom Entities
  2. Click Create New Entity
  3. Select AI-Assisted mode

步骤2:描述您的模式

输入您想检测的内容的清晰描述。具体说明格式。

好的示例

  • "Employee IDs in the format EMP-12345 where 12345 is a 5-digit number"
  • "Order numbers starting with ORD followed by 8 digits, like ORD12345678"
  • "German postal codes - 5 digit numbers between 01000 and 99999"
  • "Internal project codes: 3 uppercase letters, a dash, and 4 digits (e.g., ABC-1234)"

避免模糊的描述

  • "ID numbers" - Too vague, what format?
  • "Customer data" - What specific pattern?
  • "Codes" - Need more specifics about format

步骤3:审查生成的模式

AI根据您的描述生成正则表达式模式。请审查:

// For "Employee IDs: EMP-12345"

EMP-\d{5}

步骤4:测试模式

  1. Enter sample text in the test area
  2. Click Test Pattern
  3. Verify that matches are highlighted correctly
  4. Check for false positives and false negatives

步骤5:保存实体

  1. Enter a name for your entity (e.g., EMPLOYEE_ID)
  2. Add an optional description
  3. Choose a category (Personal, Technical, Custom, etc.)
  4. Click Save Entity

代币成本

50代币每个AI实体创建

这是一个固定成本,无论模式复杂性如何。手动输入正则表达式是免费的。

要最小化成本:

  • Be as specific as possible in your first description
  • Use manual regex if you already know the pattern
  • Test thoroughly before saving to avoid recreating

手动正则表达式创建

如果您了解正则表达式,您可以手动创建自定义实体,而无需使用代币:

  1. Go to Settings → Custom Entities
  2. Click Create New Entity
  3. Select Manual mode
  4. Enter your regex pattern directly
  5. Test and save

正则表达式提示

模式含义示例匹配
\dAny digit (0-9)5
\d{3}Exactly 3 digits123
[A-Z]Uppercase letterA
[A-Z]{3}3 uppercase lettersABC
\wLetter, digit, or underscorea, 1, _
-Literal dash-
?Optional (0 or 1)
+One or more
*Zero or more

示例模式

Employee ID (EMP-12345)

EMP-\d{5}

Order Number (ORD12345678)

ORD\d{8}

Project Code (ABC-1234)

[A-Z]{3}-\d{4}

License Plate (ABC 123 or ABC-123)

[A-Z]{3}[\s-]?\d{3}


使用自定义实体

一旦创建,自定义实体的工作方式与内置实体相同:

在分析器中

  1. Open the entity selection panel
  2. Find your custom entity under the Custom category
  3. Check the box to include it in detection
  4. Run analysis as normal

在预设中

  1. Create or edit a preset
  2. Select your custom entity from the entity list
  3. Save the preset

Tip

自定义实体以“自定义”徽章显示,以将其与内置实体区分开。


管理自定义实体

编辑实体

  1. Go to Settings → Custom Entities
  2. Find your entity and click Edit
  3. Modify the name, description, or pattern
  4. Test the updated pattern
  5. Save changes

删除实体

  1. Go to Settings → Custom Entities
  2. Find your entity and click Delete
  3. Confirm deletion

Note

删除自定义实体将从所有使用它的预设中移除。预设仍将有效,但不会检测该实体类型。


最佳实践

在您的AI描述中要具体 - 包括格式细节和示例
在保存之前测试模式的边缘情况
使用有意义的名称,例如CUSTOMER_ORDER_ID,而不是ID1
添加描述以帮助记住每个实体检测的内容
如果您熟悉手动正则表达式 - 节省代币
将相关的自定义实体分组在同一预设中以便于管理

Related Documentation

最后更新:2026年3月