citation-harvest discover
Build or extend a paper's harvest manifest.
Invocation#
lem-cli citation-harvest <id-or-title> discover [--limit <n>] [seed phrase ...]Inputs and options#
- --limit <n> caps how many new manifest rows this run adds, and asks OpenAlex (per-page) and Semantic Scholar (limit) for pages of n results; a size past a provider's maximum is refused by that provider and named in notes. Unstated, each API answers its own default page and every candidate is merged.
- Every bare word after discover is another seed phrasing. Discovery also reads the paper's bibliography and queries OpenAlex and Semantic Scholar at the endpoints Lem's bundled search-apis.json declares.
Output and state#
Merges discovered candidates into manifest.json and prints discovered, added, skipped, manifest, by_source, notes, file, and next. Existing rows are deduplicated by DOI (found inside a doi.org link or doi: prefix), normalised title, then key, and retained.
A new row's key is the first author's family name, the year when stated, and the title's first content word as the NaturalLanguage lexical-class tagger reads it (noun, verb, adjective, adverb or number), so titles opening with function words do not collide. Without an author or such a word, a BibTeX entry keeps its own key; else the whole title stands for the word. A candidate that yields no key at all is skipped with a note naming it, and a taken key gets the next free letter, then number.
A bibliography that cannot be read, a search that fails, and an answer that is not a result page are each a note naming the cause, never zero results.
Refusals#
- --limit without a positive integer refuses with “--limit needs a positive number”.
- Any other dash-prefixed argument refuses with “unknown discover option: <option>”.
- An existing manifest that cannot be read or decoded refuses with its path and cause before any provider query or manifest write. Only a missing manifest starts a new corpus; a failed read never becomes empty rows.
- Discovery and file errors are surfaced as a refusal with their exact error description.