Skip to main content

QUAlity of sentence eXAmples scoring

Project description

PyPI version PyPi downloads DOI

QUAXA: QUAlity of sentence eXAmples scoring

Rule-based sentence scoring algorithm based on GDEX.

Rules

Formel

score = 0.5 * isnoknockout + 0.5 * gesamtfaktor

Knock-out Kritieren

Wenn 1 Knock-out Kriterium identifiziert wird, dann wird direkt der Score direkt um 0.5 (von 1.0) gesenkt.

Funktion Ausgabe Beschreibung Hinweis
has_finite_verb_and_subject bool Der Satz hat ein finites Verb und ein Subjekt, wovon eines Root des Dependenzbaum ist oder via beide über Root Node verknüpft sind. [1] GDEX whole sentence
is_misparsed bool Das 1. Zeichen des Strings ist kleingeschrieben, ein Leerzeichen oder eine Punktuation; oder das letzte Zeichen ist keine Punktuation. [1] GDEX whole sentence
has_illegal_chars bool String enhält Kontrolzeichen (ASCII 0-31), oder die Zeichen `<> []/^@'` (z.B. HTML Tags, Markdown Hyperlinks, Dateipfade, E-Mail, u.a.)
has_blacklist_words bool Satzbeleg enthält Wörter, sodass in keinem Fall der Satzbeleg als Wörterbuchbeispiel in Betracht gezogen wird; ausgenommen das Blacklist-Wort ist selbt der Wörterbucheintrag. (dt. Blacklist ist voreingestellt) [1] GDEX blacklist

Diskontierungsfakoren

Je Kriterium wird ein Faktor berechnet, und alle Faktoren miteinander multipliziert. Wenn bspw. ein Faktor eine Penality von 0.1 bekommt, dann ist der Faktor 0.9. Für den Gesamtscore wird der Gesamtfaktor mit 0.5 multipliziert.

Funktion Ausgabe Beschreibung Hinweis
factor_rarechars [0.0, 1.0] Strafe für jedes Zeichen, was 0123456789\'.,!?)(;:- ist (Zahlen bzw. lange Zahlen; . für Abk.; mehrere Punktuationen; Bindestrichwörter, u.a.) [1] GDEX rare chars
factor_notkeyboardchar [0.0, 1.0] Der Prozentsatz der Zeichen, die mit einem deutsche Tastaturlayout getippt werden können. n.a.
factor_graylist_words [0.0, 1.0] Strafe Satzbelege ab, wenn Lemma auf einer Graylist steht; ausgenommen das Graylist-Wort ist selbt der Wörterbucheintrag. (Default: Keine Graylist voreingestellt) [1] GDEX greylist
factor_named_entity [1.0 - penalty, 1.0] Strafe Satzbeleg ab, wenn Lemma ein o. Teil eines Eigennamen ist [1] GDEX upper case (rare chars), [2] GBEX NE
deixis_time [0.0, 1.0] Strafe Signalwörter für Temporaldeixis ab. [2] GBEX Dexis; [3]
deixis_space [0.0, 1.0] Strafe Signalwörter für Lokaldeixis ab. [2] GBEX Dexis; [3]
deixis_person [0.0, 1.0] Strafe Wörter mit UPOS=PRON und `PronType=Prs Dem
optimal_interval [0.0, 1.0] Strafe Satzbelege mit zu wenigen/vielen Wörter ab ab. [1] GDEX

Quellen:

Appendix

Installation

The quaxa git repo is available as PyPi package

pip install quaxa
pip install git+ssh://git@github.com/ulf1/quaxa.git

Install a virtual environment

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt --no-cache-dir
pip install -r requirements-dev.txt --no-cache-dir

(If your git repo is stored in a folder with whitespaces, then don't use the subfolder .venv. Use an absolute path without whitespaces.)

Python commands

  • Jupyter for the examples: jupyter lab
  • Check syntax: flake8 --ignore=F401 --exclude=$(grep -v '^#' .gitignore | xargs | sed -e 's/ /,/g')
  • Run Unit Tests: PYTHONPATH=. python -m unittest

Publish

python setup.py sdist 
twine upload -r pypi dist/*

Clean up

find . -type f -name "*.pyc" | xargs rm
find . -type d -name "__pycache__" | xargs rm -r
rm -r .pytest_cache
rm -r .venv

Support

Please open an issue for support.

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request.

Acknowledgements

The "Evidence" project was funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) - 433249742 (GU 798/27-1; GE 1119/11-1).

Maintenance

  • till 31.Aug.2023 (v0.1.0) the code repository was maintained within the DFG project 433249742
  • since 01.Sep.2023 (v0.1.0) the code repository is maintained by Ulf Hamster.

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

quaxa-0.1.1.tar.gz (15.6 kB view hashes)

Uploaded Source

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