Instructions to use fearlessbj4/similar_cases_suggesting_system with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use fearlessbj4/similar_cases_suggesting_system with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy), and from_pretrained_keras was removed in huggingface_hub 1.0. # See https://github.com/keras-team/tf-keras for more details. # !pip install "huggingface_hub<1.0" tf_keras from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("fearlessbj4/similar_cases_suggesting_system") - sentence-transformers
How to use fearlessbj4/similar_cases_suggesting_system with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("fearlessbj4/similar_cases_suggesting_system") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Labor Case Recommendation with Issue-Level Visualization
This project is the integrated demonstration of my master's thesis in Computer Science at National Chengchi University. It recommends related Taiwanese labor-case judgments and highlights related issue sentences so users can inspect the textual basis of a recommendation.
The demo was completed in August 2024. The underlying research combines legal issue extraction, sentence representation learning, case-pair classification, ensemble ranking, and a Gradio interface.
What the system does
Given issue sentences extracted from a target case, the system compares the target against candidate cases, ranks the candidates, and displays related issue sentences using consistent colors. An additional version supports prediction using applicant-side issues alone, reflecting situations where both parties' arguments are not yet available.
This repository hosts project artifacts; the model repository page itself is not a hosted interactive Gradio application.
Demo screenshots
Inspect a target and a candidate case
The exported HTML places the target on the left and a candidate judgment on the right, with claim text (plaintiff), issue text (p_point), and a case-pair score. Colors indicate assigned issue groups to support side-by-side inspection; they are not a causal explanation of the ranking model.
The displayed score, approximately 0.7383, belongs to this single case pair. It is neither an evaluation accuracy nor a calibrated probability. This screenshot demonstrates the interface, not benchmark performance. Its candidate identifier includes a 2022 judgment date; the research corpus statistics below are reported separately and should not be inferred from this screenshot.
Supply claim text and extracted issues
The illustrated interface accepts a file name, plaintiff-side claim text, and already-extracted issue text. LLM issue extraction is a stage in the broader research workflow; this form should not be taken as evidence that extraction runs automatically on submission. The output panel provides HTML files for inspection. Additional slots in this capture show out_of_range.html; their filenames alone do not establish how many valid recommendations were generated.
Method
- Argument extraction: Regular expressions segment the parties' arguments from judgment text.
- Issue extraction: LLM prompts extract issue sentences from those argument sections. Experiments used GPT-3.5 Turbo and GPT-4 variants.
- Issue representation: The representation stage uses S-BERT with Chinese RoBERTa and Lawformer backbones. Issue sentences are assigned to existing groups by similarity to representative center-sentence embeddings.
- Representation fine-tuning: Contrastive loss brings same-group issue-sentence pairs closer and separates different-group pairs. These pairs were drawn from cases outside the downstream test cases.
- Case-pair prediction: CNN and BiLSTM models predict whether a target/candidate pair represents similar cases. Each target is compared against the candidate database.
- Ensemble ranking: Logistic regression combines the model predictions; the resulting scores rank candidate cases.
- Inspection: Gradio presents the ranked results and colors issue sentences by their assigned group.
The issue-group assignment uses an existing grouping structure; it does not discover new groups at inference time. The ranking scores should not be interpreted as calibrated probabilities of legal similarity.
Data and annotation
- Source: Public judgments published by Taiwan's Judicial Yuan.
- Scope: Labor litigation, covering 2000-2021.
- Corpus: 3,835 unique judgments.
- Labeled pairs: 2,514 binary-labeled case pairs after filtering.
Three people with law backgrounds independently labeled pairs as similar, dissimilar, or borderline similar. Labels were compared afterward, retaining pairs with agreement from at least two annotators and excluding borderline cases. The final labels are similar and dissimilar; the annotation process did not involve a consensus discussion.
These figures describe the research corpus and do not imply that every source judgment or annotation is distributed in this repository.
Evaluation
The CNN/BiLSTM logistic-regression ensemble was compared with the LFESM baseline across 30 matched case-pair data splits, using the same dataset and evaluation procedure. Classification was evaluated using accuracy and macro-F1. Recommendation ranking was evaluated separately using Precision@1.
Splits were made at the case-pair level, so a judgment may appear in pairs in more than one partition. These experiments therefore do not establish performance on a strictly case-disjoint test set. Cases used for S-BERT contrastive fine-tuning were separate from downstream test cases.
My contribution
I led and implemented the representation-learning, case-pair modeling, ensemble, ranking, and Gradio visualization workflow, including the applicant-side-input variant. A classmate helped refine the prompts used for LLM issue extraction.
Limitations
- The research focuses on Taiwanese labor litigation; results should not be assumed to transfer to other case types or jurisdictions.
- LLM extraction errors can propagate into representations and recommendations.
- The interface's color coding shows assigned issue groups, not a causal explanation of the classifier's decision.
- Historical judgments and automated similarity predictions require human interpretation. This is a research demonstration, not a substitute for legal advice.
- The original environment dates to 2024; compatibility with current dependency versions has not been revalidated for this documentation update.
Archived version
This card describes the thesis workflow. It does not assert that every experiment or training artifact is included in this snapshot.
- Downloads last month
- -


