Skip to main content

parse_bookcoref_json

Function parse_bookcoref_json 

Source
pub fn parse_bookcoref_json(content: &str) -> Result<Vec<CorefDocument>>
Expand description

Parse BookCoref JSON/JSONL format.

BookCoref (Martinelli et al. 2025) provides book-scale coreference data.

The format follows OntoNotes-style with character metadata:

{
  "doc_key": "pride_and_prejudice_1342",
  "gutenberg_key": "1342",
  "sentences": [["CHAPTER", "I."], ["It", "is", "a", "truth", ...], ...],
  "clusters": [[[79,80], [81,82], ...], [[2727,2728], ...], ...],
  "characters": [{"name": "Mr Bennet", "cluster": [[79,80], ...]}, ...]
}
  • sentences: nested arrays of tokens (word-tokenized)
  • clusters: list of clusters, each cluster is list of [start, end] token spans (inclusive)
  • characters: optional character metadata (not used for coreference eval)

ยงErrors

Returns error if JSON is malformed or has invalid structure.