MCPcopy Create free account
hub / github.com/HzaCode/OneCite / process_references

Function process_references

onecite/core.py:186–225  ·  view source on GitHub ↗

Process references and return formatted citations with a report. This is the main public API entry point. It creates a :class:`PipelineController` and runs the full 4-stage pipeline. Args: input_content: The raw text or BibTeX content to process. input_type: Format of

(
    input_content: str,
    input_type: str,
    template_name: str,
    output_format: str,
    interactive_callback: Callable[[List[Dict]], int],
    use_google_scholar: bool = False,
)

Source from the content-addressed store, hash-verified

184
185
186def process_references(
187 input_content: str,
188 input_type: str,
189 template_name: str,
190 output_format: str,
191 interactive_callback: Callable[[List[Dict]], int],
192 use_google_scholar: bool = False,
193) -> Dict[str, Any]:
194 """Process references and return formatted citations with a report.
195
196 This is the main public API entry point. It creates a
197 :class:`PipelineController` and runs the full 4-stage pipeline.
198
199 Args:
200 input_content: The raw text or BibTeX content to process.
201 input_type: Format of *input_content* — ``"txt"`` or ``"bib"``.
202 template_name: Name of the YAML template (e.g.
203 ``"journal_article_full"``).
204 output_format: Output format. Only ``"bibtex"`` is supported;
205 any other value raises ``FormatError``.
206 interactive_callback: A callable that receives a list of
207 candidate dictionaries and returns the index of the selected
208 candidate.
209
210 Returns:
211 A dictionary with two keys:
212
213 * ``results`` — a list of formatted citation strings.
214 * ``report`` — a dict with ``total``, ``succeeded``, and
215 ``failed_entries``.
216
217 Raises:
218 ValidationError: If the input content is empty or invalid.
219 ParseError: If the input cannot be parsed.
220 ResolverError: If no data source can resolve a reference.
221 """
222 if not input_content or not input_content.strip():
223 raise ValidationError("input_content must not be empty.")
224 pipeline = PipelineController(use_google_scholar=use_google_scholar)
225 return pipeline.process(input_content, input_type, template_name, output_format, interactive_callback)

Callers 7

test_readme_exampleFunction · 0.90
test_pypi_versionFunction · 0.90
_runFunction · 0.90
process_commandFunction · 0.85

Calls 3

processMethod · 0.95
ValidationErrorClass · 0.85
PipelineControllerClass · 0.85

Tested by 6

test_readme_exampleFunction · 0.72
test_pypi_versionFunction · 0.72
_runFunction · 0.72