gpt4 book ai didi

ibm-watson - 解析电子邮件和电话号码实体?

转载 作者:行者123 更新时间:2023-12-02 18:47:47 25 4
gpt4 key购买 nike

有没有办法训练 Watson 识别电子邮件实体和电话号码,而无需求助于常规表达?

最佳答案

以前:

Steven, I had the same doubt a few months ago. IBM Watson Conversation doesn't have System entities for phone numbers or e-mail address, not yet. Anyway, it is a good idea for creating new System entities, right? We can give ideas with feedback for IBM.

But, one contour solution is to use context variables and create new entities. Try to create one entity like @mail, and add the values @gmail.com, @hotmail.com, @outlook.com, and any e-mail that you want to recognize.

And you will use with the condition like:

if @mail, response: Your e-mail is $email

for recognizing the e-mail address, but for saving the e-mail you will need to create one Regex inside the context variable like:

"email": "<? input.text.extract('[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+(\\.[a-zA-Z]+){1,}',0)?>"

Now, for phone numbers:

You can activate the System Entity @sys-number, and you will get just a few numbers, like 11 numbers and save inside one context variable too.

Create one condition with @sys-number AND
input.text.find('^[^\\d]*[\\d]{11}[^\\d]*$',0)')
for find the number and sys-number for recognize the numbers by user.

编辑:(带有新的发行说明 - 在 BETA 版本中):

现在,IBM Watson Conversation 具有实体模式,我们可以使用它来获取电子邮件地址、电话号码等。

现在,当您创建一个新的 @entity 时,您可以可选告知您要使用PatternSynonymous,因此,您将创建一个新实体(在我的示例中为 @contactInfo),以及具有用于获取邮件patterns 的值或电话值,例如:

enter image description here

并且,在 Watson 训练您的更改后,检查在“立即尝试”中是否完美运行:

enter image description here

  • 邮件模式:\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{ 2,}\b,例如 test@gmail.com
  • 美国手机的 Patter:(\d{3})-(\d{3})-(\d{4}),例如800-426-4968

查看有关创建实体的更多信息 here .

关于ibm-watson - 解析电子邮件和电话号码实体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45092787/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com