PHP Classes

PHP Word Completion: Suggest words that complete strings

Recommend this page to a friend!
  Info   View files Example   Demos   View files View files (21)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 123 This week: 1All time: 9,452 This week: 560Up
Version License PHP version Categories
wordcompletion 1.0.3MIT/X Consortium ...7PHP 5, Files and Folders, Text proces...
Description 

Author

This class can suggest words that complete strings.

It takes the name of a file that is read to extract the words to complete.

The class can take some typed letters and return an array with words that complete those letters from the text file.

Picture of castromiltone
Name: castromiltone <contact>
Classes: 1 package by
Country: Kenya Kenya
Age: ???
All time rank: 43478 in Kenya Kenya
Week rank: 411 Up2 in Kenya Kenya Up

Example

<?php
   
require '../WordCompletion.php';
   
    if (isset(
$_POST['input_text']) and isset($_POST['source']))
    {
       
$typed = $_POST['input_text'];
       
$filename = $_POST['source'];
       
       
#ini_set('memory_limit', '-1');
       
$wc = new WordCompletion($filename);
       
$wc->doCompletion($typed);

       
header("Content-Type: Application/json");
        echo
json_encode($wc->suggestions);
    }
 
?>


Details

WordCompletions

This is a PHP Class coded using PHP 7 author: Castro Hamiltone

Purpose

The aim is to provide a sorted ( based on the percentage of the frequecny of occurrence of the suggested word in the source of words ) list of most probable completions of a word given the begining letters of the word and a source of words to be used.

Parameters

*@param $begining:- string, the begining portion of the word to be completed. e.g 'yo', 'you', or 'your' etc<br>* *@param $words_source:- string, the filename (.txt) of the text file containing the commonly used words.<br>* You can use a corpus from The Guternburg Project

Return

array:- possible completions with probability in percentages


  Files folder image Files  
File Role Description
Files folder imagedemo (5 files, 1 directory)
Accessible without login Plain text file LICENSE.txt Lic. License
Accessible without login Plain text file README.md Doc. Documentation
Plain text file WordCompletion.php Class Class source
Accessible without login Plain text file words.txt Data Demo words source

  Files folder image Files  /  demo  
File Role Description
Files folder imagebootstrap-3.3.7-dist (3 directories)
  Accessible without login Plain text file 2600-0.txt Doc. Documentation
  Accessible without login Plain text file demo.php Example Example script
  Accessible without login HTML file index.html Data Auxiliary data
  Accessible without login Plain text file jquery-3.2.1.min.js Data Auxiliary data
  Accessible without login Plain text file words.txt Doc. Documentation

  Files folder image Files  /  demo  /  bootstrap-3.3.7-dist  
File Role Description
Files folder imagecss (8 files)
Files folder imagefonts (1 file)
Files folder imagejs (3 files)

  Files folder image Files  /  demo  /  bootstrap-3.3.7-dist  /  css  
File Role Description
  Accessible without login Plain text file bootstrap-theme.css Data Auxiliary data
  Accessible without login Plain text file bootstrap-theme.css.map Data Auxiliary data
  Accessible without login Plain text file bootstrap-theme.min.css Data Auxiliary data
  Accessible without login Plain text file bootstrap-theme.min.css.map Data Auxiliary data
  Accessible without login Plain text file bootstrap.css Data Auxiliary data
  Accessible without login Plain text file bootstrap.css.map Data Auxiliary data
  Accessible without login Plain text file bootstrap.min.css Data Auxiliary data
  Accessible without login Plain text file bootstrap.min.css.map Data Auxiliary data

  Files folder image Files  /  demo  /  bootstrap-3.3.7-dist  /  fonts  
File Role Description
  Accessible without login Plain text file glyphicons-halflings-regular.svg Data Auxiliary data

  Files folder image Files  /  demo  /  bootstrap-3.3.7-dist  /  js  
File Role Description
  Accessible without login Plain text file bootstrap.js Data Auxiliary data
  Accessible without login Plain text file bootstrap.min.js Data Auxiliary data
  Accessible without login Plain text file npm.js Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:123
This week:1
All time:9,452
This week:560Up