Skip to main content

Japanese Law Parser

PyPI - Version GitHub Workflow Status (with event)

法令標準 XML スキーマに準拠する XML ファイルを解析し、 pydantic のモデルに変換するライブラリです。

e-Gov法令検索で公開されている、日本国の法令 XML(憲法・法律・政令・勅令・府令・省令・規則)をパースし、解析結果を Python から利用することができます。

内部的に pydantic-xml を利用して XML をパースしています。

Installation

pip

pip install ja-law-parser

poetry

poetry add ja-law-parser

Usage

from ja_law_parser.model import Article, Chapter, Law, Paragraph
from ja_law_parser.parser import LawParser

parser = LawParser()

law: Law = parser.parse(path="321CONSTITUTION_19470503_000000000000000.xml")
print(law.law_body.law_title.text)
# => 日本国憲法

chapter3: Chapter = law.law_body.main_provision.chapters[2]
print(chapter3.chapter_title.text)
# => 三章 国民の権利及び義務

article11: Article = chapter3.articles[1]
print(article11.article_title.text)
# => 第十一条

paragraph11: Paragraph = article11.paragraphs[0]
print(paragraph11.paragraph_sentence.sentences[0].text)
# => 国民は、すべての基本的人権の享有を妨げられない。
print(paragraph11.paragraph_sentence.sentences[1].text)
# => この憲法が国民に保障する基本的人権は、侵すことのできない永久の権利として、現在及び将来の国民に与へられる。

詳細は API ドキュメントを参照してください。

Reference

Metadata

Release files for ja-law-parser 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ja-law-parser 0.3.0
File Size Uploaded Provenance Actions
ja_law_parser-0.3.0.tar.gz 17.3 kB Without provenance Details for ja_law_parser-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ja-law-parser 0.3.0
File Interpreter ABI Platform Actions
ja_law_parser-0.3.0-py3-none-any.whl Python 3 none any Details for ja_law_parser-0.3.0-py3-none-any.whl

Total release size: 33.8 kB

Release files / ja_law_parser-0.3.0.tar.gz

Download URL ja_law_parser-0.3.0.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b8ef09a798d415b8cd0b7380307974672f7612e913bf5de660508b4863ddae8a
BLAKE2b-256 checksum
How to use checksums
80992563d1a88192d200dc16f04aa7d4625fa0ca960bd0fafff2e989d869f2a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / ja_law_parser-0.3.0-py3-none-any.whl

Download URL ja_law_parser-0.3.0-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5de26fcdf5ad95e662bf2d860c6748d27443f43d433b81561568fab2c0968222
BLAKE2b-256 checksum
How to use checksums
31bdfc0ea38d1a8bb32a8657da5a376d336378d90afb47286f70ba860b1478c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Security for ja-law-parser 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page