From 0fcf7d0c2664d25cf99a9ef4909005d7c3e7ca34 Mon Sep 17 00:00:00 2001 From: Ruben Bimberg <ruben.bimberg@mni.thm.de> Date: Wed, 5 May 2021 11:01:07 +0200 Subject: [PATCH] Updated weights. --- .../shared/tag-cloud/tag-cloud.component.scss | 33 ++++++++++++------- .../shared/tag-cloud/tag-cloud.component.ts | 15 ++------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/app/components/shared/tag-cloud/tag-cloud.component.scss b/src/app/components/shared/tag-cloud/tag-cloud.component.scss index 3520bd22b..2b666d96a 100644 --- a/src/app/components/shared/tag-cloud/tag-cloud.component.scss +++ b/src/app/components/shared/tag-cloud/tag-cloud.component.scss @@ -1,19 +1,20 @@ .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; } diff --git a/src/app/components/shared/tag-cloud/tag-cloud.component.ts b/src/app/components/shared/tag-cloud/tag-cloud.component.ts index fb8e5e780..f1d59c290 100644 --- a/src/app/components/shared/tag-cloud/tag-cloud.component.ts +++ b/src/app/components/shared/tag-cloud/tag-cloud.component.ts @@ -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(); -- GitLab