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

replace __class__ with typing.Self

update README.md
parent 05ebf2ed
Pipeline #45016 passed with stage
in 14 seconds
......@@ -5,6 +5,7 @@
## Getting started
Install the library using `pip install git+https://gitlab2.informatik.uni-wuerzburg.de/kallimachos/wuenlp.git` or by putting `git+https://gitlab2.informatik.uni-wuerzburg.de/kallimachos/wuenlp.git` into your `requirements.txt` file.
You can also use the shorthand https://wuenlp.professor-x.de
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: https://wuenlp-docs.professor-x.de/wuenlp/impl/UIMANLPStructs.html
The typesystem can be extended to add custom types, as for example with the modules in https://gitlab2.informatik.uni-wuerzburg.de/kallimachos/wuenlp-extensions.git.
\ 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: https://help.github.com/articles/licensing-a-repository
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 ====
@classmethod
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))
cas.set_document_text(text)
return cls(cas)
@classmethod
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 `*.xmi.zip` 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