如何使用php识别文本名称 [英] How to recognize names from a text using php

查看:122
本文介绍了如何使用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)是癌症幸存者, 被截肢者和新婚夫妇.周三 晚上,她开始表现出她是 中风.

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."

那是她四天的丈夫, 杰西·赖特(Jesse Wright),把她放在车里, 送她去埃尔兰格医疗 中心.赖特知道紧急情况.他 是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 ) ,您需要调用外部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.与OpenCalais相比,对于初学者来说,复杂度智能和Alchemy API可能会更容易使用.

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

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可能是一个不错的起点.与许多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.

这篇关于如何使用php识别文本名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆