Commit 9762606d authored by zehe's avatar zehe
Browse files

replace __class__ with typing.Self

parent 05ebf2ed
Pipeline #45016 passed with stage
in 14 seconds
......@@ -5,6 +5,7 @@
## Getting started
Install the library using `pip install git+` or by putting `git+` into your `requirements.txt` file.
You can also use the shorthand
Simple example script of using the library:
......@@ -34,3 +35,5 @@ doc.serialize(Path("/tmp/new_doc.xmi"))
You can find an overview of all existing Types and their attributes/features here:
The typesystem can be extended to add custom types, as for example with the modules in
\ No newline at end of file
......@@ -4,7 +4,7 @@ setup(
name='WueNLP', # How you named your package folder (MyLib)
packages=find_packages() + ["wuenlp/resources"], # Chose the same as "name"
package_data={"": ["WueNLPTypesystem.xml"]},
version='0.3.3', # Start with a small number and increase it with every change you make
version='0.3.4', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here:
description='NLP Pipeline and utilities from Uni Würzburg', # Give a short description about your library
author='Markus Krug, Albin Zehe', # Type in your name
......@@ -6,6 +6,7 @@ import sys
from abc import ABCMeta
from pathlib import Path
from typing import Optional, List, Type, T, Dict, Set
from typing_extensions import Self
from uima import FeatureStructure as PyCASFeatureStructure
from uima.CASExceptions import UnsupportedTypeException
......@@ -1310,14 +1311,14 @@ class UIMADocument(Document):
# === FACTORY ====
def from_text(cls, text: str) -> __class__:
def from_text(cls, text: str) -> Self:
# cas = CASFactory.from_text(text)
cas = PyCAS.empty(str(wuenlp.typesystem_path))
return cls(cas)
def from_xmi(cls, xmi_path: Path) -> __class__:
def from_xmi(cls, xmi_path: Path) -> Self:
Reads a document from an xmi file.
Can also read zip files named `*` if they contain a single xmi file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment