Extract metadata from legal citations. Currently supports neutral, SCR, and CanLII citations.
Project description
citation_parser
Extracts metadata from legal citations.
This Python module is designed to extract and standardize metadata from legal citation strings specifically from the Canadian Legal Information Institute (CanLII) database. It includes functionalities such as validating URLs, correcting court codes, parsing citation strings, and constructing URLs based on the extracted metadata.
Features
- URL Validation: Checks if a CanLII URL is valid by sending a GET request.
- Court Code Correction: Standardizes and corrects court codes found within citation strings.
- Citation Parsing: Extracts metadata from CanLII citation strings, including year, court code, decision number, and more.
- URL Construction: Constructs CanLII URLs for cases based on their metadata.
Known issues
- Assumes and requires correct input
- Currently limited to neutral and CanLII citations
Installation
To use this module, first ensure you have Python installed on your system. Then, clone this repository to your local machine:
git clone https://github.com/yourusername/canlii-citation-metadata-extractor.git
cd canlii-citation-metadata-extractor
Install the required dependencies:
pip install -r requirements.txt
Usage
from citation_extractor import parse_citation, canlii_url_constructor
citation = "R v Smith, 2019 ONCA 123 (CanLII)"
parsed_citation = parse_citation(citation, citation_type="canlii")
print(parsed_citation)
# To construct a URL from the parsed citation
url = canlii_url_constructor(parsed_citation['jurisdiction'], parsed_citation['court'], parsed_citation['year'], parsed_citation['decision_number'], parsed_citation['citation_type'])
print(url)
Contributing
Contributions to improve this module are welcome. You can contribute by:
- Reporting bugs
- Suggesting enhancements
- Sending pull requests with bug fixes or new features
License
This project is licensed under the GPL 3.0 License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for legal_citation_parser-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ee3413de4f03d2f3dce32fa0707e14016dc8870db0347ba49aa4beafeddac62 |
|
MD5 | c5a1553a9d0ee711b042e2bd843c0aae |
|
BLAKE2b-256 | 58db1c8c58c427d002f2bff9b1d63cd1b0a16231b96ef57c14b1daddbddbad2d |
Hashes for legal_citation_parser-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af151659350b472549c2425501c186a854ed0fcd040ae24f61ee621e2298785a |
|
MD5 | ff36eed43f7f19dbf9421ebcb399efc3 |
|
BLAKE2b-256 | 0a3c4f455b61c5930e4715a83715e52a0bf3b2abe7058704b28274806f3229ed |