From b8de9e94afdd287e30951d2a09780231d902b724 Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 17 Feb 2024 10:40:00 +0100 Subject: [PATCH] add name in law config --- data/configs/abgb.toml | 1 + data/configs/eheg.toml | 1 + data/configs/kschg.toml | 1 + data/configs/mschg.toml | 1 + data/configs/schifffahrtsg.toml | 1 + data/configs/stgb.toml | 1 + data/configs/teg.toml | 1 + data/configs/urhg.toml | 1 + data/configs/vereinsg.toml | 1 + data/configs/vgg.toml | 1 + src/config.rs | 2 +- src/law/mod.rs | 9 ++++++++- 12 files changed, 19 insertions(+), 2 deletions(-) diff --git a/data/configs/abgb.toml b/data/configs/abgb.toml index 11a25e2..88e680e 100644 --- a/data/configs/abgb.toml +++ b/data/configs/abgb.toml @@ -1,5 +1,6 @@ [law] id = 10001622 +name = "ABGB" [[law.classifiers]] name = "Theil" diff --git a/data/configs/eheg.toml b/data/configs/eheg.toml index 7d93555..9982cde 100644 --- a/data/configs/eheg.toml +++ b/data/configs/eheg.toml @@ -1,5 +1,6 @@ [law] id = 10001871 +name = "Ehegesetz" [[law.classifiers]] name = "Abschnitt" diff --git a/data/configs/kschg.toml b/data/configs/kschg.toml index a856e90..bcfc9f2 100644 --- a/data/configs/kschg.toml +++ b/data/configs/kschg.toml @@ -1,5 +1,6 @@ [law] id = 10002462 +name = "Konsumentenschutzgesetz" [[law.classifiers]] name = "Hauptstück" diff --git a/data/configs/mschg.toml b/data/configs/mschg.toml index bfd1a89..c53b3d7 100644 --- a/data/configs/mschg.toml +++ b/data/configs/mschg.toml @@ -1,5 +1,6 @@ [law] id = 10002180 +name = "Markenschutzgesetz" [[law.classifiers]] name = "Abschnitt" diff --git a/data/configs/schifffahrtsg.toml b/data/configs/schifffahrtsg.toml index bd0bc5f..bea267c 100644 --- a/data/configs/schifffahrtsg.toml +++ b/data/configs/schifffahrtsg.toml @@ -1,5 +1,6 @@ [law] id = 10012703 +name = "Schifffahrtsgesetz" [[law.classifiers]] name = "Teil" diff --git a/data/configs/stgb.toml b/data/configs/stgb.toml index 4472c82..1cb46d3 100644 --- a/data/configs/stgb.toml +++ b/data/configs/stgb.toml @@ -1,5 +1,6 @@ [law] id = 10002296 +name = "StGB" [[law.classifiers]] name = "Teil" diff --git a/data/configs/teg.toml b/data/configs/teg.toml index c810da3..f0b1713 100644 --- a/data/configs/teg.toml +++ b/data/configs/teg.toml @@ -1,5 +1,6 @@ [law] id = 10001905 +name = "TEG" [[law.classifiers]] name = "Abschnitt" diff --git a/data/configs/urhg.toml b/data/configs/urhg.toml index a12673d..b9326da 100644 --- a/data/configs/urhg.toml +++ b/data/configs/urhg.toml @@ -1,5 +1,6 @@ [law] id = 10001848 +name = "Urhebergesetz" [[law.classifiers]] name = "Hauptstück" diff --git a/data/configs/vereinsg.toml b/data/configs/vereinsg.toml index 21b27a7..05db481 100644 --- a/data/configs/vereinsg.toml +++ b/data/configs/vereinsg.toml @@ -1,5 +1,6 @@ [law] id = 20001917 +name = "Vereinsgesetz" [[law.classifiers]] name = "Abschnitt" diff --git a/data/configs/vgg.toml b/data/configs/vgg.toml index 5de77ea..2d9df81 100644 --- a/data/configs/vgg.toml +++ b/data/configs/vgg.toml @@ -1,5 +1,6 @@ [law] id = 20011654 +name = "Verbrauchergewährleistungsgesetz" [[law.classifiers]] name = "Abschnitt" diff --git a/src/config.rs b/src/config.rs index 71f5273..2a07c21 100644 --- a/src/config.rs +++ b/src/config.rs @@ -85,7 +85,6 @@ impl Config { if config.parser.move_para_headers_into_content { parser.move_para_headers_into_content(); } - Ok((config.law.id, builder, parser)) } } @@ -93,6 +92,7 @@ impl Config { #[derive(Debug, Deserialize)] struct Law { id: usize, + name: String, classifiers: Vec, } diff --git a/src/law/mod.rs b/src/law/mod.rs index 6b6e1bf..6594287 100644 --- a/src/law/mod.rs +++ b/src/law/mod.rs @@ -30,6 +30,7 @@ pub mod responsible; /// That's our struct, holding all the information of the law text. #[derive(Debug, Serialize, Deserialize, PartialEq)] pub struct Law { + pub name: String, pub header: Vec, } @@ -84,7 +85,10 @@ impl From for Law { }); } - Self { header: ret } + Self { + header: ret, + name: builder.name, + } } } @@ -133,6 +137,8 @@ impl From for HeadingContent { /// Is used to generate a law struct. It's organized mainly by classifier. #[derive(Debug)] pub struct LawBuilder { + name: String, + /// Structure of the law text classifiers: Vec, @@ -168,6 +174,7 @@ impl LawBuilder { /// Creates a new law builder. Adds classifier for known law texts. pub fn new() -> Self { Self { + name: "".into(), classifiers: Vec::new(), header: Vec::new(), next_para_header: None,