Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1.     public static void ParseThesaurus() {
  2.         try{
  3.             FileInputStream Stream = new FileInputStream("./MobyThesaurus2.txt");
  4.             Scanner Scan = new Scanner(Stream);
  5.            
  6.             while(Scan.hasNextLine()) {
  7.                 String line[] = Scan.nextLine().split(",");
  8.                
  9.                 String lastfound = null;
  10.                 for(String currentWord : line) {
  11.                     if(Google.contains(currentWord)) {
  12.                         lastfound = currentWord;
  13.                         break;
  14.                     }
  15.                 }
  16.                
  17.                 if(lastfound != null) {
  18.                     for(String word : line) {
  19.                         WordsMap.put(word, lastfound);
  20.                     }
  21.                 }
  22.  
  23.             }
  24.             Scan.close();
  25.         }catch(Exception E) {
  26.             System.out.println("Error parsing the file");
  27.         }
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement