Text.java index and createWordlist methode cleanup

This commit is contained in:
Andrin Fassbind 2021-11-05 18:33:37 +01:00
parent edba4d5d8c
commit caec2257e1
1 changed files with 3 additions and 2 deletions

View File

@ -137,10 +137,11 @@ public class Text {
wordbook = createWordlist(); wordbook = createWordlist();
String input; String input;
ArrayList<String> output = new ArrayList<>(); ArrayList<String> output = new ArrayList<>();
ArrayList<Integer> values;
for (Map.Entry<String, ArrayList<Integer>> entry : wordbook.entrySet()) { for (Map.Entry<String, ArrayList<Integer>> entry : wordbook.entrySet()) {
input = ""; input = "";
String key = entry.getKey(); String key = entry.getKey();
ArrayList<Integer> values = entry.getValue(); values = entry.getValue();
if (values.get(0) >= 3) { if (values.get(0) >= 3) {
input += key + " "; input += key + " ";
for (int i = 1; i < values.size(); i++) { for (int i = 1; i < values.size(); i++) {
@ -167,7 +168,7 @@ public class Text {
String firstLetter; String firstLetter;
String restLetters; String restLetters;
for (int i = 0; i < text.size(); i++) { 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) { for (String word : words) {
counter = 1; counter = 1;
firstLetter = word.substring(0, 1); firstLetter = word.substring(0, 1);