@@ -40855,6 +40855,7 @@ function () {
4085540855 * Returns the amount of descent below the baseline needed to fit
4085640856 * all this Row's bottom WordTags and Links.
4085740857 * Includes vertical Row padding.
40858+ * TODO: Have this account for whether or not bottom Links are visible.
4085840859 * @return {number}
4085940860 */
4086040861
@@ -42645,22 +42646,15 @@ function () {
4264542646 // event.detail.object.remove();
4264642647 // this.taxonomyManager.remove(event.detail.object);
4264742648 // });
42648-
42649- this.svg.on("row-recalculate-slots", function () {
42650- _this2.links.forEach(function (link) {
42651- link.slot = null;
42652- });
42653-
42654- _this2.links = Util.sortForSlotting(_this2.links);
42655-
42656- _this2.links.forEach(function (link) {
42657- return link.calculateSlot(_this2.words);
42658- });
42659-
42660- _this2.links.forEach(function (link) {
42661- return link.draw();
42662- });
42663- }); // ZW: Hardcoded dependencies on full UI
42649+ // this.svg.on("row-recalculate-slots", () => {
42650+ // this.links.forEach(link => {
42651+ // link.slot = null;
42652+ // });
42653+ // this.links = Util.sortForSlotting(this.links);
42654+ // this.links.forEach(link => link.calculateSlot(this.words));
42655+ // this.links.forEach(link => link.draw());
42656+ // });
42657+ // ZW: Hardcoded dependencies on full UI
4266442658 // this.svg.on("build-tree", (event) => {
4266542659 // document.body.classList.remove("tree-closed");
4266642660 // if (tree.isInModal) {
@@ -43836,7 +43830,11 @@ function () {
4383643830 // Old TextBoundMentions return their host Word/WordCluster
4383743831 // Old EventMentions/RelationMentions return their Link
4383843832
43839- this.parsedMentions = {};
43833+ this.parsedMentions = {}; // We record the index of the last Word from the previous sentence so
43834+ // that we can generate each Word's global index (if not Word indices
43835+ // will incorrectly restart from 0 for each new document/sentence)
43836+
43837+ this.lastWordIdx = -1;
4384043838 }
4384143839 /**
4384243840 * Parses the given data, filling out `this.data` accordingly.
@@ -43925,6 +43923,7 @@ function () {
4392543923 };
4392643924 this.parsedDocuments = {};
4392743925 this.parsedMentions = {};
43926+ this.lastWordIdx = -1;
4392843927 }
4392943928 /**
4393043929 * Parses a given document (essentially an array of sentences), appending
@@ -43965,15 +43964,20 @@ function () {
4396543964
4396643965 // Hold on to the Words we generate even as we push them up to the
4396743966 // main data store, so that we can create their syntax Links too
43967+ // (which rely on sentence-level indices, not global indices)
4396843968 var thisSentence = []; // The lengths of the `words` and `tags` arrays should be the same
4396943969
43970- for (var idx = 0; idx < sentence.words.length; idx++) {
43971- var thisWord = new _word.default(sentence.words[idx], idx);
43972- thisWord.setSyntaxTag(sentence.tags[idx]);
43970+ for (var thisIdx = 0; thisIdx < sentence.words.length; thisIdx++) {
43971+ var thisWord = new _word.default( // Text
43972+ sentence.words[thisIdx], // (Global) Word index
43973+ thisIdx + this.lastWordIdx + 1);
43974+ thisWord.setSyntaxTag(sentence.tags[thisIdx]);
4397343975 thisSentence.push(thisWord);
4397443976 this.data.words.push(thisWord);
43975- } // Sentences may have multiple dependency graphs available
43977+ } // Update the global Word index offset for the next sentence
43978+
4397643979
43980+ this.lastWordIdx += sentence.words.length; // Sentences may have multiple dependency graphs available
4397743981
4397843982 var graphTypes = Object.keys(sentence.graphs);
4397943983
0 commit comments