파일에 자신의 주파수 단어의 목록을 반환하지만, 그것은 단지 화면에 .txt 파일 인쇄 :.txt 파일을 읽고 내가 지금까지이
이import java.io.*;
public class ReadFile {
public static void main(String[] args) throws IOException {
String Wordlist;
int Frequency;
File file = new File("file1.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line = null;
while((line = br.readLine()) != null) {
String [] tokens = line.split("\\s+");
System.out.println(line);
}
}
}
사람이되도록 도와 줄 수를 단어 목록과 단어 빈도를 인쇄합니까? 단어가 이미 각 단어
if(occurrences.containsKey(word))
occurrences.put(word, occurrences.get(word)+1);
else
occurrences.put(word, 1);
전체 버전 전에 읽을 수있는 경우
이 txt 파일의 형식은 무엇입니까? – Ren4n
그냥 제목과 file1.txt로 저장된 단락 – BronzeThunderBeard