如何使用php识别文本中的名称

2022-01-02 00:00:00 nlp named-entity-recognition php

我想使用 php 从文本中提取姓名(名字和姓氏).例子:从下面的文本中,我想提取姓名(在本例中为 Aline Wright 和 Jesse Wright)

I want to extract name(firstnames and lastnames) from a text using php. Example: From text below I want to extract names(in this case Aline Wright and Jesse Wright)

艾琳·赖特是一名癌症幸存者,截肢者和新婚夫妇.周三晚上她开始表现出她是中风了.

Aline Wright is a cancer survivor, amputee and a newlywed. Wednesday night she began to show signs she was having a stroke.

我开始感觉到一些左臂麻木和面部下垂,"说艾琳.

"I started feeling some left arm numbness and a facial droop," said Aline.

在我看来,我可能是中风了."

"It appeared to me that I was probably having a stroke."

那是她结婚四天的丈夫,杰西·赖特,把她放在车里将她送往厄兰格医疗中心中心.赖特知道紧急情况.他是 Erlanger 的一名护士技师.

That's when her husband of four days, Jesse Wright, put her in the car and rushed her to the Erlanger Medical Center. Wright knows an emergency. He is a nurse technician at Erlanger.

推荐答案

如果你想做 命名实体识别 (NER) 使用 PHP,您需要调用外部 NER 包 或使用在线自然语言处理API.

If you want to do named entity recognition (NER) using PHP, you'll need to either call out to an external NER package or make use of an online natural language processing API.

API

下面列出了 NLP API.对于初学者来说,Complexity Intelligence 和 Alchemy API 可能比 OpenCalais 更容易使用.

NLP API are listed below. Complexity Intelligence and Alchemy API will probably be moderately easier to use for beginners than OpenCalais.

  • 复杂智能 - 请参阅 PHP 命名实体标记示例代码 此处.
  • Alchemy API - 下载他们的 PHP SDK 此处.
  • OpenCalais - 请参阅 PHP 示例代码 此处.
  • 无代码 API - 通过使用他们的 api 调用提供您需要处理的文本.10K 免费请求足以验证任何假设.
  • Complexity Intelligence - see the PHP named entity tagging sample code here.
  • Alchemy API - download their PHP SDK here.
  • OpenCalais - see the PHP sample code here.
  • No Code API - by using their api-calls provide text which u need to process. 10K free requests is quite enough for checking any hypothesis.

NER 包

您可以用于 NER 的一些软件包是:

A few software packages you can use for NER are:

  • Stanford CoreNLP(Java)
  • LingPipe(Java)
  • NLTK (Python)
  • OpenNLP(Java)
  • YamCha (C++)
  • Stanford CoreNLP (Java)
  • LingPipe (Java)
  • NLTK (Python)
  • OpenNLP (Java)
  • YamCha (C++)

其中,Stanford CoreNLP 可能是一个不错的起点.与许多 NLP API 类似,它为 NER 等常见任务提供了完整的处理管道.

Of these, Stanford CoreNLP is probably a good place to start. Similar to many NLP APIs, it provides a complete processing pipeline for common tasks such as NER.

相关文章