diff --git a/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts b/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts index 88a701eb332f55ece039c4d363628aae90623a92..12ddadb5c28685d76562b98182867fcaed028841 100644 --- a/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts +++ b/src/app/components/shared/_dialogs/create-comment/create-comment.component.ts @@ -78,8 +78,8 @@ export class CreateCommentComponent implements OnInit { } else { comment.language = CommentLanguage.auto; this.dialogRef.close(comment); + this.isSendingToSpacy = false; } - this.isSendingToSpacy = false; }, () => { comment.language = CommentLanguage.auto; this.dialogRef.close(comment); @@ -94,9 +94,8 @@ export class CreateCommentComponent implements OnInit { target = TargetLang.DE; } DeepLDialogComponent.generateDeeplDelta(this.deeplService, comment.body, target) - .subscribe(([improvedBody, improvedText]) => { - comment.body = improvedBody; - this.callSpacy(comment, improvedText, result, true); + .subscribe(([_, improvedText]) => { + this.callSpacy(comment, CreateCommentKeywords.escapeForSpacy(improvedText), result, true); }, () => { this.callSpacy(comment, text, result, true); }); @@ -112,6 +111,7 @@ export class CreateCommentComponent implements OnInit { } else if (CommentLanguage[selectedLangExtend]) { comment.language = CommentLanguage[selectedLangExtend]; } + this.isSendingToSpacy = false; const dialogRef = this.dialog.open(SpacyDialogComponent, { data: { comment, 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 e71cdbbe34fd31b5d71ce8305622c93fe7292618..7f8955384f86be47ec8db65168e78532b49e2c44 100644 --- a/src/app/components/shared/tag-cloud/tag-cloud.component.ts +++ b/src/app/components/shared/tag-cloud/tag-cloud.component.ts @@ -357,7 +357,7 @@ export class TagCloudComponent implements OnInit, OnDestroy, AfterContentInit { return; } this._subscriptionCommentlist = this.eventService.on('commentListCreated').subscribe(() => { - this.eventService.broadcast('setTagConfig', tag.text); + this.eventService.broadcast('setTagConfig', (tag as TagComment).realText); this._subscriptionCommentlist.unsubscribe(); }); this.router.navigate(['../'], { relativeTo: this.route }); diff --git a/src/app/utils/create-comment-keywords.ts b/src/app/utils/create-comment-keywords.ts index fb6e073b3a2fe856d6ab70a6f0c244995a7bd82f..e827d8c1c5b330c1b8495f0b9cc78a572cbe6378 100644 --- a/src/app/utils/create-comment-keywords.ts +++ b/src/app/utils/create-comment-keywords.ts @@ -19,7 +19,7 @@ export class CreateCommentKeywords { map(result => { const wordCount = text.trim().split(' ').length; const hasConfidence = language === 'auto' ? result.language.detectedLanguage.confidence >= 0.5 : true; - const hasLessMistakes = (result.matches.length * 100) / wordCount <= 20; + const hasLessMistakes = (result.matches.length * 100) / wordCount <= 50; return { isAcceptable: hasConfidence && hasLessMistakes, text: this.escapeForSpacy(text), @@ -29,7 +29,7 @@ export class CreateCommentKeywords { ); } - private static escapeForSpacy(text: string): string { + static escapeForSpacy(text: string): string { text = this.makeCapslockLowercase(text); return text.replace(/\(([^-\s)]+-)\)([^\s]+)/gmi, '$1$2'); }