Skip to content
Snippets Groups Projects
Commit 0fcf7d0c authored by Ruben Bimberg's avatar Ruben Bimberg :computer:
Browse files

Updated weights.

parent 1dba89e8
No related merge requests found
.config {
span {
display: none;
}
span {
display: none;
}
mat-icon {
margin: 0;
}
mat-icon {
margin: 0;
}
}
.config:hover {
background-color:#052338;
span {
margin-left: 16px;
display: inline;
}
background-color: #052338;
span {
margin-left: 16px;
display: inline;
}
}
::ng-deep .spacyTagCloud > span {
......@@ -21,42 +22,52 @@
color: brown !important;
font-size: 380% !important;
}
&.w9 {
color: white !important;
font-size: 330% !important;
}
&.w8 {
color: tomato !important;
font-size: 280% !important;
}
&.w7 {
color: lightgreen !important;
font-size: 240% !important;
}
&.w6 {
color: gray !important;
font-size: 210% !important;
}
&.w5 {
color: pink !important;
font-size: 180% !important;
}
&.w4 {
color: orange !important;
font-size: 160% !important;
}
&.w3 {
color: yellow !important;
font-size: 140% !important;
}
&.w2 {
color: green !important;
font-size: 120% !important;
}
&.w1 {
color: lightblue !important;
font-size: 100% !important;
}
&:hover {
color: greenyellow !important;
}
......
......@@ -10,10 +10,8 @@ import {
import {CommentService} from '../../../services/http/comment.service';
import {Result, SpacyService} from '../../../services/http/spacy.service';
import {Comment} from '../../../models/comment';
import {LanguageService} from "../../../services/util/language.service";
import {TranslateService} from "@ngx-translate/core";
import {QuestionWallComment} from "../questionwall/QuestionWallComment";
import {LanguageService} from '../../../services/util/language.service';
import {TranslateService} from '@ngx-translate/core';
class TagComment implements CloudData {
constructor(public color: string,
......@@ -89,22 +87,15 @@ export class TagCloudComponent implements OnInit {
this.spacyService.analyse(commentsConcatenated, 'de').subscribe((res: Result) => {
const map = new Map<string, number>();
let maxCount = 0;
res.words.filter(w => ['NE', 'NN', 'NMP', 'NNE'].indexOf(w.tag) >= 0).forEach(elem => {
const count = (map.get(elem.text) || 0) + 1;
if (count > maxCount) {
maxCount = count;
}
map.set(elem.text, count);
});
this.data.length = 0; // Clear array
map.forEach((val, key) => {
const weight = 9 * val / maxCount + 1;
console.log(weight + ' ' + typeof weight);
this.data.push(new TagComment(null,
true, null, null,
/*Math.floor(Math.random() * 30 - 15)*/0, key,
'TODO', weight));
'TODO', val));
}
);
this.child.reDraw();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment