Skip to content

Sample not working! :( #3

@rodrix385

Description

@rodrix385

  I am running the sample code:
$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;

...and I get
| Fatal error: Uncaught Exception: Error matrix dimension in E:\Dropbox\XAMPP7\htdocs\text-analysis\src\lib.php:19
  | Stack trace:
  | #0 E:\Dropbox\XAMPP7\htdocs\text-analysis\src\LSA.php(117): PHPLsa\mult(Array, Array)
  | #1 E:\Dropbox\XAMPP7\htdocs\text-analysis\src\LSA.php(185): PHPLsa\LSA->transform(Array)
  | #2 E:\Dropbox\XAMPP7\htdocs\text-analysis\test.php(29): PHPLsa\LSA->query('the brown fox r...', Array)
  | #3 {main}
  | thrown in E:\Dropbox\XAMPP7\htdocs\text-analysis\src\lib.php on line 19

  |  

Using PHP 7.09 under Windows on XAMPP

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions