diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b5d6e8c3ef096ce3be276a94b5ff304517d8eb08..c57adc528442d9263306b825e6aae640111b505e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,7 +20,7 @@ eslint: dependencies: [] script: - npm install - - node_modules/eslint/bin/eslint.js -c .eslintrc.js --ext .ts ./src + - node_modules/eslint/bin/eslint.js -c .eslintrc.json --ext .ts ./src unit_tests: stage: test @@ -69,7 +69,7 @@ deploy_staging: tags: - ssh dependencies: - - tslint + - eslint - ngbuild script: - eval $(ssh-agent -s) diff --git a/src/app/components/shared/tag-cloud/tag-cloud.component.html b/src/app/components/shared/tag-cloud/tag-cloud.component.html index c6f80c282b4eaf220041f959760bfb415f74f2a9..c551cb6792c3fb75c0de4fab563d32bb92282b65 100644 --- a/src/app/components/shared/tag-cloud/tag-cloud.component.html +++ b/src/app/components/shared/tag-cloud/tag-cloud.component.html @@ -26,7 +26,6 @@ [height]="options.height" [overflow]="options.overflow" [zoomOnHover]="zoomOnHoverOptions" - (clicked)="tagClicked($event)" [log]='"debug"'> </angular-tag-cloud> 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 1311464618fb90d8daf439ecb78b86a50e993801..39ba95571c1dfbb61e0e3712cf8f0a948aeda54b 100644 --- a/src/app/components/shared/tag-cloud/tag-cloud.component.ts +++ b/src/app/components/shared/tag-cloud/tag-cloud.component.ts @@ -5,7 +5,6 @@ import {CommentService} from '../../../services/http/comment.service'; import {Result, SpacyService} from '../../../services/http/spacy.service'; import {Comment} from '../../../models/comment'; -const COLOR: string[] = ['blue', 'red', 'yellow', 'green']; class TagComment implements CloudData { constructor(public color: string, @@ -19,6 +18,19 @@ class TagComment implements CloudData { } } +const weight2color = { + 1: "blue", + 2: "green", + 3: "yellow", + 4: "orange", + 5: "pink", + 6: "gray", + 7: "lightgreen", + 8: "tomato", + 9: "white", + 10: "brown" +} + @Component({ selector: 'app-tag-cloud', templateUrl: './tag-cloud.component.html', @@ -34,11 +46,13 @@ export class TagCloudComponent implements OnInit { // if height is between 0 and 1 it will be set to the height of the upper element multiplied by the value height: 1, overflow: false, + font: "Georgia" // not working }; zoomOnHoverOptions: ZoomOnHoverOptions = { - scale: 1.3, // Elements will become 130 % of current zize on hover + scale: 1.3, // Elements will become 130 % of current size on hover transitionTime: 0.6, // it will take 0.6 seconds until the zoom level defined in scale property has been reached - delay: 0.4 // Zoom will take affect after 0.8 seconds + delay: 0.4,// Zoom will take affect after 0.4 seconds + color: "red" }; data: CloudData[] = []; @@ -55,24 +69,31 @@ export class TagCloudComponent implements OnInit { }); } - analyse(comments: Comment[]) { const commentsConcatenated = comments.map(c => c.body).join(' '); this.spacyService.analyse(commentsConcatenated, 'de').subscribe((res: Result) => { +<<<<<<< HEAD this.data = res.words.filter(w => ['NE', 'NN', 'NMP', 'NNE'].indexOf(w.tag) >= 0).map(w => new TagComment(COLOR[Math.floor( Math.random() * (COLOR.length - 1))], true, null, null, 0, w.text, 'todo', Math.floor(Math.random() * 10) + 1) ); +======= + this.data = res.words.filter(w => ['NE', 'NN', 'NMP', 'NNE'].indexOf(w.tag) >= 0).map(w => { + const weight = 5 + Math.floor(Math.random() * 4 + 1); + const color = weight2color[weight]; + return new TagComment(color, + true, null, null, + /*Math.floor(Math.random() * 30 - 15)*/0, w.text, + 'TODO', weight); + } + ) + }) +>>>>>>> 9d4cd8a8e9e4fbaf335be3f8fded5dd7118686d6 - } - ); - } - tagClicked(clicked: CloudData) { - console.log(clicked); } }