Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void insertWordsFromFile(Set<String> set, Path path) throws IOException {
- System.out.println(path);
- List<String> lines = Files.readAllLines(path);
- for (String line : lines) {
- String newString = "";
- line += "\n";
- for (int i=0; i<line.length(); ++i) {
- if (Character.isLetter(line.charAt(i)) || line.charAt(i) == '-') {
- newString += line.charAt(i);
- } else {
- if (!newString.trim().equals("")) {
- newString = newString.toLowerCase();
- if (!stopwordsSet.contains(newString)) {
- set.add(newString);
- }
- }
- newString = "";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement