added comments

pull/7/head
Daniel Fromm 2025-05-11 21:19:00 +02:00
parent bfc9a1e43c
commit 8aab5ca993
6 changed files with 25 additions and 28 deletions

View File

@ -11,7 +11,7 @@ public class FileLoader {
public FileLoader() { public FileLoader() {
this.inputFile = null; this.inputFile = null;
} }
//KI erstellte Methode //KI erstellte Methode mit anpassungen
public File loadFileGUI() { public File loadFileGUI() {
try { try {
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
@ -30,6 +30,7 @@ public class FileLoader {
} }
} }
//Methode sucht das Datei Format für spätere Verwendung
public String getFileFormat(File file) { public String getFileFormat(File file) {
String fileName = file.getName(); String fileName = file.getName();
String fileFormat = fileName.contains(".") ? fileName.substring(fileName.lastIndexOf(".") + 1) : ""; String fileFormat = fileName.contains(".") ? fileName.substring(fileName.lastIndexOf(".") + 1) : "";

View File

@ -23,18 +23,19 @@ public class TextProcessing {
private boolean stemming; private boolean stemming;
private int maxWords; private int maxWords;
public boolean isStemming() { // für spätere verwendung mit umfangreichen anpassungen
return stemming; // public boolean isStemming() {
} // return stemming;
// }
public int getMaxWords() { //
return maxWords; // public int getMaxWords() {
} // return maxWords;
// }
public void setStemming(boolean stemming) { //
this.stemming = stemming; // public void setStemming(boolean stemming) {
} // this.stemming = stemming;
// }
//
public void setMaxWords(int maxWords) { public void setMaxWords(int maxWords) {
this.maxWords = maxWords; this.maxWords = maxWords;
} }

View File

@ -5,7 +5,7 @@ import java.util.Map;
public class WordCloudCreator { public class WordCloudCreator {
//Ki erstellte Methode aus Zeitgründen und Krankheitsgründen //Ki erstellte Methode wegen Zeitgründen und Krankheitsgründen, dennoch anpassungen in großen Maße waren notwendig
public void insertWordsIntoTemplate(Map<String, Integer> wordMap) { public void insertWordsIntoTemplate(Map<String, Integer> wordMap) {
File templateFile = new File("wordcloud.html"); // Template in project directory File templateFile = new File("wordcloud.html"); // Template in project directory
File outputFile = new File("output.html"); // Output in project directory File outputFile = new File("output.html"); // Output in project directory

View File

@ -60,19 +60,17 @@ public class WordCloudManager {
System.out.println(stopwordList); System.out.println(stopwordList);
} }
// für spätere Verwendung mit umfangreichen Änderungen im Code
public void stemming(String approval) { // public void stemming(String approval) {
if(approval.equals("yes")) { // if(approval.equals("yes")) {
processing.setStemming(true); // processing.setStemming(true);
} // }
} // }
public void maxWordsInList(int number) { public void maxWordsInList(int number) {
processing.setMaxWords(number); processing.setMaxWords(number);
} }
// ab hier noch nicht fertig.
public void tokenizingText() { public void tokenizingText() {
wordMap = (HashMap<String, Integer>) processing.tokenizingFile(processing.fileToTextString(filePath, fileFormat) wordMap = (HashMap<String, Integer>) processing.tokenizingFile(processing.fileToTextString(filePath, fileFormat)
, !stopwordList.isEmpty() ? stopwordList : null); , !stopwordList.isEmpty() ? stopwordList : null);
@ -80,8 +78,6 @@ public class WordCloudManager {
} }
public void cutWordsList() { public void cutWordsList() {
wordMap = (HashMap<String, Integer>) processing.maxShowWords(processing.sortList(wordMap)); wordMap = (HashMap<String, Integer>) processing.maxShowWords(processing.sortList(wordMap));
processing.sortList(wordMap); processing.sortList(wordMap);
System.out.println(wordMap.keySet() + "\n" + wordMap.values()); System.out.println(wordMap.keySet() + "\n" + wordMap.values());

View File

@ -1,6 +1,7 @@
package tui; package tui;
public class Main { public class Main {
//startet die GUI
public static void main(String[]args){ public static void main(String[]args){
new TUI(); new TUI();
} }

View File

@ -21,8 +21,6 @@ public class TUI {
} }
public void tui() { public void tui() {
while(isRunning) { while(isRunning) {
System.out.println("Welcome to Word Cloud.\nType number in the following Menu to access your targeted Option.\nMenu:\n\n(0) Load File\n(1) URL Path" + System.out.println("Welcome to Word Cloud.\nType number in the following Menu to access your targeted Option.\nMenu:\n\n(0) Load File\n(1) URL Path" +
"\n(2) Exit"); "\n(2) Exit");
@ -80,8 +78,8 @@ public class TUI {
case(3): case(3):
// Set Stemming // Set Stemming
System.out.println("Set Stemming: Input 'yes' or 'no'"); System.out.println("Set Stemming: Input 'yes' or 'no'");
String stemmingOption = scan.nextLine(); // String stemmingOption = scan.nextLine();
wcm.stemming(stemmingOption); // wcm.stemming(stemmingOption);
break; break;
case(4): case(4):
//Create WordCloud //Create WordCloud