This allows us to extract articles that we know the title of but not the QID of from other language's dumps in a another pass.
Signed-off-by: Evan Lloyd New-Schmidt <evan@new-schmidt.com>
Per-language section removal is configured with a static json file.
This includes a test to make sure the file exists and is formatted correctly.
Signed-off-by: Evan Lloyd New-Schmidt <evan@new-schmidt.com>
The largest time by far was wasted because I used `ok_or` instead of
`ok_or_else` for converting to the anyhow errors. I thought with a
static string and no arguments they weren't that expensive, but they
still took a lot of time, even with backtraces disabled.
Removing them reduces the benchmark time 60x:
running 4 tests
test hash_wikidata ... bench: 14 ns/iter (+/- 0)
test hash_wikipedia ... bench: 36 ns/iter (+/- 11)
test parse_wikidata ... bench: 18 ns/iter (+/- 0)
test parse_wikipedia ... bench: 835 ns/iter (+/- 68)
I also tried removing url::parse and using string operations. That got
it down another 10x, but I don't think that's worth potential bugs
right now.
A small optimization for reading the json: sys::stdin() is behind a
lock by default, and already has an internal buffer.
Signed-off-by: Evan Lloyd New-Schmidt <evan@new-schmidt.com>
Initial results:
running 4 tests
test hash_wikidata ... bench: 14 ns/iter (+/- 0)
test hash_wikipedia ... bench: 34 ns/iter (+/- 1)
test parse_wikidata ... bench: 18 ns/iter (+/- 0)
test parse_wikipedia ... bench: 60,682 ns/iter (+/- 83,376)
Based on these results and a flamegraph of loading the file, url parsing
is the most expensive part.
Signed-off-by: Evan Lloyd New-Schmidt <evan@new-schmidt.com>
The html processing should perform both of the main steps handled from the original
`descriptions_downloader.py` script:
- remove specific sections, e.g. "References"
- remove elements with no non-whitespace text
Determining how similar the output is will require more testing.
A separate binary target is included for standalone html processing.
Signed-off-by: Evan Lloyd New-Schmidt <evan@new-schmidt.com>