Carlos-Francisco Méndez-Cruz

LSA soft clustering

...@@ -112,12 +112,12 @@ with open("vectors_file.txt", "w") as f: ...@@ -112,12 +112,12 @@ with open("vectors_file.txt", "w") as f:
112 p = [dict(pertenence)[x] if x in dict(pertenence) else 0.0 112 p = [dict(pertenence)[x] if x in dict(pertenence) else 0.0
113 for x in range(n_topics)] 113 for x in range(n_topics)]
114 f.write( 114 f.write(
115 - "{}\t{}".format("".join(sentence.split("\t")[0].split()), "".join(str(p)[1:].strip("]").split(",")))) 115 + "{}\t{}\n".format("".join(sentence.split("\t")[0].split()), "".join(str(p)[1:].strip("]").split(","))))
116 else: 116 else:
117 if n < n_docs: 117 if n < n_docs:
118 pertenence = [dict(pertenence)[x] if x in dict(pertenence) else 0.0 118 pertenence = [dict(pertenence)[x] if x in dict(pertenence) else 0.0
119 for x in range(n_topics)] 119 for x in range(n_topics)]
120 - f.write("%s\t\t%s" % (pertenence, sentence)) 120 + f.write("%s\t\t%s\n" % (pertenence, sentence))
121 n += 1 121 n += 1
122 else: 122 else:
123 break 123 break
......