PHP Classes
elePHPant
Icontem

PHP Singular Value Decomposition: Analyze texts to find a relation with given terms

Recommend this page to a friend!
  Info   View files Documentation   View files View files (19)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2018-09-25 (9 months ago) RSS 2.0 feedNot enough user ratingsTotal: 119 All time: 9,025 This week: 364Up
Version License PHP version Categories
php-lsa 1.0.0GNU General Publi...5Algorithms, PHP 5, Text processing
Description Author

This package can analyze texts to find a relation with given terms.

It can take an array with text document strings and transform them so they can be queried.

The package can also take a given text and perform a query to return the index of the document that matches better text that was given in the original array of text documents.

Innovation Award
PHP Programming Innovation award nominee
September 2018
Number 2
Many applications need to search for documents that are more relevant to a given subject.

This package can take a given text and find documents that are more relevant to the text passed as parameter using Singular Value Decomposition algorithm.

Manuel Lemos
  Performance   Level  
Name: Raskin Veniamin <contact>
Classes: 11 packages by
Country: Russian Federation Russian Federation
Age: ???
All time rank: 2657 in Russian Federation Russian Federation
Week rank: 22 Up3 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

 

Details

PHP LSA Library

Singular value decomposition in PHP implementation language.

Install


#### Examples

Find the most similar text.
$documents = [
        "The quick brown fox jumped over the lazy dog",
        "hey diddle diddle, the cat and the fiddle",
        "the cow jumped over the moon",
        "the little dog laughed to see such fun",
        "and the dish ran away with the spoon",
 ];

 $lsa = new LSA(4);
 $trans = $lsa->fitTransform($documents);
 
 $query = "the brown fox ran around the dog";
 $index = $lsa->query($query, $trans);
 echo $documents[$index], PHP_EOL;


#### TODO
- [x] add save data
- [x] add load data
- [x] change transform
  Files folder image Files  
File Role Description
Files folder imagesrc (11 files)
Files folder imagetests (4 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file ILearn.php Class Class source
  Plain text file IPersistent.php Class Class source
  Plain text file ITransformTextToMatrix.php Class Class source
  Accessible without login Plain text file lib.php Example Example script
  Plain text file LSA.php Class Class source
  Plain text file PersistentFile.php Class Class source
  Accessible without login Plain text file stop_words.php Conf. Configuration script
  Plain text file TfidfText.php Class Class source
  Plain text file TransformTextByKeyWord.php Class Class source
  Plain text file TransformTextWordBool.php Class Class source
  Plain text file TransformTextWordCount.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file TestLSA.php Class Class source
  Plain text file TestPersistentFile.php Class Class source
  Plain text file TestPhpLib.php Class Class source
  Plain text file TestTransformText.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:119
This week:0
All time:9,025
This week:364Up