fixed formatting for latex graphs on export

This commit is contained in:
Jonas Werner 2025-03-23 17:00:44 +01:00
parent 547479c3e4
commit 74c6666efa

View file

@ -53,16 +53,6 @@ public class TeXUtil {
tex.append(speech.toTeX());
Map<String, Double> topics = Topic.condenseTopicInformation(getHtmlSpeechByKey(speechId).getNlp().getTopics());
// loop through topics and Logger.pink them
for (Map.Entry<String, Double> entry : topics.entrySet()) {
Logger.pink(entry + " " + entry.getValue());
}
/*Map<String, Integer> pos = getPOSInformationCardinalitiesForSpeechById(speechId);
// loop through topics and Logger.pink them
for (Map.Entry<String, Integer> entry : pos.entrySet()) {
Logger.pink(entry + " " + entry.getValue());
}*/
return tex.toString().replace("$$SPEAKERINFO$$", speaker.toTeX())
.replace("$$NLPMETADATA$$",
@ -79,7 +69,20 @@ public class TeXUtil {
tex.append(speech.toTeX());
return tex.toString().replace("$$SPEAKERINFO$$", speaker.toTeX());
Map<String, Double> topics = null;
Logger.pink(String.valueOf(speech.getSpeechKey()));
try {
topics = Topic.condenseTopicInformation(getHtmlSpeechByKey(speech.getSpeechKey()).getNlp().getTopics());
} catch (Exception e) {
topics = Map.of();
}
return tex.toString().replace("$$SPEAKERINFO$$", speaker.toTeX()).replace("$$NLPMETADATA$$",
generateChartView(generateBubbleChartLatex(topics),
generateBarChartLatex(getPOSInformationCardinalitiesForSpeechById(speech.getSpeechKey())),
generateRadarChartLatex(getHtmlSpeechByKey(speech.getSpeechKey()).getNlp().getSentiments()), ""));
}
public static String getExportedSpeechBase64StringBySpeechId(String speechId) throws IOException, InterruptedException {
@ -310,8 +313,8 @@ public class TeXUtil {
StringBuilder xCords = new StringBuilder();
xCords.append("{");
for (Map.Entry<String, Integer> entry : barData.entrySet()) {
xCords.append(entry.getKey()).append(", ");
graphData.append("\t(").append(entry.getKey()).append(", ").append(entry.getValue()).append(")\n");
xCords.append(entry.getKey().replace(",", "\\,")).append(", ");
graphData.append("\t(").append(entry.getKey().replace(",", "\\,")).append(", ").append(entry.getValue()).append(")\n");
}
xCords.append("}");
String xCordsString = xCords.toString().replace("$", "\\$");