fozziethebeat / S-Space

The S-Space repsitory, from the AIrhead-Research group
GNU General Public License v2.0
203 stars 106 forks source link

java.lang.IllegalArgumentException: dimensions must be positive when running lsa #80

Open uacy opened 7 years ago

uacy commented 7 years ago

When I try to run this code:

public LSA() throws IOException { int noOfFiles = 100; File[] files = new File(corpusPath). LatentSemanticAnalysis algo = new LatentSemanticAnalysis(10);

    for (int i = 0; i < noOfFiles; ++i) {
        in = new BufferedReader(new FileReader(files[i]));
        algo.processDocument(in);
    }
    algo.processSpace(System.getProperties()); <-- Here is where it crashes

}

I get this error:

Aug 28, 2017 9:07:17 PM edu.ucla.sspace.common.GenericTermDocumentVectorSpace processSpace INFO: performing log-entropy transform Aug 28, 2017 9:07:17 PM edu.ucla.sspace.matrix.LogEntropyTransform$LogEntropyGlobalTransform INFO: Computing the total row counts Aug 28, 2017 9:10:58 PM edu.ucla.sspace.matrix.LogEntropyTransform$LogEntropyGlobalTransform INFO: Computing the entropy of each row Aug 28, 2017 9:11:00 PM edu.ucla.sspace.matrix.LogEntropyTransform$LogEntropyGlobalTransform INFO: Scaling the entropy of the rows Aug 28, 2017 9:11:09 PM edu.ucla.sspace.lsa.LatentSemanticAnalysis processSpace INFO: reducing to 10 dimensions Exception in thread "main" java.lang.IllegalArgumentException: dimensions must be positive at edu.ucla.sspace.matrix.OnDiskMatrix.(OnDiskMatrix.java:98) at edu.ucla.sspace.matrix.Matrices.create(Matrices.java:216) at edu.ucla.sspace.matrix.MatrixIO.readDenseTextMatrix(MatrixIO.java:927) at edu.ucla.sspace.matrix.MatrixIO.readMatrix(MatrixIO.java:795) at edu.ucla.sspace.matrix.MatrixIO.readMatrix(MatrixIO.java:762) at edu.ucla.sspace.matrix.factorization.SingularValueDecompositionMatlab.factorize(SingularValueDecompositionMatlab.java:137) at edu.ucla.sspace.lsa.LatentSemanticAnalysis.processSpace(LatentSemanticAnalysis.java:439) at app.LSA.(LSA.java:37) at app.AppMain.init(AppMain.java:60) at app.AppMain.(AppMain.java:49) at app.AppMain.main(AppMain.java:53)

I am not sure if I use the library wrong, but I don't see a problem in my code.

Could you help me with this?