Skip to content
Snippets Groups Projects
Commit e3aa7728 authored by Mohammad Alayoub's avatar Mohammad Alayoub
Browse files

removed all spacy commits

parent 7369db2e
No related merge requests found
......@@ -7,39 +7,29 @@
<mat-slide-toggle (change)="refreshAllLists()" [(ngModel)]="profanityFilter">
{{'topic-cloud-dialog.profanity' | translate}}
</mat-slide-toggle>
<!-- </div> -->
<mat-accordion hideToggle class="new-Badword" multi>
<mat-expansion-panel class="color-background"
(opened)="enterBadword = true; focusBadWordInput()"
(closed)="enterBadword = false">
<mat-expansion-panel-header class="color-background">
<mat-panel-description>
{{'topic-cloud-dialog.add-profanity-word' | translate}}
<mat-icon>{{!enterBadword ? 'add' : 'remove'}}</mat-icon>
</mat-panel-description>
</mat-expansion-panel-header>
<mat-accordion hideToggle class="new-Badword" multi>
<mat-expansion-panel class="color-background"
(opened)="enterBadword = true; focusBadWordInput()"
(closed)="enterBadword = false">
<mat-expansion-panel-header class="color-background">
<mat-panel-description>
{{'topic-cloud-dialog.add-profanity-word' | translate}}
<mat-icon>{{!enterBadword ? 'add' : 'remove'}}</mat-icon>
</mat-panel-description>
</mat-expansion-panel-header>
<mat-form-field>
<mat-label>{{'topic-cloud-dialog.enter-word' | translate}}</mat-label>
<input matInput id="bad-word-input" [(ngModel)]="newBadWord">
</mat-form-field>
<mat-form-field>
<mat-label>{{'topic-cloud-dialog.enter-word' | translate}}</mat-label>
<input matInput id="bad-word-input" [(ngModel)]="newBadWord">
</mat-form-field>
<button mat-button color="primary" (click)="addBadword()">
<mat-icon>add_circle</mat-icon>
{{'topic-cloud-dialog.send' | translate}}
</button>
</mat-expansion-panel>
</mat-accordion>
<mat-form-field>
<mat-label>Language</mat-label>
<mat-select [formControl]="model">
<mat-option value="en" >{{'topic-cloud-dialog.english' | translate}}</mat-option>
<mat-option value="de" >{{'topic-cloud-dialog.german' | translate}}</mat-option>
<mat-option value="fr" >{{'topic-cloud-dialog.french' | translate}}</mat-option>
</mat-select>
</mat-form-field>
<button mat-button color="primary" (click)="addBadword()">
<mat-icon>add_circle</mat-icon>
{{'topic-cloud-dialog.send' | translate}}
</button>
</mat-expansion-panel>
</mat-accordion>
</div>
</mat-card>
......@@ -128,9 +118,6 @@
(click)="openConfirmDialog(keyword)">
<mat-icon class="red">delete</mat-icon>
</button>
<button class="margin-right" id="send_to_spacy"
(click)="keywordtoSpacy(keyword.keyword,model.value.toString())">{{'topic-cloud-dialog.sendKey' | translate}}
</button>
</div>
<!-- Only visible when editing -->
......@@ -149,14 +136,4 @@
</div>
</mat-expansion-panel><br>
</mat-accordion>
<mat-accordion >
<section *ngIf="isenddKeyword">
<mat-card *ngFor="let line of this.output" class="color-surface">
<li *ngFor="let translate of line" class="color12" > {{this.translate.tag}} : " {{translate.text}} " <br> </li>
</mat-card >
</section>
</mat-accordion>
</mat-dialog-content>
......@@ -57,12 +57,6 @@ mat-icon {
transition: width 300ms linear;
}
#send_to_spacy{
color: khaki;
background-color: blueviolet;
opacity: 0.3;
}
label {
color: var(--on-surface)
}
......
......@@ -245,24 +245,7 @@ export class TopicCloudAdministrationComponent implements OnInit {
document.getElementById('bad-word-input').focus();
}, 100);
}
keywordtoSpacy(text: string,model: string) {
this.isenddKeyword=true;
for (const keyword of this.keywords) {
if (keyword.keyword===text) {
this.output = [];
for( let i=0;i <keyword.questions.length;i++){
this.spacyService.analyse(keyword.questions[i], model)
.subscribe(res => {
console.log(res.words);
this.output.push(res.words);
}, () => {
console.log('error');
});
}
}
}
}
addBadword() {
this.topicCloudAdminService.addToBadwordList(this.newBadWord);
this.newBadWord = undefined;
......
import { Injectable } from '@angular/core';
import * as BadWords from 'naughty-words';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { BaseHttpService } from '../http/base-http.service';
import { catchError } from 'rxjs/operators';
const httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
};
@Injectable({
providedIn: 'root'
})
export class TopicCloudAdminService {
export class TopicCloudAdminService extends BaseHttpService{
constructor(private http: HttpClient) {
super();
this.badWords = BadWords;
this.badWords['custom'] = [];
}
private badWords = [];
......@@ -13,13 +25,9 @@ export class TopicCloudAdminService {
return this.badWords['custom'];
}
constructor() {
this.badWords = BadWords;
this.badWords['custom'] = [];
}
filterProfanityWords(str: string): string {
let questionWithProfanity = str;
// TODO: another languages
/* put all arrays of languages together */
const profanityWords = this.badWords['en'].concat(this.badWords['de'])
.concat(this.badWords['fr']).concat(this.badWords['custom']);
......@@ -48,4 +56,4 @@ export class TopicCloudAdminService {
}
return res;
}
}
}
\ No newline at end of file
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