Re: urgent question about LSA in S-Space package

20 views
Skip to first unread message

David Jurgens

unread,
Apr 6, 2015, 11:08:05 AM4/6/15
to s-spac...@googlegroups.com, s-space-re...@googlegroups.com
Hi Ibtehal,

  The vector you pass in as an argument is a vector that you (the caller) create.  The contents of your query will be summed into this vector, making it a representation of the document's tokens.  The vector should be of the same length as the number of dimensions in the SemanticSpace.

  Sorry for the confusion with the wiki.  I'll update the page to reflect this.

  Thanks,
  David

On Sat, Apr 4, 2015 at 10:26 AM, Ibtehal Baazeem <isba...@gmail.com> wrote:
Dear developers,

Firstly, thank you for the great package S-Space. I have used it to build the Latent Semantic Analysis model but when I am trying to use this model in answering  a query 
I got a problem in using DocumentVectorBuilder, which is:

Based on the example provided in this page :

if I have: String query=“hello world” and I want to create the vector for the query I can do:
DocumentVectorBuilder builder = new DocumentVectorBuilder(mysspace);
        Vector documentVector = builder.buildVector(query);


however, I got an error in the call of buildVector and it requires a vector to be passed, based on its specification
buildVector(BufferedReader, DoubleVector) - Method in class edu.ucla.sspace.common.DocumentVectorBuilder
but I don’t know which vector to pass?

Please explain ASAP as I’m using the package in my code.

Many Thanks,

--

---
You received this message because you are subscribed to the Google Groups "S-Space Package Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to s-space-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ibtehal Baazeem

unread,
May 4, 2015, 6:10:54 AM5/4/15
to s-space-re...@googlegroups.com, s-spac...@googlegroups.com
Thank you so much for your answer.

So, for creating the document representation I just need the following?

 //iteration through all sentences in filteredQuerSen List to build its initial vector

    for (int i=0; i< filteredQuerSen.size(); i++)

    {

    String currentSen=filteredQuerSen.get(i);

    DoubleVector documentVectorr = new DenseVector(sspace.getVectorLength());

    BufferedReader br = new BufferedReader(new StringReader(currentSen));

        builder.buildVector(br, documentVectorr);

        br.close();

   

    }


Best Regards,

Reply all
Reply to author
Forward
0 new messages