如何使用 php 识别文本中的姓名
我想使用 php 从文本中提取姓名(名字和姓氏)。 例子: 我想从下面的文本中提取姓名(在本例中为 Aline Wright 和 Jesse Wright)
艾琳·赖特 (Aline 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."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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您想使用 PHP 进行命名实体识别 (NER) ,您需要调用外部 NER 包或使用在线自然语言处理 API。
API
下面列出了 NLP API。对于初学者来说,Complexity Intelligence 和 Alchemy API 可能比 OpenCalais 更容易使用。
NER 软件包
您可以用于 NER 的一些软件包是:
其中,Stanford CoreNLP 可能是一个好地方开始。与许多 NLP API 类似,它为 NER 等常见任务提供完整的处理管道。
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.
APIs
NLP API are listed below. Complexity Intelligence and Alchemy API will probably be moderately easier to use for beginners than OpenCalais.
NER Packages
A few software packages you can use for NER are:
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.
我会使用命名实体识别器。 CPAN 上有很多这样的内容,那里有一个活跃的语言学社区。
然后,在 PHP 中,执行以下操作:
I'd use a named entity recognizer. There are many of these up on CPAN where there is an active linguistics community.
Then, in PHP, do something like:
我编写了这个 PHP 扩展,但准备从源代码进行编译。
https://github.com/rjjakes/MITIE-PHP
I wrote this PHP extension but be prepared to compile from source.
https://github.com/rjjakes/MITIE-PHP