PHP Classes

File: example_single_words_only.php

Recommend this page to a friend!
  Classes of Peter Kahl  >  Multibyte Keyword Generator  >  example_single_words_only.php  >  Download  
File: example_single_words_only.php
Role: Example script
Content type: text/plain
Description: produces only single word keywords
Class: Multibyte Keyword Generator
Extract meta keywords from multi-byte texts
Author: By
Last change: Added link

Added link to my site.
Second commit
Initial commit
Date: 1 month ago
Size: 5,776 bytes


Class file image Download

 * Multibyte Keyword Generator
 * Copyright (c) 2009-2012, Peter Kahl. All rights reserved.
 * Use of this source code is governed by a GNU General Public License
 * that can be found in the LICENSE file.

// for debugging

// the example text
$text = 'The White House said Friday that the $787-billion stimulus package had created or saved about 1 million jobs so far -- a number that is hard to verify because of the guesswork involved in determining whether businesses had retained workers due to the stimulus who otherwise would have been laid off.<br>

 After compiling reports from more than 100,000 businesses, nonprofit groups and state and local governments that received stimulus money, the <a href=""> Obama administration said</a> the program was on pace to save or create 3.5 million jobs by next year.<br>
 "So there\'s a lot more job creation to come from this act before it leaves the scene," Jared Bernstein, an economics advisor to Vice President Joe Biden, told reporters.<br>
The White House released its findings with a bipartisan flourish, inviting Republican Gov. Arnold Schwarzenegger of California and Democratic Gov. Martin O\'Malley of Maryland to a news conference touting the results. Accompanying the White House announcement was a video showcasing ordinary workers who said they owed their jobs and car purchases to the stimulus.<br>
The job figures released by the White House were based on detailed reports filed by certain recipients of about $160 billion in stimulus money. The reports show the employers created or saved more than 640,000 jobs, the White House said. About 325,000 of those jobs were in education; 80,000 were in construction.<br>

 The White House said the job impact rises to 1 million when indirect benefits of the federal spending are included, as when a worker hired with stimulus dollars spends money at a restaurant.<br>
 Excluding indirect job-creation, California logged the most jobs created or saved, with 110,185. Next were New York, with 40,620, and Washington state, with 34,517.<br>
 With nationwide unemployment approaching 10%, the White House data provoked some skepticism. The Obama administration is basing its estimates partly on a concept that is difficult to measure: jobs saved. State governments and other agencies may be using subjective criteria in deciding whether stimulus money legitimately saved a job that was about to be eliminated.<br>
 Peter Morici, an economist and professor at the University of Maryland, said that claims of jobs saved were "not verifiable. It\'s only verifiable in the loosest sense."<br>

 Morici added: "The impact of the stimulus is less than the president is claiming and more than the Republicans will admit. It certainly has had an effect. But 1 million jobs is a fantasy."<br>
 Republican lawmakers were dismissive of the White House report.<br>
 Rep. Eric Cantor of Virginia, the Republican whip, said: "Americans, particularly those with friends and family out of work, know that the administration\'s claims of stimulus success and jobs saved or created are not serious."<br>
 But Obama officials said they were confident their numbers were accurate.<br>
 Edward DeSeve, an Obama advisor helping to oversee the stimulus, said recipients of the funds had no incentive to inflate job estimates.<br>

 "What we have to do is rely on the fact that our public officials are honest," DeSeve said. He added that "there\'s no advantage to a state from overstating or understating."<br>

// specify valid location of the class
include (dirname(__FILE__) .'/class.colossal-mind-mb-keyword-generator.php');

// load the text, either from database or a file
// text MAY contain HTML tags
$params['content'] = $text;

// if not defined, will default to UTF-8
$params['encoding'] = 'utf-8'; // case insensitive

// this one is used so that this example is properly displayed in browser
// the encoding should be same as the value above
header('Content-type: text/html; charset=utf-8');

// define the language of the text
// if not defined, will default to English (en_GB)
$params['lang'] = 'en_GB'; // case insensitive

// specify only if you want any languages to be ignored by the class
// What it does: If the class encounters this language(s), it will
// return empty string ''
// ignore languages
$params['ignore'] = array('zh_CN', 'zh_TW', 'ja_JP'); // must be an array; lower case; case sensitive !!!
// if not defined, will default to values set in the class

// 1-word keywords
$params['min_word_length'] = 4; // min length of single words
$params['min_word_occur'] = 3; // min occur of single words

// 2-word keyphrases
$params['min_2words_length'] = 0; // min length of words for 2 word phrases; value 0 will DISABLE !!!

// 3-word keyphrases
$params['min_3words_length'] = 0; // min length of words for 3 word phrases; value 0 will DISABLE !!!
$keyword = new colossal_mind_mb_keyword_gen($params);

$autoKeywords = $keyword->get_keywords();