From daccc562cd2fde39d6dcf138197ac132042bc367 Mon Sep 17 00:00:00 2001 From: mjmaher987 Date: Sun, 25 Jul 2021 17:24:46 +0430 Subject: [PATCH] small change --- src/main/java/InvertedIndex.java | 4 ++-- src/main/java/Main.java | 2 +- src/main/java/TakeInput.java | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/InvertedIndex.java b/src/main/java/InvertedIndex.java index 472a7ca..28acfb6 100644 --- a/src/main/java/InvertedIndex.java +++ b/src/main/java/InvertedIndex.java @@ -16,7 +16,7 @@ import java.util.regex.Pattern; public class InvertedIndex { - List stopwords = Arrays.asList("a", "able", "about", + List stopWords = Arrays.asList("a", "able", "about", "across", "after", "all", "almost", "also", "am", "among", "an", "and", "any", "are", "as", "at", "be", "because", "been", "but", "by", "can", "cannot", "could", "dear", "did", "do", "does", @@ -47,7 +47,7 @@ public void indexFile(File file) throws IOException { .readLine()) { for (String _word : line.split("\\W+")) { String word = _word.toLowerCase(); - if (stopwords.contains(word)) + if (stopWords.contains(word)) continue; List idx = indexedWords.computeIfAbsent(word, k -> new LinkedList<>()); idx.add(new Tuple(fileNumber)); diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 370ac02..b6a5e84 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -8,7 +8,7 @@ public static void main(String[] args) { } public static void preprocesses() { - File directoryPath = new File("C:\\Users\\ASUS\\IdeaProjects\\codestar\\src\\main\\resources\\EnglishData"); + File directoryPath = new File("C:\\Users\\mjmah\\IdeaProjects\\codestar-intern-issues\\src\\main\\resources\\EnglishData"); File[] filesList = directoryPath.listFiles(); try { InvertedIndex idx = new InvertedIndex(); diff --git a/src/main/java/TakeInput.java b/src/main/java/TakeInput.java index 512392e..df1951c 100644 --- a/src/main/java/TakeInput.java +++ b/src/main/java/TakeInput.java @@ -14,13 +14,13 @@ public void getOrder(InvertedIndex idx) { Scanner scanner = new Scanner(System.in); while (true) { String input = scanner.nextLine(); - String[] inputSplited = input.split("(\\s+)"); + String[] inputSplit = input.split("(\\s+)"); if (input.equals("--back")) break; ArrayList plusStrings = new ArrayList<>(); ArrayList minusStrings = new ArrayList<>(); ArrayList normalStrings = new ArrayList<>(); - for (String string : inputSplited) + for (String string : inputSplit) addItemToOneOfThreeArrayLists(string, plusStrings, minusStrings, normalStrings); showResult(processes(idx, plusStrings, minusStrings, normalStrings)); } @@ -42,7 +42,6 @@ private Set processes(InvertedIndex idx, ArrayList plusStrings, commons.add(idx.search(arrayList)); } answer = idx.findCommonFiles(answer, commons); - System.out.println(answer); answer = idx.deleteGivenFiles(answer, toDelete); return answer; }