to_jsonl#

scikitplot.corpus.to_jsonl(documents)[source]#

Yield documents as newline-delimited JSON strings.

Parameters:
documentsSequence[CorpusDocument]

Source documents.

Yields:
str

One JSON object per line (no trailing newline).

Parameters:

documents (Sequence[Any])

Return type:

Iterator[str]

Notes

User note: Write to a file for streaming ingestion:

with open("corpus.jsonl", "w") as f:
    for line in to_jsonl(docs):
        f.write(line + "\\n")