Skip to content
Snippets Groups Projects
Commit 02ba4603 authored by Ruben Bimberg's avatar Ruben Bimberg :computer:
Browse files

Adjust to deepl

parent e0897182
No related merge requests found
......@@ -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,
......
......@@ -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 });
......
......@@ -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');
}
......
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