CoolFace
Datasetpublic

heyIamUmair/query-classification-pakistani-legal-vs-nonlegal

Pakistani Legal Query Classification Dataset A binary classification dataset to distinguish legal queries from non-legal queries, built for the PakLegalAid project and the paper: "Enhancing Legal Assistance with Large Language Models: A Parameter-Efficient Fine-Tuning and Retrieval-Augmented Generation Approach"Umair Ahmed, Sher Muhammad Daudpota, Ali Shariq Imran, Zenun Kastrati, Muhammad Nabeel — submitted to PLOS ONE, 2025. Dataset Description This… See the full description on the dataset page: https://huggingface.co/datasets/heyIamUmair/query-classification-pakistani-legal-vs-nonlegal.

sourceHugging Facecc-by-4.0updated 5mo agoView on Hugging Face
0likes11downloads
Dataset Card

Pakistani Legal Query Classification Dataset

A binary classification dataset to distinguish legal queries from non-legal queries, built for the PakLegalAid project and the paper:

"Enhancing Legal Assistance with Large Language Models: A Parameter-Efficient Fine-Tuning and Retrieval-Augmented Generation Approach" Umair Ahmed, Sher Muhammad Daudpota, Ali Shariq Imran, Zenun Kastrati, Muhammad Nabeel — submitted to PLOS ONE, 2025.

Dataset Description

This dataset serves as the query filter at the entry point of the PakLegalAid pipeline. Before a query reaches the LLM, it is classified as legal or non-legal. Only legal queries proceed to the RAG and fine-tuned generation pipeline.

Construction

  • —Legal queries (label = 1): ~4,000 real legal questions scraped from publicly accessible online legal forums and Q&A platforms.
  • —Non-legal queries (label = 0): ~4,000 samples drawn equally from three public Kaggle datasets — Yelp Reviews, IMDB Movie Reviews, and AG News — representing diverse everyday language clearly outside the legal domain.

Total: 8,000 samples | Split: 80% train (6,400) / 20% test (1,600)


Dataset Format

ColumnTypeDescription
questionstringThe input query text
labelint1 = Legal query, 0 = Non-legal query

How to Load

python
from datasets import load_dataset

ds = load_dataset(
    "heyIamUmair/query-classification-pakistani-legal-vs-nonlegal",
    data_files="query_classification.csv",
    split="train"
)
print(ds[0])

Citation

If you use this dataset, please cite:

bibtex
@misc{ahmed2025classification,
  author       = {Ahmed, Umair},
  title        = {Pakistani Legal Query Classification Dataset},
  year         = {2025},
  publisher    = {Hugging Face},
  howpublished = {\url{https://huggingface.co/datasets/heyIamUmair/query-classification-pakistani-legal-vs-nonlegal}}
}

⚠️ For research purposes only. Not a substitute for professional legal advice.