random files generated after merge conflict
This commit is contained in:
parent
2403ec8755
commit
98d1d80fda
5 changed files with 112 additions and 0 deletions
34
src/main/resources/templates/nlp.ftl
Normal file
34
src/main/resources/templates/nlp.ftl
Normal file
|
@ -0,0 +1,34 @@
|
|||
<#if s.nlp.topics??>
|
||||
<h3>Topics Information (als Bubble Chart)</h3>
|
||||
<#assign condenseTopicInformation = s.nlp.topics>
|
||||
<#include "topicsBubbleChart.ftl">
|
||||
<#else>
|
||||
<h3>Keine Topics Information für diese Rede verfügbar</h3>
|
||||
</#if>
|
||||
|
||||
<#if s.nlp.posList??>
|
||||
<h3>POS Information (als Bar Chart)</h3>
|
||||
<#assign posList = s.nlp.posList>
|
||||
<#include "posBarChart.ftl">
|
||||
<#else>
|
||||
<h3>Keine POS Information verfügbar für diese Rede verfügbar</h3>
|
||||
</#if>
|
||||
|
||||
|
||||
<#if s.nlp.sentiments??>
|
||||
<h3>SentimentsInformation (als Radar Chart)</h3>
|
||||
<#assign overallSentiment = s.nlp.overallSentiment>
|
||||
<#assign sentiments = s.nlp.sentiments>
|
||||
<#include "sentimentsRadarChart.ftl">
|
||||
<#else>
|
||||
<h3>Keine Sentiments Information für diese Rede verfügbar</h3>
|
||||
</#if>
|
||||
|
||||
|
||||
<#if s.nlp.namedEntities??>
|
||||
<h3>Named Entities Information (als Sunburst Chart)</h3>
|
||||
<#assign nea = s.nlp.namedEntities>
|
||||
<#include "namedEntitiesSunburstChart.ftl">
|
||||
<#else>
|
||||
<h3>Keine Named Entities Information für diese Rede verfügbar</h3>
|
||||
</#if>
|
78
src/main/resources/templates/posBarChart.ftl
Normal file
78
src/main/resources/templates/posBarChart.ftl
Normal file
|
@ -0,0 +1,78 @@
|
|||
<svg id="posBarchart"></svg>
|
||||
|
||||
<script>
|
||||
// Define variables only in JavaScript
|
||||
const barChartWidth = 1000;
|
||||
const barChartHeight = 750;
|
||||
const margin = { top: 20, right: 30, bottom: 50, left: 50 };
|
||||
|
||||
// Ensure posList exists before processing
|
||||
var posData = [];
|
||||
|
||||
<#if posList?? && posList?size gt 0>
|
||||
<#list posList as token>
|
||||
posData.push({ pos: "${token.text}", count: ${token.pos} });
|
||||
</#list>
|
||||
<#else>
|
||||
posData.push({ pos: "No Data", count: 0 });
|
||||
</#if>
|
||||
|
||||
console.log("Final POS Data being used:", posData);
|
||||
|
||||
var svg = d3.select("#posBarchart")
|
||||
.attr("width", barChartWidth)
|
||||
.attr("height", barChartHeight);
|
||||
|
||||
// Create Scales
|
||||
var xScale = d3.scaleBand()
|
||||
.domain(posData.map(d => d.pos))
|
||||
.range([margin.left, barChartWidth - margin.right])
|
||||
.padding(0.2);
|
||||
|
||||
var yScale = d3.scaleLinear()
|
||||
.domain([0, d3.max(posData, d => d.count)])
|
||||
.nice()
|
||||
.range([barChartHeight - margin.bottom, margin.top]);
|
||||
|
||||
var colorScale = d3.scaleOrdinal(d3.schemeCategory10);
|
||||
|
||||
// Create Bars
|
||||
var bars = svg.selectAll("rect")
|
||||
.data(posData)
|
||||
.enter().append("rect")
|
||||
.attr("x", d => xScale(d.pos))
|
||||
.attr("y", d => yScale(d.count))
|
||||
.attr("width", xScale.bandwidth())
|
||||
.attr("height", d => Math.max(0, barChartHeight - margin.bottom - yScale(d.count))) // Prevents negative heights
|
||||
.attr("fill", d => colorScale(d.pos));
|
||||
|
||||
console.log("Number of bars created:", bars.size());
|
||||
|
||||
// X Axis
|
||||
svg.append("g")
|
||||
.attr("transform", "translate(0," + (barChartHeight - margin.bottom) + ")")
|
||||
.call(d3.axisBottom(xScale))
|
||||
.selectAll("text")
|
||||
.attr("transform", "rotate(-45)")
|
||||
.style("text-anchor", "end")
|
||||
.style("font-size", "12px");
|
||||
|
||||
// Y Axis
|
||||
svg.append("g")
|
||||
.attr("transform", "translate(" + margin.left + ",0)")
|
||||
.call(d3.axisLeft(yScale));
|
||||
|
||||
// Labels
|
||||
svg.selectAll("text.label")
|
||||
.data(posData)
|
||||
.enter().append("text")
|
||||
.attr("class", "label")
|
||||
.attr("x", d => xScale(d.pos) + xScale.bandwidth() / 2)
|
||||
.attr("y", d => yScale(d.count) - 5)
|
||||
.attr("text-anchor", "middle")
|
||||
.attr("fill", "#000")
|
||||
.text(d => d.count);
|
||||
</script>
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
0
src/main/resources/templates/sentimentsRadarChart.ftl
Normal file
0
src/main/resources/templates/sentimentsRadarChart.ftl
Normal file
Loading…
Add table
Add a link
Reference in a new issue