Skip to content

Commit

Permalink
Fixed diagnosis description
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-lperezra committed Dec 2, 2024
1 parent 76e7f4f commit e59027a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 36 deletions.
19 changes: 2 additions & 17 deletions encoder-ui/src/app/analysis/analysis.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class AnalysisComponent implements OnInit{
}
this.diagnostics.forEach((diagnostic, indexDiag) => {
var indexDiag = this.textAndDiagnosticList.findIndex(obj => obj.rawText == diagnostic.RawText);
const diagnosticEncoded: Diagnostic = {code: diagnostic.CodeId, description: diagnostic.RawText, similarity: diagnostic.Similarity}
const diagnosticEncoded: Diagnostic = {code: diagnostic.CodeId, description: diagnostic.Description, similarity: diagnostic.Similarity}
if (indexDiag == -1)
{
let textAndDiagnostic: TextAndDiagnostic = {rawText: diagnostic.RawText, diagnostics: []};
Expand All @@ -120,22 +120,7 @@ export class AnalysisComponent implements OnInit{
var phrase = "";
var indexInit = 0;

if (text.split(" ").length > 1){
const matchValue = new RegExp(text.split(" ")[0].replace(regex," ") + "(.{0,100})" +text.split(" ")[text.split(" ").length-1].replace(regex," "),"gi").exec(textHTML.toLowerCase().replace(regex," "));
if (matchValue) {
phrase = matchValue[0];
indexInit = matchValue.index;
}
}
else if (text.split(" ").length == 1){
const matchValue = new RegExp(text.replace(regex," "),"gi").exec(textHTML.toLowerCase().replace(regex," "));
if (matchValue) {
phrase = matchValue[0];
indexInit = matchValue.index;
}
}

textHTML = textHTML.replace(textHTML.substring(indexInit,indexInit+phrase.length), "<mark>"+textHTML.substring(indexInit,indexInit+phrase.length)+"</mark>");
textHTML = textHTML.replace(text, "<mark>"+text+"</mark>");
this.textUpdated = textHTML;
}

Expand Down
21 changes: 2 additions & 19 deletions encoder-ui/src/app/analyzer/analyzer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class AnalyzerComponent {
}
this.diagnostics.forEach((diagnostic, indexDiag) => {
var indexDiag = this.textAndDiagnosticList.findIndex(obj => obj.rawText == diagnostic.RawText);
const diagnosticEncoded: Diagnostic = {code: diagnostic.CodeId, description: diagnostic.RawText, similarity: diagnostic.Similarity}
const diagnosticEncoded: Diagnostic = {code: diagnostic.CodeId, description: diagnostic.Description, similarity: diagnostic.Similarity}
if (indexDiag == -1)
{
let textAndDiagnostic: TextAndDiagnostic = {rawText: diagnostic.RawText, diagnostics: []};
Expand Down Expand Up @@ -123,25 +123,8 @@ export class AnalyzerComponent {
var regex = /[.,;:¿?!¡\(\)-]/g;
this.unmarkDiagnosis();
var textHTML = this.textToAnalyze?.value;
var phrase = "";
var indexInit = 0;

if (text.split(" ").length > 1){
const matchValue = new RegExp(text.split(" ")[0].replace(regex," ") + "(.{0,100})" +text.split(" ")[text.split(" ").length-1].replace(regex," "),"gi").exec(textHTML.toLowerCase().replace(regex," "));
if (matchValue) {
phrase = matchValue[0];
indexInit = matchValue.index;
}
}
else if (text.split(" ").length == 1){
const matchValue = new RegExp(text.replace(regex," "),"gi").exec(textHTML.toLowerCase().replace(regex," "));
if (matchValue) {
phrase = matchValue[0];
indexInit = matchValue.index;
}
}

textHTML = textHTML.replace(textHTML.substring(indexInit,indexInit+phrase.length), "<mark>"+textHTML.substring(indexInit,indexInit+phrase.length)+"</mark>");
textHTML = textHTML.replace(text, "<mark>"+text+"</mark>");
this.textUpdated = textHTML;
}

Expand Down

0 comments on commit e59027a

Please sign in to comment.