Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -105,12 +105,12 @@ for pertenence, sentence in zip(corpus_lsa, sentences): | ... | @@ -105,12 +105,12 @@ for pertenence, sentence in zip(corpus_lsa, sentences): |
105 | if n_docs <= 0: | 105 | if n_docs <= 0: |
106 | #print "%s\t\t%s" % (pertenence, sentence.split("\t")[0]) | 106 | #print "%s\t\t%s" % (pertenence, sentence.split("\t")[0]) |
107 | p=[dict(pertenence)[x] if x in dict(pertenence) else 0.0 | 107 | p=[dict(pertenence)[x] if x in dict(pertenence) else 0.0 |
108 | - for x in xrange(n_topics)] | 108 | + for x in range(n_topics)] |
109 | print("{} {}".format("".join(sentence.split("\t")[0].split()), "".join(str(p)[1:].strip("]").split(",")))) | 109 | print("{} {}".format("".join(sentence.split("\t")[0].split()), "".join(str(p)[1:].strip("]").split(",")))) |
110 | else: | 110 | else: |
111 | if n<n_docs: | 111 | if n<n_docs: |
112 | pertenence=[dict(pertenence)[x] if x in dict(pertenence) else 0.0 | 112 | pertenence=[dict(pertenence)[x] if x in dict(pertenence) else 0.0 |
113 | - for x in xrange(n_topics)] | 113 | + for x in range(n_topics)] |
114 | print("%s\t\t%s" % (pertenence, sentence)) | 114 | print("%s\t\t%s" % (pertenence, sentence)) |
115 | n+=1 | 115 | n+=1 |
116 | else: | 116 | else: | ... | ... |
-
Please register or login to post a comment