Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. private void computeWordFrequencies() throws IOException{
  2. FileWriter fw = new FileWriter("alfaSorted.txt");
  3. String word = getWord();
  4. while(word!=null){
  5. if(alfaSort.containsKey(word)){
  6. alfaSort.put(word, alfaSort.get(word)+1);
  7. }else{
  8. alfaSort.put(word, 1);
  9. }
  10.  
  11. word = getWord();
  12. }
  13. for(String w : alfaSort.keySet()){
  14. fw.write(w+"\t"+alfaSort.get(w)+"\n");
  15. }
  16. fw.flush();
  17. fw.close();
  18. // define!
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement