From caec2257e1f55a080ff4d056c152c4747b519876 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 5 Nov 2021 18:33:37 +0100 Subject: [PATCH] Text.java index and createWordlist methode cleanup --- src/Text.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Text.java b/src/Text.java index 1811f7b..d801203 100644 --- a/src/Text.java +++ b/src/Text.java @@ -137,10 +137,11 @@ public class Text { wordbook = createWordlist(); String input; ArrayList output = new ArrayList<>(); + ArrayList values; for (Map.Entry> entry : wordbook.entrySet()) { input = ""; String key = entry.getKey(); - ArrayList values = entry.getValue(); + values = entry.getValue(); if (values.get(0) >= 3) { input += key + " "; for (int i = 1; i < values.size(); i++) { @@ -167,7 +168,7 @@ public class Text { String firstLetter; String restLetters; for (int i = 0; i < text.size(); i++) { - String[] words = text.get(i).trim().toLowerCase().split("[ :;.,!?><'/]+"); + String[] words = text.get(i).trim().toLowerCase().split("[ :;.,!?><'/\n]+"); for (String word : words) { counter = 1; firstLetter = word.substring(0, 1);