File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/background/analysis/interactDB/ml Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ export async function loadModel() {
46
46
* @returns {Promise<boolean> } boolean
47
47
*/
48
48
export async function useModel ( input , test_model ) {
49
+ // Replace multiple backslashes followed by a double quote with
50
+ // a single escaped backslash and double quote to normalize the input
51
+ const input_cleaned = input . replace ( / \\ + \" / g, '\\"' ) ;
52
+
49
53
if ( test_model != undefined ) {
50
54
model = test_model ;
51
55
}
@@ -55,7 +59,7 @@ export async function useModel(input, test_model) {
55
59
if ( ! tokenizer ) {
56
60
tokenizer = new BertTokenizer ( true ) ;
57
61
}
58
- var tokens = await tokenizer . tokenize ( input ) ;
62
+ var tokens = await tokenizer . tokenize ( input_cleaned ) ;
59
63
const tLen = tokens . length ;
60
64
var attArr = [ ] ;
61
65
if ( tLen < 384 ) {
You can’t perform that action at this time.
0 commit comments