Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Overview

Standardization is performed before content-based element deduplication. Reference entries are consolidated at publication scope, citation keys are rewritten in the corresponding version trees, and element content is normalized before shared identifiers are assigned. The implementation is in cleanup.py, bibitem.py, dedup.py, tables.py, and pipeline.py.

LaTeX Cleaning

remove_non_semantic_commands() removes supported presentation-only commands, spacing instructions, float-placement hints, and font switches. Text-style wrappers such as \textbf{...} and \emph{...} are unwrapped while preserving their contents. Whitespace is normalized. Figure environments and semantic commands such as citations are retained.

The pipeline prunes leaves that become empty after cleanup and removes empty containers. Paragraph and list-container content is then populated from their children, so distinct containers are not merged merely because their initial parser content was an empty string.

Math Normalization

normalize_inline_math() converts supported inline forms, including \(...\) and the math environment, to dollar delimiters. normalize_block_math() converts supported display delimiters to equation* and handles supported alignment environments using aligned or gathered inside an equation environment.

For example, \(x+1\) becomes $x+1$, and $$y=2$$ becomes \begin{equation*}y=2\end{equation*}. These are illustrations of the implemented transformations, not observations about their frequency in the corpus.

Numbered multiline align or gather blocks containing row breaks or numbering-related commands can be retained in their original form to preserve numbering and labels. The current implementation consequently normalizes supported forms conservatively rather than forcing every possible mathematical construct into one representation.

BibTeX Processing

collect_version_bibtex() combines entries extracted from \bibitem blocks with entries read from the referenced .bib files. The extractor identifies citation keys and fields such as title, authors, year, DOI, journal, and URL. Missing metadata remains missing instead of being obtained from an external service.

When citation keys are present, .bib entries are filtered using those keys; \nocite{*} includes the referenced library. The implementation also supports limited recovery of a local bibliography when a citation key matches a local .bib file but the bibliography command is absent.

The \bibitem conversion and custom BibTeX reader use structural rules and regular expressions. Unusual bibliography styles, incomplete entries, and custom citation macros can require inspection. These source-derived references are distinct from the Semantic Scholar records crawled in M1.

Deduplication

Reference entries and citation keys

dedup_bibtex_across_versions() collects references from all available versions of one publication. Candidate matches are indexed by normalized DOI, title, and supported sparse-key cases. Matching uses DOI when available on both entries, otherwise title and compatible author/year evidence. A key by itself is not sufficient evidence of identity, and conflicting DOI clusters are kept separate.

For a duplicate group, the most frequent citation key is selected, with first occurrence breaking ties. Nonempty fields are combined and authors are deduplicated. Conflicting scalar values prefer richer records, then later versions. Canonical-key collisions between distinct references receive suffixes. Version-qualified key mappings allow rewrite_citations() to update the corresponding tree while preserving supported citation options.

Element content and version-specific edges

assign_element_ids() compares (kind, cleaned content) within one publication. Matching nodes can share an identifier across versions and within a version. The hierarchy table stores the parent relations separately for each version, so the same sentence can be attached to different headings in different versions.

Each version receives a separate document-root identifier. An identifier is also kept separate when reusing an ancestor’s identifier would create a cycle. These exceptions mean that the implementation is not an unconditional one-row-per-content guarantee for every node. Repeated identical edges are removed; the edge table does not encode occurrence counts or reading-order positions.

Output tables and validation

TableColumns
elementselement_id, arxiv_id, kind, content
hierarchyarxiv_id, version, element_id, parent_id
bibtexarxiv_id, citation_key, entry_type, title, authors, year, doi, journal, url

The row types are defined in src/common/schemas.py. authors is a list of strings and year is a nullable integer. Element identifiers use a publication prefix and a publication-local discriminant.

validate_m2_tables() checks supported row types, unique element identifiers, unique bibliography keys within a publication, and references to existing nodes in the same publication. It also rejects self-edges. These checks establish selected structural constraints; they do not establish the accuracy of extracted text, the completeness of reference extraction, or the correctness of every deduplication decision.