Catma#
- class Catma(gitlab_access_token)#
Bases:
object
Class which represents all projects of a single CATMA user.
- Parameters
gitlab_access_token (str) – A valid access token for CATMA’s GitLab backend. Use the CATMA UI (https://app.catma.de) or the GitLab backend (https://git.catma.de/users/sign_in) to get your personal access token.
- gitlab_access_token#
The access token of the CATMA account.
- project_name_list: List[str]#
List of all projects that the CATMA account has access to.
- project_uuid_dict: Dict[str, str]#
A dictionary with project names (excluding UUID) as keys and full project names (including UUID) as values.
- project_dict: dict#
A dictionary with project names (excluding UUID) as keys and instances of the CatmaProject class as values. The dict is empty as long as no projects have been loaded.
- load_project_from_gitlab(project_name, backup_directory='./')#
Loads a CATMA project from the GitLab backend.
- Parameters
project_name (str) – The CATMA project name (or a part thereof - a search is performed in the GitLab backend using this value).
backup_directory (str, optional) – Where to clone the CATMA project. Defaults to ‘./’.
- load_all_projects_from_gitlab()#
Loads all projects that your CATMA account has access to after creating a local Git clone of these projects.
- load_local_project(projects_directory, project_name, included_acs=None, excluded_acs=None)#
Loads a local CATMA project.
- Parameters
projects_directory (str) – The directory where the CATMA project is located.
project_name (str) – The CATMA project name.
included_acs (list, optional) – The names of annotation collections to load. If set to None and excluded_acs is also None, all annotation collections are loaded. Defaults to None.
excluded_acs (list, optional) – The names of annotation collections not to load. Defaults to None.
- git_clone_command(project_name)#
Returns the Git clone command for the given CATMA project.
- Parameters
project_name (str) – The CATMA project’s name.
- Returns
Git CLI clone command.
- Return type
str
Examples#
For details see the demo notebook.
Load your account informations#
>>> from gitma import Catma
>>> my_catma = Catma(gitlab_access_token='<your_access_token>')
>>> my_catma.project_name_list
['<project1>', '<project2>', '<project3>']
Load a project from the CATMA gitlab#
>>> my_catma.load_project_from_gitlab(
... project_name='<insert your project name here>',
... backup_directory='../user_projects/'
... )
Loading Tagsets ...
Found 2 Tagset(s).
Loading Documents ...
Found 2 Document(s).
Loading Annotation Collections ...
Annotation Collection BETTELWEIB-EVENT_TYPE-DEMO_USER for BETTELWEIB_VON_LOCARNO
Annotations: 72/72
Annotation Collection BETTELWEIB-EVENT_TYPE-GOLD for BETTELWEIB_VON_LOCARNO
Annotations: 48/48
Annotation Collection INTRINSIC MARKUP for MICHAEL_KOHLHAAS
Annotations: 216/216
Annotation Collection INTRINSIC MARKUP for BETTELWEIB_VON_LOCARNO
Annotations: 67/67
Access your project data#
>>> my_catma.project_dict['project1'].plot_annotation_progression()