Extract sentences from HTML in PHP [duplicate]

一曲冷凌霜 提交于 2019-12-24 08:49:12

问题


I'm doing a PHP project (using Codeigniter) on text summarization and for that I need to extract sentences from content of a Rich TextBox (this content includes tags). Therefore is there a proper method or Codeigniter library to extract sentences from a content containing HTML tags?


回答1:


A php function strip_tags() should help you. It returns string without php and html tags. If you just need to count sentences, you could do count(explode(". ", $text)) The delimiter is a typical end of a sentence.

Plain simple and limited, but doesn't require any libraries.




回答2:


This technique is called as web-scraping

Have a look at this



来源:https://stackoverflow.com/questions/21330852/extract-sentences-from-html-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!