dkpro-jwktl icon indicating copy to clipboard operation
dkpro-jwktl copied to clipboard

Pictures in Wiktionary cause incorrect parsing

Open benldr opened this issue 3 years ago • 0 comments

Pictures on Wiktionary pages cause parsing errors

Pictures result in the page source having [[File: ...]] or [[Image: ... ]] at some location in the page source. The class WiktionaryEntryParser has code for removing the latter, but not the former. Depending on the position of this markup in the page source (it ought to be located immediately beneath the language header eg ==English== but sometimes is placed under a different header), this can cause issues. See examples below.

Unless the [[File: ...]] markup is used elsewhere by the parser (I haven't done a thorough check), I'd propose amending WiktionaryEntryParser to also delete this markup.

Example 1

The page for word Trump has [[File: ... located under the ===Pronunciation=== markup in the page source (see image below), and as a result the first IWiktionaryEntry when parsing this page, let's call it entry, returns null upon calling entry.getPronunciations(), instead of the actual pronunciations which are present.

trumpSource

Example 2

The page for word Obama has [[File: ... located under the ===Etymology 1=== markup in the page source, and as a result the first IWiktionaryEntry when parsing this page, let's call it entry, returns [[File:President Barack Obama.jpg|thumb|Barack Obama ''(sense 2)'']] upon calling `entry.getWordEtymology().getText()', instead of the actual etymology written on the page.

benldr avatar Mar 24 '21 11:03 benldr