diff --git a/src/conflicts/UnknownName.ts b/src/conflicts/UnknownName.ts index 21f2afccb..c0193ddf6 100644 --- a/src/conflicts/UnknownName.ts +++ b/src/conflicts/UnknownName.ts @@ -68,12 +68,12 @@ export class UnknownName extends Conflict { context, ); - const userInput: string = this.name.name.text.text // user input - const maxNames: number = 1000; // the maximum number of names we want to check - names = names.slice(0, maxNames) // truncate the names array after the desired amount - + const userInput: string = this.name.name.text.text // unknown name input by user + const maxNames: number = 50; // the maximum number of names we want to check edit distance for (cap for performance) + names.splice(maxNames) // truncate the names array after the desired amount + for (let i = names.length-1; i >= 0; i--) { - const currName: string = names[i].definition.names.names[0].name.text.text // loop through every name + const currName: string = names[i].definition.names.names[0].name.text.text // get name in string form from Refer object if (this.levenshtein(userInput, currName) > 1) { // check if levenshtein distance is greater than 1 names.splice(i, 1) // filter out names that are dissimilar