Skip to main content

(id, svo, extractor)

id-svo-extractor

id-svo-extractor is a heuristic tool designed to extract SVO (Subject-Verb-Object) triples from Indonesian text. It uses Stanza's state-of-the-art Indonesian language pipeline for NLP.

Requirements

To use id-svo-extractor, you will need Python v3.10 or higher and the following Python package:

You must also download Stanza's Indonesian models for tokenize, mwt, pos, lemma, and depparse processors before initializing the pipeline.

Installation

Install the package directly from PyPI:

pip install id-svo-extractor

Usage

Here's a basic example to get you started.

from id_svo_extractor import create_pipeline
from id_svo_extractor.utils import collect_svo_triples
from stanza import download


# Download Stanza's Indonesian models for tokenize, mwt, pos, lemma, and depparse processors.
# This step is mandatory before initializing the NLP pipeline.
download("id", processors="tokenize,mwt,pos,lemma,depparse")

# Initialize the NLP pipeline.
nlp = create_pipeline()

doc = nlp("Niko dan Okin mendesain brosur promosi dan mencetak poster iklan.")

for sentence in doc.sents:
    # Extracted triples for each sentence are stored in `svo_triples` custom attribute.
    print(sentence._.svo_triples)
    # Output:
    # [ SVOTriple(s=[Niko], v=[mendesain], o=[brosur, promosi]),
    #   SVOTriple(s=[Okin], v=[mendesain], o=[brosur, promosi]),
    #   SVOTriple(s=[Niko], v=[mencetak], o=[poster, iklan]),
    #   SVOTriple(s=[Okin], v=[mencetak], o=[poster, iklan]) ]

print(collect_svo_triples(doc))
# Output:
# [ ('Niko', 'mendesain', 'brosur promosi'),
#   ('Okin', 'mendesain', 'brosur promosi'),
#   ('Niko', 'mencetak', 'poster iklan'),
#   ('Okin', 'mencetak', 'poster iklan') ]

License

This project is licensed under the Apache License 2.0.

Metadata

Release files for id-svo-extractor 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for id-svo-extractor 0.3.0
File Size Uploaded
id_svo_extractor-0.3.0.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for id-svo-extractor 0.3.0
File Interpreter ABI Platform
id_svo_extractor-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.9 kB

Release files / id_svo_extractor-0.3.0.tar.gz

Download URL id_svo_extractor-0.3.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
de13bf0f7e05115431486bbfcf6868958de1b8e143ead2004cbdacaddc634fc9
BLAKE2b-256 checksum
How to use checksums
daf12baa14920391f0126ee46378d9bc248ff6948c860b850ee6b49648ca961a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.0

Release files / id_svo_extractor-0.3.0-py3-none-any.whl

Download URL id_svo_extractor-0.3.0-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
848fa1f6648afe5f7c95894be2301adde6a226c390a5c3c7fc72c892ba0d3d5e
BLAKE2b-256 checksum
How to use checksums
d99f88a54bb2933c3debce9d22bf170b525a12972f106e52d93674ede4b1f8b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page