Repository navigation
DisambiguationExtractor: do not crash for a language missing from the title-suffix map - #852
Conversation
… title-suffix map
DisambiguationExtractorConfig.disambiguationTitlePartMap only covers the
roughly two dozen languages whose disambiguation-page title suffix
(e.g. " (disambiguation)" for en) has been added to it. The extractor
looked the current language up via the maps unsafe apply(), which
throws NoSuchElementException for any language not in the map -- this
crashed construction of the extractor itself, not just one page, for
every language enabled for extraction (dump or live server) that is
missing from this map.
#616s own example ("ro") has since been added to the map and no longer
reproduces, but the same unsafe lookup remains for every other language
still missing from it -- sv, sl, hr, tr, lv, cy, be, az, hy, bn, ur, vi
and more, all of which appear in real extraction.default.properties-style
language lists and are not in this map today.
Changed to getOrElse with a logged warning and an empty-string fallback:
with nothing stripped, cleanPageTitle keeps the pages full decoded
title instead of crashing extractor construction for that language.
ExtractionManager.scala already handles the identical class of problem
(a language missing from a lookup map) with getOrElse plus a warning
log a few files over; this follows the same established pattern.
Fixes dbpedia#616.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk is established; the fallback retains the full decoded title when no suffix is configured. Pre-merge checks |
|
|



Fixes #616
DisambiguationExtractorConfig.disambiguationTitlePartMaponly covers the roughly two dozen languages whose disambiguation-page title suffix (e.g. " (disambiguation)" foren) has been added to it. The extractor looked the current language up via the map's unsafeapply(), which throwsNoSuchElementExceptionfor any language not in the map — this crashed construction of the extractor itself, not just one page, for every language enabled for extraction (dump or live server) that is missing from this map.#616's own example ("ro") has since been added to the map and no longer reproduces, but the same unsafe lookup remains for every other language still missing from it —
sv,sl,hr,tr,lv,cy,be,az,hy,bn,ur,viand more, all of which appear in realextraction.default.properties-style language lists and are not in this map today.Changed to
getOrElsewith a logged warning and an empty-string fallback: with nothing stripped,cleanPageTitlekeeps the page's full decoded title instead of crashing extractor construction for that language.ExtractionManager.scalaalready handles the identical class of problem (a language missing from a lookup map) withgetOrElseplus a warning log a few files over — this follows the same established pattern.Summary by CodeRabbit