OpenPecha / toolkit-v2

OpenPecha toolkit version 2
MIT License
0 stars 0 forks source link


OpenPecha

Toolkit V2

Description

Toolkit V2 is the second version of the existing toolkit.

A Python package designed for working with annotations within the PechaData framework. PechaData is a GitHub repository that houses data in a distinct format called STAM.

The Stand-off Text Annotation Model (STAM) is a data model for stand-off text annotation, where all information related to a text is represented as annotations.

Quickstart

To get started with the toolkit, we recommend following this documentation.

Project owner(s)

Diving Deeper

Pecha Annotation Transfer

The following code snippet demonstrates how to transfer annotations from one pecha to another pecha. If the annotations are done in two different base files, the annotations can be transferred from the source pecha to the target pecha.


from pathlib import Path
from openpecha.pecha import StamPecha

source_pecha_path = Path("source pecha path")
target_pecha_path = Path("target pecha path")

source_base_name = "source base name"
target_base_name = "target base name"

source_pecha = StamPecha(source_pecha_path)
target_pecha = StamPecha(target_pecha_path)

target_pecha.merge_pecha(source_pecha, source_base_name, target_base_name)

Important Note: In a pecha, there could be more than one base file. So above code snippet will transfer only the annotations which is related to the given base file name from source pecha to target pecha.