teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

コードの編集

2021/11/13 05:38

投稿

hanao_
hanao_

スコア6

title CHANGED
File without changes
body CHANGED
@@ -269,36 +269,7 @@
269
269
  File outputFile = new File(type + "_" + sourceName);
270
270
  wc.calTFIDF();
271
271
  switch (type) {
272
- case "test1": // for Exercise 7-1
272
+
273
- wc = new WordCount(new File(inputDirPath, sourceName));
274
- System.out.println(wc.getSourceName());
275
- break;
276
- case "test2": // for Exercise 7-1
277
- wc = new WordCount(new File(inputDirPath, sourceName));
278
- wc.countFreq("test");
279
- wc.countFreq("test");
280
- int freq = wc.getFreq("test");
281
- System.out.println(freq);
282
- break;
283
- case "test3": // for Exercise 7-1
284
- wc = new WordCount(new File(inputDirPath, sourceName));
285
- wc.readFile();
286
- freq = wc.getFreq("the");
287
- System.out.println(freq);
288
- break;
289
- case "test4": // for Exercise 7-1
290
- wc = sourceWordCountMap.get(sourceName);
291
- freq = wc.getFreq("to");
292
- System.out.println(freq);
293
- break;
294
- case "test5": // for Exercise 7-2
295
- wc = new WordCount(new File(inputDirPath, sourceName));
296
- wc.readFile();
297
- System.out.println(wc.getWordSet().size());
298
- break;
299
- case "freq": // for Exercise 7-1
300
- wc.writeTopNFrequentWords(5, outputFile);
301
- break;
302
273
  case "tfidf": // for Exercise 7-2
303
274
  wc.writeTopNTfIdfWords(5, outputFile);
304
275
  break;

1

追加

2021/11/13 05:38

投稿

hanao_
hanao_

スコア6

title CHANGED
File without changes
body CHANGED
@@ -5,6 +5,7 @@
5
5
  何度もプログラムを見返してみたのですが、どこが悪いのかわかりません、、
6
6
  wordFreqMapは単語とその出現回数、sourceWordCountMapはソースファイルとWordCountのインスタンス、docFreqMapは単語とその単語が含まれるファイルの数保管するものです。
7
7
 
8
+ プログラミングが得意ではなくて、質問の仕方もわかりにくいとは思いますが、よろしくお願いいたします、、、
8
9
 
9
10
  ```java
10
11
  package p7;