Skip to main content

Prevert iterator

To use the prevert parser, copy the file prevert.py in your directory.

Use

# import libraries
from prevert import dataset
import pandas as pd

If you are using the MaCoCu corpora in the XML format, the method dataset() needs only the path of the file as the argument:

# Open the dataset with the prevert parser 
dset = dataset("/data/monolingual/mk.xml")

dset consists of docs where you can access the metadata by doc.meta['attribute_name']. Docs consist of paragraphs where you can access the metadata by par.meta['attribute_name'].

Basic use:

for doc in dset: # iterating through documents of a dataset
    print(doc.meta) # all attributes
    print(eval(doc.meta['lang_distr'])[0][0]) # most prominent language in the document
    print(str(doc)) # whole document text
    for par in doc: # iterating through paragraphs of a document
        print(par.meta['id']) # specific attribute
        print(str(par)) # whole paragraph text
    print(doc.to_prevert()) # obtaining the original format

Release files for prevert 1.0.2

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

Source distribution (sdist)

Source distribution for prevert 1.0.2
File Size Uploaded
prevert-1.0.2.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prevert 1.0.2
File Interpreter ABI Platform
prevert-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.8 kB

Release files / prevert-1.0.2.tar.gz

Download URL prevert-1.0.2.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
293babf3d98ff6e1212870409cfb6c81aace64012f3da784d297adb835748965
BLAKE2b-256 checksum
How to use checksums
5c8ddf2373be62b8a18870464559e69a7baeb5f8533e3729dd2616a745ea5404
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.13

Release files / prevert-1.0.2-py3-none-any.whl

Download URL prevert-1.0.2-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee6aa5862a51cf78514c7a7a7fe98916d049e32fd253f16c83afa3a6d616f00e
BLAKE2b-256 checksum
How to use checksums
06345cc3087e96b103cc7783963a448cf612dd4cd4eaace31e1f51e439452e22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.13

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.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