Skip to content

Commit

Permalink
small change
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmaher987 committed Jul 25, 2021
1 parent 789ad36 commit daccc56
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/InvertedIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.regex.Pattern;

public class InvertedIndex {
List<String> stopwords = Arrays.asList("a", "able", "about",
List<String> 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",
Expand Down Expand Up @@ -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<Tuple> idx = indexedWords.computeIfAbsent(word, k -> new LinkedList<>());
idx.add(new Tuple(fileNumber));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/TakeInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> plusStrings = new ArrayList<>();
ArrayList<String> minusStrings = new ArrayList<>();
ArrayList<String> normalStrings = new ArrayList<>();
for (String string : inputSplited)
for (String string : inputSplit)
addItemToOneOfThreeArrayLists(string, plusStrings, minusStrings, normalStrings);
showResult(processes(idx, plusStrings, minusStrings, normalStrings));
}
Expand All @@ -42,7 +42,6 @@ private Set<String> processes(InvertedIndex idx, ArrayList<String> plusStrings,
commons.add(idx.search(arrayList));
}
answer = idx.findCommonFiles(answer, commons);
System.out.println(answer);
answer = idx.deleteGivenFiles(answer, toDelete);
return answer;
}
Expand Down

0 comments on commit daccc56

Please sign in to comment.