Commit cd57a931 authored by Gert Paimla's avatar Gert Paimla

change urls, fixes

parent 72a38388
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {HateSpeechDetectionComponent} from './hate-speech-detection/hate-speech-detection.component';
import {EntityExtractionComponent} from './entity-extraction/entity-extraction.component';
import {CommentAnalyzerComponent} from './comment-analyzer/comment-analyzer.component';
import {ArticleAnalyzerComponent} from './article-analyzer/article-analyzer.component';
import {ArticleGenerationComponent} from './article-generation/article-generation.component';
import {DashboardComponent} from './dashboard/dashboard.component';
const routes: Routes = [
{
path: 'hate-speech-detection',
path: 'comment-analyzer',
pathMatch: 'full',
component: HateSpeechDetectionComponent
component: CommentAnalyzerComponent
},
{
path: 'entity-extraction',
path: 'article-analyzer',
pathMatch: 'full',
component: EntityExtractionComponent
component: ArticleAnalyzerComponent
},
{
path: 'article-generation',
......
......@@ -2,8 +2,8 @@
<nz-header class="flex-row">
<h3>Embeddia demo</h3>
<ul nz-menu nzMode="horizontal" nzTheme="dark">
<li nz-menu-item nzMatchRouter><a [routerLink]="['hate-speech-detection']">Comment Analyzer</a></li>
<li nz-menu-item nzMatchRouter><a [routerLink]="['entity-extraction']">Article Analyzer</a></li>
<li nz-menu-item nzMatchRouter><a [routerLink]="['comment-analyzer']">Comment Analyzer</a></li>
<li nz-menu-item nzMatchRouter><a [routerLink]="['article-analyzer']">Article Analyzer</a></li>
<li nz-menu-item nzMatchRouter><a [routerLink]="['article-generation']">Article Generator</a></li>
<li nz-menu-item nzMatchRouter><a [routerLink]="['dashboard']">Dashboard</a></li>
</ul>
......
......@@ -19,8 +19,8 @@ import {NzSpinModule} from 'ng-zorro-antd/spin';
import {NzTagModule} from 'ng-zorro-antd/tag';
import {NzToolTipModule} from 'ng-zorro-antd/tooltip';
import {NzTypographyModule} from 'ng-zorro-antd/typography';
import {HateSpeechDetectionComponent} from './hate-speech-detection/hate-speech-detection.component';
import {EntityExtractionComponent} from './entity-extraction/entity-extraction.component';
import {CommentAnalyzerComponent} from './comment-analyzer/comment-analyzer.component';
import {ArticleAnalyzerComponent} from './article-analyzer/article-analyzer.component';
import {ArticleGenerationComponent} from './article-generation/article-generation.component';
import {DashboardComponent} from './dashboard/dashboard.component';
import {NzSpaceModule} from 'ng-zorro-antd/space';
......@@ -33,8 +33,8 @@ registerLocaleData(en);
@NgModule({
declarations: [
AppComponent,
HateSpeechDetectionComponent,
EntityExtractionComponent,
CommentAnalyzerComponent,
ArticleAnalyzerComponent,
ArticleGenerationComponent,
DashboardComponent
],
......
......@@ -22,22 +22,25 @@
<nz-spin *ngIf="isLoading" [nzSize]="'large'" [nzSpinning]="isLoading" nzSimple></nz-spin>
<ng-container *ngIf="resultSource?.length > 0 && !this.isLoading">
<div class="legend">
<nz-tag *ngFor="let color of COLORKEYS" [nzColor]="COLORS[color]">{{color}}
</nz-tag>
<span>Language: {{language}}</span>
<div>
<nz-tag *ngFor="let color of COLORKEYS" [nzColor]="COLORS[color]">{{color}}
</nz-tag>
</div>
</div>
<div class="container">
<div *ngFor="let key of resultSource" class="flex-col align-center">
<h1>{{key}}</h1>
<div class="tag-wrapper flex-row">
<ng-container *ngFor="let item of results[key]">
<nz-tag *ngIf="item.tag" nz-tooltip nzColor="{{COLORS['KEYWORD']}}"
nzTooltipTitle="KEYWORD">{{item.tag}}
</nz-tag>
<nz-tag *ngIf="item.type && item.entity" [nzColor]="COLORS[item.type]" [nzTooltipTitle]="item.type"
nz-tooltip>{{item.entity}}
</nz-tag>
</ng-container>
</div>
<h1>{{key}}</h1>
<div class="tag-wrapper flex-row">
<ng-container *ngFor="let item of results[key]">
<nz-tag *ngIf="item.tag" nz-tooltip nzColor="{{COLORS['KEYWORD']}}"
nzTooltipTitle="KEYWORD">{{item.tag}}
</nz-tag>
<nz-tag *ngIf="item.type && item.entity" [nzColor]="COLORS[item.type]" [nzTooltipTitle]="item.type"
nz-tooltip>{{item.entity}}
</nz-tag>
</ng-container>
</div>
</div>
</div>
</ng-container>
......
......@@ -9,24 +9,16 @@
}
.legend {
padding: 0 10%;
padding: 0 5%;
display: flex;
justify-content: flex-end;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
nz-tag {
margin: 5px;
}
}
nz-spin {
padding: 10%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.container > div {
margin-top: 5%;
}
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EntityExtractionComponent } from './entity-extraction.component';
import { ArticleAnalyzerComponent } from './article-analyzer.component';
describe('EntityExtractionComponent', () => {
let component: EntityExtractionComponent;
let fixture: ComponentFixture<EntityExtractionComponent>;
describe('ArticleAnalyzerComponent', () => {
let component: ArticleAnalyzerComponent;
let fixture: ComponentFixture<ArticleAnalyzerComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EntityExtractionComponent ]
declarations: [ ArticleAnalyzerComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EntityExtractionComponent);
fixture = TestBed.createComponent(ArticleAnalyzerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
......
......@@ -6,17 +6,17 @@ import {UtilityFunctions} from '../shared/UtilityFunctions';
@Component({
selector: 'app-entity-extraction',
templateUrl: './entity-extraction.component.html',
styleUrls: ['./entity-extraction.component.less']
templateUrl: './article-analyzer.component.html',
styleUrls: ['./article-analyzer.component.less']
})
export class EntityExtractionComponent implements OnInit {
export class ArticleAnalyzerComponent implements OnInit {
readonly COLORS = UtilityFunctions.COLORS;
readonly COLORKEYS = Object.keys(this.COLORS);
text: string;
results: { [x: string]: any[] } = {};
resultSource: string[];
isLoading = false;
language: string;
constructor(private analyzersService: AnalyzersService,
private logService: LogService) {
......@@ -41,6 +41,7 @@ export class EntityExtractionComponent implements OnInit {
if (x.tags) {
this.populateResultData(UtilityFunctions.getDistinctByProperty(x.tags, (y) => y.tag));
}
this.language = x.language;
console.log(this.results);
} else if (x instanceof HttpErrorResponse) {
this.logService.messageHttpError(x);
......
......@@ -54,6 +54,7 @@
</form>
</div>
<div class="content">
<nz-spin *ngIf="isLoading" [nzSize]="'large'" [nzSpinning]="isLoading" nzSimple></nz-spin>
<div class="container" *ngIf="this.results">
<h1 class="mw">{{this.results.header}}</h1>
<div [innerHTML]="this.results.body">
......
......@@ -19,8 +19,8 @@
</div>
<div class="content">
<nz-spin *ngIf="isLoading" [nzSize]="'large'" [nzSpinning]="isLoading" nzSimple></nz-spin>
<div class="container" >
<nz-spin *ngIf="isLoading" [nzSize]="'large'" [nzSpinning]="isLoading" nzSimple></nz-spin>
<nz-space nzDirection="vertical" nzSize="large">
<nz-space-item *ngFor="let item of analyzers" class="flex-row status-block">
<h1>{{item}}</h1>
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HateSpeechDetectionComponent } from './hate-speech-detection.component';
import { CommentAnalyzerComponent } from './comment-analyzer.component';
describe('HateSpeechDetectionComponent', () => {
let component: HateSpeechDetectionComponent;
let fixture: ComponentFixture<HateSpeechDetectionComponent>;
describe('CommentAnalyzerComponent', () => {
let component: CommentAnalyzerComponent;
let fixture: ComponentFixture<CommentAnalyzerComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HateSpeechDetectionComponent ]
declarations: [ CommentAnalyzerComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HateSpeechDetectionComponent);
fixture = TestBed.createComponent(CommentAnalyzerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
......
......@@ -5,10 +5,10 @@ import {HttpErrorResponse} from '@angular/common/http';
@Component({
selector: 'app-hate-speech-detection',
templateUrl: './hate-speech-detection.component.html',
styleUrls: ['./hate-speech-detection.component.less']
templateUrl: './comment-analyzer.component.html',
styleUrls: ['./comment-analyzer.component.less']
})
export class HateSpeechDetectionComponent implements OnInit {
export class CommentAnalyzerComponent implements OnInit {
text: string;
analyzers: string[] = [];
results: any = {};
......
......@@ -19,6 +19,15 @@
display: flex;
flex-direction: row;
nz-spin {
padding: 10%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.sidebar {
padding: 20px;
display: flex;
......
Markdown is supported
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