architxt.forest#

Functions

async_update_forest(forest, trees, *[, commit])

Update a forest with new trees asynchronously.

export_forest_to_jsonl(path, forest)

Export a forest of Tree objects to a JSONL file.

export_forest_to_jsonl_async(path, forest)

Export a forest of Tree objects to a JSONL file.

import_forest_from_jsonl(path)

Import a forest of Tree objects from a JSONL file.

update_forest(forest, trees, *[, commit])

Update a forest with new trees.

async architxt.forest.async_update_forest(forest, trees, *, commit=False)[source]#

Update a forest with new trees asynchronously.

Parameters:
  • forest (Forest) – The forest to update.

  • trees (AsyncIterable[Tree]) – Iterable of Tree objects to add to the forest.

  • commit (bool) – Whether to commit the changes immediately (only relevant for database-backed forests).

Return type:

None

architxt.forest.export_forest_to_jsonl(path, forest)[source]#

Export a forest of Tree objects to a JSONL file.

Parameters:
  • path (Path) – Path to the output JSONL file.

  • forest (Iterable[Tree]) – Iterable of Tree objects to export.

Return type:

None

async architxt.forest.export_forest_to_jsonl_async(path, forest)[source]#

Export a forest of Tree objects to a JSONL file.

Parameters:
  • path (Path) – Path to the output JSONL file.

  • forest (Iterable[Tree]) – Iterable of Tree objects to export.

Return type:

None

architxt.forest.import_forest_from_jsonl(path)[source]#

Import a forest of Tree objects from a JSONL file.

Parameters:

path (Path) – Path to the input JSONL file.

Yield:

Tree objects.

Return type:

Generator[Tree, None, None]

architxt.forest.update_forest(forest, trees, *, commit=False)[source]#

Update a forest with new trees.

Parameters:
  • forest (Forest) – The forest to update.

  • trees (Iterable[Tree]) – Iterable of Tree objects to add to the forest.

  • commit (bool) – Whether to commit the changes immediately (only relevant for database-backed forests).

Return type:

None