Code Monkey home page Code Monkey logo

hun_law_rs's Introduction

Hun-Law (Rust version)

A small project for parsing Hungarian Law. A rewrite of the Python version in Rust.

It does the following things:

  • Parse PDF files into lines. It does so much more accurately than other pdf2txt implementations.
  • Parse "Magyar Közlöny" PDFs into individual Acts
  • Separate Acts into structural elements (Articles, subpoints, etc.)
  • Parse internal and external references in legal text
  • Parse special phrases like amendments and repeals into easy-to-use objects
  • Generate plain text, colored text, JSON and YAML version of the parsed documents

Usage

After cloning the repository, you can run it with cargo run --release:

cargo run --release -- 2012/100
cargo run --release -- -p act-lines -t plain --mk 2013/31

Please see the output of cargo run --release -- --help for all options

Contribution

Feel free to open issues for feature requests or found bugs. Merge Requests are more than welcome too.

hun_law_rs's People

Contributors

badicsalex avatar

Stargazers

Felix Montanari avatar Belső Dániel avatar LZ91X  avatar Tamás Hegedűs avatar  avatar Tamás Nagy avatar Daniel Kovacs avatar Tamas Balogh avatar

Watchers

 avatar

hun_law_rs's Issues

Support text amendment of structural elements

A Büntető Törvénykönyvről szóló 2012. évi C. törvény 333. §-át megelőző alcímében a „nemzeti szocialista” szövegrész a „nemzetiszocialista” szöveggel lép hatályba.
(Not exact, 2013. évi XLVIII. törvény 3. § (4))

This will need a new text amendment type, most probably.

Parse article title text repeal

Properly parse the following:

Hatályát veszti az Art. 235. § szakaszcímében az „élelmiszer-értékesítést kezelőszemélyzet nélkül végző” szövegrész.

Into an article title amendment with empty string as the "to" text.

Structural text amendments

Parse the following phrases:

"Hatályát veszti a HARMADIK KÖNYV XXV. Fejezet címében az „és pótbefizetés” szövegrész"
(2021. évi XCV. törvény 46. § (20))

"12. alcím címében a „kihirdetése” szövegrész helyébe a „kihirdetése és a közjogi szervezetszabályozó eszközök közzététele” szöveg,"
(2019. évi II. törvény 19. § n)

Structural enforcement date parsing

Acceptance criteria:

  • Enforcement dates which contain structural references are parsed
  • EnforcementDate semantic info contains these structural references

Examples from 2022. évi XXII. törvény 21. §:

Az I. Fejezet, a 10. alcím, a 24. § 1. és 3. pontja, a 15–16. alcím, a 28. § 2. pontja, a 18–34. alcím, a 47. §, a 36. alcím, az 50. §, a 38–51. alcím, az 53–59. alcím, a 74. §, a 61–77. alcím, a 94. §, a 79–119. alcím, a 140. § (1) bekezdés 1–4. pontja, a 140. § (1) bekezdés 6. pontja, a 142. § (1)–(2) bekezdése, a 142. § (3) bekezdés 1–3. pontja, a 122–124. alcím, a 147. §, a 126. alcím, a 153. § b) pontja, a 128. alcím, a 157. §, a 130–148. alcím, a 186. § (1) bekezdés 2. pontja és 4–5. pontja, a 186. § (3) bekezdés 1–2. pontja, a 150–188. alcím, a 191. alcím, a 193–196. alcím, a 198–200. alcím és a 2–4. melléklet 2023. január 1-jén lép hatályba.

A 24. § 2. pontja, a 192. alcím és a 197. alcím 2023. február 1-jén lép hatályba.

A 190. alcím 2023. július 1-jén lép hatályba.

Support reverse amendment + insertion

From 2018. évi LXXXII. törvény 73. § (1):

A Jöt. 102. §-a a következő (3b) bekezdéssel egészül ki és a § (4) bekezdése helyébe a következő rendelkezés lép:

Parse structural references in regular text

Acceptance criteria:

  • In non-special text, "proper" structural references are parsed and stored just like OutgoingReferences
  • The weird title-only subtitle references which are just "Capitalized word + a lot of any token + 'alcím'" are not parsed in this step

Parse text amendments which have attachment references

Acceptance criteria:

  • Text amendments which have simple attachment references are parsed, at least the simple and structural reference parts

The actual attachment references do not need to be parsed.

E.g.

Az Art.131. § (19) bekezdésében és 1. melléklet 8. pontjában a „munkaügyi hatóságnak” szövegrész helyébe a „foglalkoztatás-felügyeleti hatóságnak” szöveg lép.

Preamble amendments

  1. évi CCI. törvény 377. § a) pont:

A jogalkotásról szóló 2010. évi CXXX. törvény preambulumában az „Alkotmány 7/A. § (4) bekezdésében” szövegrész helyébe az „Alaptörvény T) cikkében” szöveg lép.

Support multiple amendments in a single line

Multiple different positions and texts:

A megújuló energia közlekedési célú felhasználásának előmozdításáról és a közlekedésben felhasznált energia üvegházhatású gázkibocsátásának csökkentéséről szóló 2010. évi CXVII. törvény 13. § (2) bekezdés a) pontjában a „miniszterrel együttesen” szövegrész helyébe a „miniszter egyetértésével” szöveg, 13. § (2) bekezdés b) pontjában a „miniszterrel” szövegrész helyébe a „miniszter egyetértésével” szöveg lép.
(2010. évi CXXX. törvény 44. § (13))

Even different types:

A jogalkotásról szóló 2010. évi CXXX. törvény 11. alcímének címében és 25. § (1) bekezdésében az „A Magyar Köztársaság” szövegrész helyébe a „Magyarország” szöveg lép.
(2011. évi CCI. törvény 377. § e) pont)

Multiple repeals:

Hatályát veszti a légi-, a vasúti és a víziközlekedési balesetek és egyéb közlekedési események szakmai vizsgálatáról szóló 2005. évi CLXXXIV. törvény 22. § (2) bekezdésében az „együttes rendeletben állapítsák meg” szövegrész, 22. § (3) bekezdésében az „– a miniszterrel egyetértésben – együttes rendeletben állapítsák meg” szövegrész.

The most probable solution is that SpecialPhrase will need to be refactored, so that it can contain multiple text amendments and repeals, even mixed. At that point, TextAmendment and friends should be simplified so they don't contain any vectors, and are fully expanded position/replacement pairs.

An alternative solution is to keep TextAmendment and Repeal, but these should be vectors of simplified entries. This makes sense from a parsing standpoint, because these are pretty much never mixed, but this distinction is not important down the line in processing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.