Deep learning model for classifying legal documents into categories relevant to international criminal justice proceedings.
pip install torch transformers
from document_classifier import DocumentClassifier
# Initialize model
classifier = DocumentClassifier()
# Load from pretrained
classifier.load_pretrained('path/to/model.pth')
# Classify document
result = classifier.classify('path/to/document.pdf')
print(f"Category: {result['category']}")
print(f"Confidence: {result['confidence']}")
DocumentClassifier.classify(document_path, return_probs=False)
Classifies a document into one of the predefined categories.
Parameters:
document_path
(str): Path to the document filereturn_probs
(bool): Return probability distribution over all classesReturns:
return_probs=True
, includes ‘probabilities’ keyThe model was trained on a diverse dataset including:
model.pth
- PyTorch model weightsconfig.json
- Model configurationtokenizer/
- Tokenizer fileslabels.json
- Category labels mappingMIT License - See LICENSE file for details
@model{document_classifier_2024,
title={Document Classifier for Legal Proceedings},
author={Lemkin AI},
year={2024},
version={1.0}
}