Skip to main content

No project description provided

Project description

MWE Query

DOI PyPI version Actions Status

Run Locally

This will ask for the (local) BaseX-database to query.

pip install -r requirements.txt
python -m mwe_query

Use as Library

Create Queries

from mwe_query import Mwe
from alpino_query import parse_sentence

# the pronominal is marked with <>
sentence = 'iemand zal er <goed> voor staan'
mwe = Mwe(sentence)
# parse this sentence using Alpino
tree = parse_sentence(mwe.can_form)
mwe.set_tree(tree)

# This generates a list of MweQuery-objects
queries = mwe.generate_queries()

# precise = queries[0]
# near_miss = queries[1]
superset = queries[2]

print(superset.xpath)
# /node[..//node[@lemma="goed" and @pt="adj"] and ..//node[@lemma="staan" and @pt="ww"]]
print(superset.description)
# superset
print(superset.rank)
# 3

Analyze Results

from mwe_query import analyze_mwe_hit

# hit: etree._Element containing the node which matched on of the
# queries
# queries: generated query objects
# tree: etree._Element of the entire utterance tree
info = analyze_mwe_hit(hit, queries, tree)
print(hit.components.marked_utt)

Upload to PyPi

pip install twine
python setup.py sdist
# this can be tested locally by creating a virtualenv and installing it:
# pip install dist/mwe-query-x.x.x.tar.gz
twine upload dist/*

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

mwe_query-0.2.0a1.tar.gz (154.5 kB view details)

Uploaded Source

File details

Details for the file mwe_query-0.2.0a1.tar.gz.

File metadata

  • Download URL: mwe_query-0.2.0a1.tar.gz
  • Upload date:
  • Size: 154.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for mwe_query-0.2.0a1.tar.gz
Algorithm Hash digest
SHA256 77b7b4ba0ab0f0cd7b89d9bf55c690decbab5a25a863058b477dd78f1a86405c
MD5 6aef70c83d0fe8dbfd48b438cc52348f
BLAKE2b-256 9799ff45b3f278cecc6495f2d4631d7cc11c4f6a81a177f010573730e50db882

See more details on using hashes here.

Supported by

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