Skip to main content

PyPI version

XQASem

XQASem is a Python package for extracting predicate-centered question-answer structures from text. It currently includes presets for French, Russian, and Hebrew models hosted on HuggingFace.

This package accompanies the paper Effective QA-Driven Annotation of Predicate-Argument Relations Across Languages.

Installation

pip install xqasem

Install the spaCy pipelines you plan to use:

python -m spacy download fr_core_news_md
python -m spacy download ru_core_news_sm

Hebrew uses spacy-stanza; on first use, Stanza may need to download its Hebrew resources.

Environment

This project was tested with the following setup:

  • Python 3.10.20
  • torch 2.6.0 (CUDA 12.4)
  • transformers 4.57.1
  • spaCy 3.7.5

Requirements

  • Python 3.10+
  • transformers >= 4.50
  • spaCy >= 3.7
  • torch >= 2.0

Note: GPU is recommended for efficient inference.

Installation from source

git clone https://github.com/JohnnieDavidov/xqasem.git
cd xqasem
pip install -e .

Basic Usage

Example

from xqasem import XQasemParser

parser = XQasemParser.from_language("fr")

sentences = [
    "Les experts ont souligné que le nouvel algorithme accélère considérablement le traitement des requêtes complexes."
]

df = parser(sentences)

print(df)

Example output:

sentence predicate predicate_type question answer
Les experts ont souligné que le nouvel algorithme accélère considérablement le traitement des requêtes complexes. souligné verb qui a souligné quelque chose? Les experts
Les experts ont souligné que le nouvel algorithme accélère considérablement le traitement des requêtes complexes. accélère verb qu'est-ce qui accélère quelque chose? le nouvel algorithme
Les experts ont souligné que le nouvel algorithme accélère considérablement le traitement des requêtes complexes. accélère verb qu'est-ce que quelque chose accélère? le traitement des requêtes complexes

The built-in language presets are:

parser_fr = XQasemParser.from_language("fr")
parser_ru = XQasemParser.from_language("ru")
parser_he = XQasemParser.from_language("he")

You can also load an explicit Hugging Face model:

parser = XQasemParser.from_pretrained(
    "YonatanDavidov/qasem-fr-claire-lora",
    spacy_lang="fr_core_news_md",
    is_adapter=True,
)

Command Line

After installation, you can run:

xqasem-parse --lang fr --output outputs/fr.csv "Les experts ont souligné que le nouvel algorithme accélère le traitement."

You can also run the script directly:

python scripts/run_parser.py --lang fr --output outputs/fr.csv

Model Presets

Language Model spaCy pipeline
French YonatanDavidov/qasem-fr-claire-lora fr_core_news_md
Russian YonatanDavidov/qasem-ru-sambalingo-lora ru_core_news_sm
Hebrew YonatanDavidov/qasem-he-dictalm2-lora he via spacy-stanza
Hebrew full model YonatanDavidov/qasem-he-dictalm2-full he via spacy-stanza

Citation

If you use this code or the released models, please cite:

@inproceedings{davidov-etal-2026-effective,
    title = "Effective {QA}-Driven Annotation of Predicate{--}Argument Relations Across Languages",
    author = "Davidov, Jonathan  and
      Slobodkin, Aviv  and
      Klein, Shmuel Tomi  and
      Tsarfaty, Reut  and
      Dagan, Ido  and
      Klein, Ayal",
    editor = "Demberg, Vera  and
      Inui, Kentaro  and
      Marquez, Llu{\\'i}s",
    booktitle = "Proceedings of the 19th Conference of the {E}uropean Chapter of the {A}ssociation for {C}omputational {L}inguistics (Volume 1: Long Papers)",
    month = mar,
    year = "2026",
    address = "Rabat, Morocco",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2026.eacl-long.112/",
    doi = "10.18653/v1/2026.eacl-long.112",
    pages = "2484--2502",
    ISBN = "979-8-89176-380-7"
}

Acknowledgments

This implementation builds on ideas and code structure from Paul Roit's qasem_parser, which provides the original English QA-Sem parsing framework that inspired this multilingual extension.

Metadata

Release files for xqasem 0.1.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 xqasem 0.1.2
File Size Uploaded Provenance Actions
xqasem-0.1.2.tar.gz 17.5 kB Without provenance Details for xqasem-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 33.8 kB

Release files / xqasem-0.1.2.tar.gz

Download URL xqasem-0.1.2.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ad59aac319526eddf7ba912226b8b1040c8ed0e7dbf4cd3444e1886d47427ae6
BLAKE2b-256 checksum
How to use checksums
533519d56691822f1cad787b756509a80a4fa7e36d4ec4a5cfbed9a8e877a500
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Release files / xqasem-0.1.2-py3-none-any.whl

Download URL xqasem-0.1.2-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fdf2cc840b5a3569e4fbd9dc3968f18637e96aae25c113b76d040f5aa2b26c4
BLAKE2b-256 checksum
How to use checksums
12cc8a30ed03e9e808a1e7bbb67b36069f622b3ec135c8bd65c2050254fc2910
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.20

Security for xqasem 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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