Skip to content

Instantly share code, notes, and snippets.

@dirkgr
Created May 30, 2018 20:10
Show Gist options
  • Save dirkgr/7031efb93463552cec26d4411e6076a2 to your computer and use it in GitHub Desktop.
Save dirkgr/7031efb93463552cec26d4411e6076a2 to your computer and use it in GitHub Desktop.
Parsing just references with science-parse
ExtractReferences referenceExtractor;
try(
final InputStream gazetteerIs = new FileInputStream(Parser.getDefaultGazetteer().toFile());
final DataInputStream bibModelIs = new DataInputStream(new FileInputStream(Parser.getDefaultBibModel().toFile()))
) {
referenceExtractor = new ExtractReferences(gazetteerIs, bibModelIs);
}
List<String> referenceLines = Arrays.asList("Reference 1", "Reference 2", "etc.");
Pair<List<BibRecord>, List<CitationRecord>> allResults =
Parser.getReferences(Collections.emptyList(), referenceLines, referenceExtractor);
List<BibRecord> parsedReferences = allResults.getOne()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment