File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -34892,16 +34892,18 @@ var BratParser = function () {
34892
34892
}
34893
34893
}
34894
34894
34895
+ var n = graph.words.length;
34895
34896
this.textArray.forEach(function (t, i) {
34896
34897
if (t.entity === null) {
34897
34898
var text = _this.text.slice(t.charStart, t.charEnd).trim();
34898
34899
34899
34900
text.split(/\s+/).forEach(function (token) {
34900
- var word = new _word2.default(token, graph.words.length);
34901
+ var word = new _word2.default(token, graph.words.length - n + 1 );
34901
34902
graph.words.push(word);
34902
34903
});
34903
34904
} else {
34904
- t.entity.idx = graph.words.length;
34905
+ --n;
34906
+ t.entity.idx = graph.words.length - n;
34905
34907
}
34906
34908
});
34907
34909
graph.words.sort(function (a, b) {
Original file line number Diff line number Diff line change @@ -62,16 +62,18 @@ class BratParser {
62
62
}
63
63
}
64
64
65
+ let n = graph . words . length ;
65
66
this . textArray . forEach ( ( t , i ) => {
66
67
if ( t . entity === null ) {
67
68
let text = this . text . slice ( t . charStart , t . charEnd ) . trim ( ) ;
68
69
69
70
text . split ( / \s + / ) . forEach ( token => {
70
- let word = new Word ( token , graph . words . length ) ;
71
+ let word = new Word ( token , graph . words . length - n + 1 ) ;
71
72
graph . words . push ( word ) ;
72
73
} ) ;
73
74
} else {
74
- t . entity . idx = graph . words . length ;
75
+ -- n ;
76
+ t . entity . idx = graph . words . length - n ;
75
77
}
76
78
} ) ;
77
79
graph . words . sort ( ( a , b ) => a . idx - b . idx ) ;
You can’t perform that action at this time.
0 commit comments