Skip to main content

Cross-lingual QASem parser for predicate-centered question-answer structures.

Project description

XQASem

XQASem is a small 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.

Installation from source

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

Basic Usage

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 installing the package:

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.

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

xqasem-0.1.1.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xqasem-0.1.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file xqasem-0.1.1.tar.gz.

File metadata

  • Download URL: xqasem-0.1.1.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for xqasem-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e502f2af26c538626e1553274d76e940f2e7a97f8d5b9f2e99e87cc364d2e3eb
MD5 0f8f8b3047796ec5b2a0222bbabf5e9b
BLAKE2b-256 d75e59806c8ea0ed2ae282061907a8a468e2b622f04449648240f9f6f232e0eb

See more details on using hashes here.

File details

Details for the file xqasem-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: xqasem-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for xqasem-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f1475b3bb63d6cc68fa1a16523f36da86129094421a2f82f019160f2a6bbf73c
MD5 67f880823afbfd8aebb01888c169842f
BLAKE2b-256 4940c26b8dc40451f0bc112b6c1e89edbf210817128bdc3ecbc46d927fd0dfac

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