Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pictures in Wiktionary cause incorrect parsing #78

Open
benldr opened this issue Mar 24, 2021 · 0 comments
Open

Pictures in Wiktionary cause incorrect parsing #78

benldr opened this issue Mar 24, 2021 · 0 comments

Comments

@benldr
Copy link

benldr commented Mar 24, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant