Skip to main content

A package for German Open Informtion Extraction

Project description

turCy

An Open Information Extraction System mainly designed for German.

Installation

pip install turcy

Can be applied to other languages as well, however some extrawork is necessary as no patterns for english are shipped. Therefore, you would have to build your own patterns first. For building patterns, a `pattern_builder module is available.

How it works

img_3.png

1. Building a Pattern

img_2.png

img_1.png

2. Extraction

  1. Load the German Language Model from spaCy.
  2. Add turCy to the nlp-Pipeline.
  3. Pass the document to the pipeline.
  4. Iterate over the sentences in the document and access the triples in each sentence.
def example():
    nlp = spacy.load("de_core_news_lg", exclude=["ner"])
    nlp.max_length = 2096700
    turcy.add_to_pipe(nlp)  # apply/use current patterns in list
    pipeline_params = {"attach_triple2sentence": {"pattern_list": "small"}}
    doc = nlp("Nürnberg ist eine Stadt in Deutschland.", component_cfg=pipeline_params)
    for sent in doc.sents:
        print(sent)
        for triple in sent._.triples:
            (subj, pred, obj) = triple["triple"]
            print(f"subject:'{subj}', predicate:'{pred}' and object: '{obj}'")

3. Results

img_5.png

img_6.png

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

turcy-0.0.42.tar.gz (513.7 kB view hashes)

Uploaded Source

Built Distribution

turcy-0.0.42-py3-none-any.whl (1.2 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page