質問編集履歴
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -135,12 +135,12 @@
|
|
135
135
|
コード
|
136
136
|
while (tf_idf1 != NULL) {
|
137
137
|
if (cnt != 0) {
|
138
|
-
tf_idf2->next;
|
138
|
+
tf_idf2 = tf_idf2->next;
|
139
139
|
}
|
140
140
|
cnt++;
|
141
141
|
if (tf_idf1->key == tf_idf2->key) {
|
142
142
|
naiseki += tf_idf1->tfidf * tf_idf2->tfidf;
|
143
|
-
tf_idf1->next;
|
143
|
+
tf_idf1 = tf_idf1->next;
|
144
144
|
cell *head = mk_tfidf_list(id2);
|
145
145
|
tf_idf2 = head;
|
146
146
|
cnt = 0;
|
@@ -148,7 +148,7 @@
|
|
148
148
|
if (tf_idf2 == NULL) {
|
149
149
|
cell *head = mk_tfidf_list(id2);
|
150
150
|
tf_idf2 = head;
|
151
|
-
tf_idf1->next;
|
151
|
+
tf_idf1 = tf_idf1->next;
|
152
152
|
cnt = 0;
|
153
153
|
}
|
154
154
|
}
|
@@ -161,12 +161,12 @@
|
|
161
161
|
|
162
162
|
while(tf_idf1 != NULL){
|
163
163
|
size1 += tf_idf1->tfidf * tf_idf1->tfidf;
|
164
|
-
tf_idf1->next;
|
164
|
+
tf_idf1 = tf_idf1->next;
|
165
165
|
}
|
166
166
|
|
167
167
|
while(tf_idf2 != NULL){
|
168
168
|
size2 += tf_idf2->tfidf * tf_idf2->tfidf;
|
169
|
-
tf_idf2->next;
|
169
|
+
tf_idf2 = tf_idf2->next;
|
170
170
|
}
|
171
171
|
|
172
172
|
|
1
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
<内容>
|
3
3
|
mk_tfidf_list関数は、引数として指定した記事IDに含まれる名詞のTF・IDF値をリストにして返す関数です。最終的に類似度計算結果を出力します。
|
4
4
|
|
5
|
+
```c++
|
6
|
+
以下コード
|
5
7
|
#include <iostream>
|
6
8
|
#include <fstream>
|
7
|
-
#include <
|
9
|
+
#include <cstdlib>
|
8
|
-
#include <
|
10
|
+
#include <cstring>
|
9
|
-
#include <
|
11
|
+
#include <cmath>
|
10
12
|
|
11
13
|
#define N 227
|
12
14
|
|
@@ -129,7 +131,9 @@
|
|
129
131
|
double size2 = 0;
|
130
132
|
int cnt = 0;
|
131
133
|
|
134
|
+
```以下の部分で間違いがあると思われます。
|
135
|
+
コード
|
132
|
-
|
136
|
+
while (tf_idf1 != NULL) {
|
133
137
|
if (cnt != 0) {
|
134
138
|
tf_idf2->next;
|
135
139
|
}
|
@@ -169,4 +173,6 @@
|
|
169
173
|
sim = naiseki / (sqrt(size2) * sqrt(size1));
|
170
174
|
cout << id1 << " - " << id2 << " : " << sim << endl;
|
171
175
|
return 0;
|
172
|
-
}
|
176
|
+
}
|
177
|
+
```
|
178
|
+
```
|