PHP Classes

File: example_phrase.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of David Frendin  >  lib_dictionary  >  example_phrase.php  >  Download  
File: example_phrase.php
Role: Example script
Content type: text/plain
Description: Example: Correct an entire phrase
Class: lib_dictionary
Check text spelling with a dictionary in MySQL
Author: By
Last change:
Date: 8 years ago
Size: 1,821 bytes


Class file image Download
 * example_phrase.php
 * Copyright (c) 2007 David Frendin (
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. See the GNU General Public License
 * for more details.

 * Example: Phrase
 * This example will do a basic spell-check of a phrase, and return the frase formated
 * highlighting (in a discrete way) potential misspellings.

/* ___[ Below is example code ]_____________________ */
require_once('mysql4.php'); //from phpbb2

define('DICTIONARY_TABLE', 'dictionary');

//connect to db
$db = new sql_db('localhost', 'username', 'password', 'table', false);
"Could not connect to the database");

$dict = new dictclass();

$phrase = "Computers are magnificent tools for the realization of our dreams, but no machine can replace the human sparrk of spirit, compassion, love, and understanding."; //Louis Gerstner
$phrase2 = "The reall danger is not that computers will begin to think like men, but tat men will begin to think like computerrs."; //Sydney J. Harris
echo $dict->spell_phrase($phrase, true);
$dict->spell_phrase($phrase2, true);

/* ___[ End of example code ]_____________________ */