Skip to content

Commit

Permalink
Merge pull request #596 from privacy-tech-lab/595-create-new-release-…
Browse files Browse the repository at this point in the history
…v131

Updated the input clean up (issue #595)
  • Loading branch information
atlasharry authored Oct 25, 2024
2 parents 79bac7e + 3576061 commit b5107b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/background/analysis/interactDB/ml/jsrun.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export async function loadModel() {
* @returns {Promise<boolean>} boolean
*/
export async function useModel(input, test_model) {
// Replace multiple backslashes followed by a double quote with
// a single escaped backslash and double quote to normalize the input
const input_cleaned = input.replace(/\\+\"/g, '\\"');

if (test_model != undefined) {
model = test_model;
}
Expand All @@ -55,7 +59,7 @@ export async function useModel(input, test_model) {
if (!tokenizer) {
tokenizer = new BertTokenizer(true);
}
var tokens = await tokenizer.tokenize(input);
var tokens = await tokenizer.tokenize(input_cleaned);
const tLen = tokens.length;
var attArr = [];
if (tLen < 384) {
Expand Down

0 comments on commit b5107b9

Please sign in to comment.