spraakbanken / korp-frontend

Frontend for Korp, a tool using the IMS Open Corpus Workbench (CWB).
https://spraakbanken.gu.se/en/tools/korp
MIT License
16 stars 8 forks source link

Dependency tree sometimes not drawn: “Character index out of range” #234

Open janiemi opened 2 years ago

janiemi commented 2 years ago

When you perform the Korp query https://spraakbanken.gu.se/korplabb/#?corpus=sweachum&cqp=%5Bword%20%3D%20%22var%22%5D&page=0&search=word%7CV%C3%A4sterg%C3%B6tland%20och%20N%C3%A4rke and click on the KWIC sidebar link to display the dependency tree of the only hit, it is not drawn, and the modal only shows a couple of dots:

screenshot_Korp_9_SB_dependency_tree_not_shown_20220301

The JavaScript console shows the following warning message:

Rendering terminated due to: DOMException: SVGTextContentElement.getEndPositionOfChar: Character index out of range
visualizer.js:2679:28

(Here the file name and location were taken from a local test server running Språkbanken’s Korp code; the minified location was deptree.js:1:31447.)

This is not the only hit I encountered for which the dependency tree wasn’t drawn: the first four of the six hits for the following (contrived) search have the same issue:

https://spraakbanken.gu.se/korplabb/#?corpus=sweachum&cqp=%5Bword%20*%3D%20%22en%7Cst%C3%A5r%7Cfu%C3%BEarkrad%7Cingar%22%5D%20%5Bword%20%3D%20%22vardera%22%20%26%20_.text_subject%20%3D%20%22J%C3%A4mf%C3%B6rande%20spr%C3%A5kvetenskap%20och%20lingvistik%22%5D&search_tab=1&search=cqp

At a quick glance, I didn’t notice in the KWIC data anything that would immediately explain why that happens.

I stumbled upon this when testing the new dependency tree modal, but the same issue appears to be present in older versions as well.

majsan commented 2 years ago

I was hopeful until the last sentence that this was occurring because of the rewrite!

janiemi commented 2 years ago

I also first assumed the issue would be due to the rewrite, but I then also tested it in Språkbanken’s current production Korp. I’m sorry about giving a false first impression in the description.