[Scipy-tickets] [SciPy] #1582: APPCRASH error when trying to use Latent Semantic Indexing method with Gensim

SciPy Trac scipy-tickets@scipy....
Thu Jan 12 12:20:50 CST 2012


#1582: APPCRASH error when trying to use Latent Semantic Indexing method with
Gensim
--------------------+-------------------------------------------------------
 Reporter:  Shahab  |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  high    |   Milestone:  0.11.0  
Component:  Other   |     Version:  0.10.0  
 Keywords:          |  
--------------------+-------------------------------------------------------

Comment(by Shahab):

 {{{
 def CalculateSimilarityLSI(corpus, dict):
 #<< LET Transformation >>
         lsi = models.LsiModel(corpus, num_topics = num_Topics)
         index_lsi = similarities.MatrixSimilarity(lsi[corpus])

         for k, v in dict_Queries.items():
             File.write("Check Key: " +k+ "\n")
             print "Running.... \n"
             vec_bow = dict.doc2bow(v.split(), allow_update=True)
             print "Past.. \n"
             vec_lsi = lsi[vec_bow]

             #indexing the LSI
             #The error occurs somewhere around here......
             sims = index_lsi[vec_lsi]
             sims = sorted(enumerate(sims), key = lambda item: -item[1])

             if not cut_Off == 0:
                 sims = sims[0:cut_Off]
             else:
                 pass

             for t in sims:

                 dup_info = dict_tcs.get(t[0])

                 if t[1] > 0.75:
                     #print "Key: " + k + " Link: " + dup_info + "\n"
                     File.write("Adding: "+str(t)+ " To LSI actual \n")
                     if dict_Actual_LSI.has_key(k):
                         links = dict_Actual_LSI.get(k)
                         links.append(dup_info)
                     else:
                         links = []
                         links.append(dup_info)
                         dict_Actual_LSI[k] = links
             print "Added\n"

 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1582#comment:2>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list