Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. private static void insertWordsFromFile(Set<String> set, Path path) throws IOException {
  2. System.out.println(path);
  3. List<String> lines = Files.readAllLines(path);
  4. for (String line : lines) {
  5. String newString = "";
  6. line += "\n";
  7. for (int i=0; i<line.length(); ++i) {
  8.  
  9. if (Character.isLetter(line.charAt(i)) || line.charAt(i) == '-') {
  10. newString += line.charAt(i);
  11. } else {
  12. if (!newString.trim().equals("")) {
  13. newString = newString.toLowerCase();
  14. if (!stopwordsSet.contains(newString)) {
  15. set.add(newString);
  16. }
  17. }
  18. newString = "";
  19. }
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement