質問編集履歴

1

URL先のコードをもう少し追加してみたのですが、同じエラーが出てしまいました…。

2017/10/17 08:18

投稿

aoisj
aoisj

スコア27

test CHANGED
File without changes
test CHANGED
@@ -17,8 +17,6 @@
17
17
 
18
18
 
19
19
  ```
20
-
21
-
22
20
 
23
21
  # -*- coding: utf-8 -*-
24
22
 
@@ -82,7 +80,7 @@
82
80
 
83
81
  sels.append(chunk[0])
84
82
 
85
- print(sels)
83
+ """print(sels)"""
86
84
 
87
85
 
88
86
 
@@ -92,11 +90,23 @@
92
90
 
93
91
  dictionary = corpora.Dictionary(sels)
94
92
 
95
- #(単語の出現が1以下)を除く
93
+ #(単語の出現が1以下) を除く
96
94
 
97
95
  dictionary.filter_extremes(no_below = 1)
98
96
 
97
+ #(辞書の単語数)次元のベクトルに変換
99
98
 
99
+ corpus = [dictionary.doc2bow(sels) for sel in sels]
100
+
101
+
102
+
103
+ #LDAモデルに投入
104
+
105
+ lda = models.LdaModel(corpus = corpus, id2word = dictionary,
106
+
107
+ #トピック数:10
108
+
109
+ num_topics = 10)
100
110
 
101
111
  ```
102
112