Ask To Apps
  • Home
  • WordPress
  • Elasticsearch
  • PHP
  • Linux
  • Website Peformance

Tag : words

PHP code to exact keywords from text.

17/07/2014 Article

PHP code to find out keywords out of text.
There is very simple way to find out keywords out of text and you can do it without having NPL knowledge. Here are following steps…
1. Read text and put in variable.
2. Find words out of text by using regx.
3. Exclude banned or known words if you want.
4. Find frequency of words.

Find words.

$words = array();
$excludeWords = array();
preg_match_all ('/(\w+)/i', $text, $ words);
$words = $this->words ['0'];
$words = array_diff($words,$excludeWords);

Find Frequency.

$words = array_count_values ($words);
arsort ($words);

Get words of more than x frequency.

$a = (int) $a;
$tmp=array();
foreach ($words as $key => $value) {
if ($value >= $a){
		$tmp[$key] = $value;
}
else {
		break;
}
}
return $tmp;

Categories: PHP

Tags: keywords, text-to-keywords, words

About Author:

Appa

Recent Posts

  • Install and configure logstash-forwarder
  • Redirect request on php script through squid proxy
  • Alerting for Elasticsearch : Log watcher in elasticsearch using ES Watcher
  • Detect face from image using python script with OpenCV
  • Change mysql root password on centos
  • Search part of word in elasticsearch using nGram – auto-complete search
  • Connect VPN on centos linux using command line
  • Custom river plugin in elasticsearch
  • Backup elasticsearch with snapshot and restore api
  • PHP code to exact keywords from text.

Tags

apache Apache Lucene cache Distributed Elastic Index Elasticsearch elasticsearch performance Git Clone Git Hub Git Hub Configuration Git Hub Installation grep Import Install MySQL JSON over HTTP Linux Linux Command Linux Commands Linux search local file lsyncd md5sum Multile Domain Multisite MySQL Open Source optimization performance php performance real time search remote file Remote Git Hub remote sync RESTful Scale Schema Free Search Engine Search Index Search keyword static cache Sub Domain sync Very fast Wordpress Wordpress multisite

Copyright Ask To Apps 2021 | Proudly powered by WordPress

facebook twitter google linkedin Email Rss