Skip to content

Models hub legal #12999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
65e5263
2022-09-19-legre_indemnifications_en (#12758)
jsl-models Sep 19, 2022
29c138e
2022-09-20-legclf_cuad_confidentiality_clause_en (#12770)
jsl-models Sep 20, 2022
373d745
Add model 2022-09-27-legclf_cuad_licenses_clause_en (#12827)
jsl-models Sep 27, 2022
c78de74
Add model 2022-09-27-legclf_cuad_indemnifications_clause_en (#12828)
jsl-models Sep 27, 2022
5ce6ccd
Add model 2022-09-27-legner_bert_indemnifications_en (#12831)
jsl-models Sep 27, 2022
5d065cd
Add model 2022-09-27-legassertion_time_en (#12832)
jsl-models Sep 27, 2022
3ee8dbb
Add model 2022-09-27-legner_br_base_pt (#12837)
jsl-models Sep 27, 2022
4aa84fe
Add model 2022-09-27-legner_br_large_pt (#12839)
jsl-models Sep 27, 2022
582ce04
Add model 2022-09-28-legre_indemnifications_en (#12849)
jsl-models Sep 28, 2022
624cb24
Add model 2022-09-28-legner_br_bert_large_pt (#12850)
jsl-models Sep 28, 2022
7c2ab13
2022-09-28-legner_br_bert_base_pt (#12852)
jsl-models Sep 28, 2022
55dfe2f
2022-10-02-legner_arabert_arabic_ar (#12876)
jsl-models Oct 2, 2022
bffd6c1
Add model 2022-10-02-legner_bert_base_courts_de (#12878)
jsl-models Oct 2, 2022
bec8b0d
Merge branch 'master' into models_hub_legal
josejuanmartinez Oct 2, 2022
4565d27
2022-10-17-legner_confidentiality_en (#12942)
jsl-models Oct 17, 2022
05c5f80
Add model 2022-10-18-legclf_cuad_warranty_clause_en (#12947)
jsl-models Oct 18, 2022
6fe00cb
2022-10-18-legre_confidentiality_en (#12948)
jsl-models Oct 18, 2022
204e060
2022-10-19-legre_warranty_en (#12951)
jsl-models Oct 19, 2022
c050f48
2022-10-21-legclf_consulting_agreement_en (#12968)
jsl-models Oct 21, 2022
b7220ca
Removes wrong version of leg models
Oct 24, 2022
c0c8762
2022-10-24-legclf_consulting_agreement_en (#12979)
jsl-models Oct 24, 2022
b4b8bda
2022-10-25-legner_indian_court_judgement_en (#12986)
jsl-models Oct 25, 2022
a2fd7eb
Merge branch 'master' into models_hub_legal
Oct 25, 2022
d59fac3
Fixes benchmark format
Oct 25, 2022
353c8e7
2022-10-25-legner_indian_court_preamble_en (#12987)
jsl-models Oct 25, 2022
01a2f28
Update 2022-10-25-legner_indian_court_judgement_en.md
josejuanmartinez Oct 25, 2022
c6ee0b8
2022-10-25-legclf_bert_swiss_judgements_it (#12990)
jsl-models Oct 25, 2022
8eaebfb
2022-10-27-legclf_bert_swiss_judgements_de (#12994)
jsl-models Oct 27, 2022
c7c2e2d
Fixes pipeline name
Oct 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
layout: model
title: Legal Swiss Judgements Classification (German)
author: John Snow Labs
name: legclf_bert_swiss_judgements
date: 2022-10-25
tags: [de, legal, licensed, sequence_classification]
task: Text Classification
language: de
edition: Spark NLP for Legal 1.0.0
spark_version: 3.0
supported: true
article_header:
type: cover
use_language_switcher: "Python-Scala-Java"
---

## Description

This model is a Bert-based model that can be used to classify Swiss Judgement documents in German language into the following 6 classes according to their case area. It has been trained with SOTA approach.

## Predicted Entities

`public law`, `civil law`, `insurance law`, `social law`, `penal law`, `other`

{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
<button class="button button-orange" disabled>Open in Colab</button>
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/legal/models/legclf_bert_swiss_judgements_de_1.0.0_3.0_1666721425728.zip){:.button.button-orange.button-orange-trans.arr.button-icon}

## How to use



<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}

```python
document_assembler = nlp.DocumentAssembler() \
.setInputCol('text') \
.setOutputCol('document')

tokenizer = nlp.Tokenizer()\
.setInputCols(['document'])\
.setOutputCol("token")

clf_model = legal.BertForSequenceClassification.pretrained("legclf_bert_swiss_judgements", "de", "legal/models")\
.setInputCols(['document','token'])\
.setOutputCol("class")\
.setCaseSensitive(True)\
.setMaxSentenceLength(512)

clf_pipeline = Pipeline(stages=[
document_assembler,
tokenizer,
clf_model
])

model = pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))

data = spark.createDataFrame([["""Sachverhalt: A. Mit Strafbefehl vom 30. Juli 2015 sprach die Staatsanwaltschaft Lenzburg-Aarau gegen X._ eine bedingte Geldstrafe von 150 Tagessätzen zu Fr. 150.-- (Probezeit vier Jahre) sowie eine Busse von Fr. 4'500.-- aus wegen Führens eines Motorfahrzeugs in angetrunkenem Zustand sowie wegen mehrfacher Anstiftung zu falschem Zeugnis. Die Staatsanwaltschaft legte X._ unter anderem zur Last, am 5. Juli 2013 nach Aussage von Zeugen sein Auto mit einem Blutalkoholgehalt von mindestens 2,12 Promille bestiegen und von Lenzburg an seinen Wohnort in Z._ gelenkt zu haben. Das nach Einsprache von X._ mit der Sache befasste Bezirksgericht Lenzburg sprach ihn vom Vorwurf der mehrfachen Anstiftung zu falschem Zeugnis frei und verurteilte ihn wegen Führens eines Motorfahrzeugs in angetrunkenem Zustand zu einer bedingten Geldstrafe von 105 Tagessätzen zu Fr. 210.-- (Probezeit zwei Jahre) und zu einer Busse von Fr. 4'400.-- (Urteil vom 15. August 2016). B. X._ erhob Berufung. Das Obergericht des Kantons Aargau wies das Rechtsmittel ab (Urteil vom 3. Juli 2017). C. Mit Beschwerde in Strafsachen beantragt X._, das angefochtene Urteil sei aufzuheben und er von Schuld und Strafe freizusprechen."""]]).toDF("text")

result = model.transform(data)
```

</div>

## Results

```bash
+----------------------------------------------------------------------------------------------------+---------+
| document| class|
+----------------------------------------------------------------------------------------------------+---------+
|Sachverhalt: A. Mit Strafbefehl vom 30. Juli 2015 sprach die Staatsanwaltschaft Lenzburg-Aarau ge...|penal law|
+----------------------------------------------------------------------------------------------------+---------+
```

{:.model-param}
## Model Information

{:.table-model}
|---|---|
|Model Name:|legclf_bert_swiss_judgements|
|Compatibility:|Spark NLP for Legal 1.0.0+|
|License:|Licensed|
|Edition:|Official|
|Input Labels:|[document, token]|
|Output Labels:|[class]|
|Language:|de|
|Size:|409.6 MB|
|Case sensitive:|true|
|Max sentence length:|512|

## References

Training data is available [here](https://zenodo.org/record/7109926#.Y1gJwexBw8E).

## Benchmarking

```bash
| label | precision | recall | f1-score | support |
|---------------|-----------|--------|----------|---------|
| civil-law | 0.93 | 0.96 | 0.94 | 809 |
| insurance-law | 0.92 | 0.94 | 0.93 | 357 |
| other | 0.76 | 0.70 | 0.73 | 23 |
| penal-law | 0.97 | 0.95 | 0.96 | 913 |
| public-law | 0.94 | 0.94 | 0.94 | 1048 |
| social-law | 0.97 | 0.95 | 0.96 | 719 |
| accuracy | - | - | 0.95 | 3869 |
| macro-avg | 0.92 | 0.91 | 0.91 | 3869 |
| weighted-avg | 0.95 | 0.95 | 0.95 | 3869 |
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
layout: model
title: Legal Swiss Judgements Classification (English)
author: John Snow Labs
name: legclf_bert_swiss_judgements
date: 2022-10-25
tags: [en, legal, licensed, sequence_classification]
task: Text Classification
language: en
edition: Spark NLP for Legal 1.0.0
spark_version: 3.0
supported: true
article_header:
type: cover
use_language_switcher: "Python-Scala-Java"
---

## Description

This model is a Bert-based model that can be used to classify Swiss Judgement documents into the following 6 classes according to their case area. It has been trained with SOTA approach.

## Predicted Entities

`public law`, `civil law`, `insurance law`, `social law`, `penal law`, `other`

{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
<button class="button button-orange" disabled>Open in Colab</button>
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/legal/models/legclf_bert_swiss_judgements_en_1.0.0_3.0_1666723020261.zip){:.button.button-orange.button-orange-trans.arr.button-icon}

## How to use



<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}

```python
document_assembler = nlp.DocumentAssembler() \
.setInputCol('text') \
.setOutputCol('document')

tokenizer = nlp.Tokenizer()\
.setInputCols(['document'])\
.setOutputCol("token")

clf_model = legal.BertForSequenceClassification.pretrained("legclf_bert_swiss_judgements", "en", "legal/models")\
.setInputCols(['document','token'])\
.setOutputCol('class')\
.setCaseSensitive(True)\
.setMaxSentenceLength(512)

clf_pipeline = Pipeline(stages=[
document_assembler,
tokenizer,
clf_model
])
model = pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))

data = spark.createDataFrame([["""Facts of fact: A. The Canton Police arrested X._ on 2. January 2007 due to suspicion of having committed an intrusive bull. In the trial of the trial 3. In January 2007, he agreed to have, together with a complicient, carried out a rubbish steel in a Jeans store in the fountain. After that, the investigative judge opened to him orally, he took him into investigative detention for the risk of collusion and continuation. X._ renounced a written and justified order, but desired a review of the investigation by the president of the Canton Court. by 4. In January 2007, the investigative judge submitted the documents to the president of the Canton Court with the request to withdraw the complaint and maintain the investigative detention. X._ requested to withdraw the investigative detention and immediately release him into freedom. He may be released under conditions or conditions. At its disposal of 5. In January 2007, the president of the Canton Court stated that the urgent offence was suspected in relation to the authorized invasion of the Jeans business and other invasions already occurred during a previous imprisonment. The risk of collusion is not accepted, but the recurrence forecast is extremely disadvantaged, therefore there is a risk of continuation. This is the request of the investigative judge - this is according to the instructions of 23. May 2006 (GG 2006 2; www.kgsz.ch) was not authorized to order investigative detention - to carry out and to confirm the investigative detention. At its disposal of 5. In January 2007, the president of the Canton Court stated that the urgent offence was suspected in relation to the authorized invasion of the Jeans business and other invasions already occurred during a previous imprisonment. The risk of collusion is not accepted, but the recurrence forecast is extremely disadvantaged, therefore there is a risk of continuation. This is the request of the investigative judge - this is according to the instructions of 23. May 2006 (GG 2006 2; www.kgsz.ch) was not authorized to order investigative detention - to carry out and to confirm the investigative detention. B. With complaint in criminal cases of 5. February 2007 requested X._: 1. It should be noted that the order GP 2007 3 of the Canton Court President of the Canton of Schwyz of 5. January 2007 is invalid and the complainant must be immediately released from prison. 2nd Eventually the order GP 2007 3 of the Canton Court President of the Canton of Schwyz of 5. January 2007 shall be repealed and the complainant shall be immediately released from investigative detention. and 3. Subeventual is the complainant due to the violation of the cantonal Swiss law by the instructions of the Canton Court of Schwyz of 23. May 2006 immediately released from the detention. Fourth All under cost and compensation consequences at the expense of the complainant.” Fourth All under cost and compensation consequences at the expense of the complainant.” C. The investigative judge requires in his judgment that “there must be established that the investigative detention was ordered by the investigative authority in accordance with the law and that the appeal submitted by the Court of Appeal with the approval of the request for responsibility and the confirmation of the investigative detention (Decree of the President of the Canton Court of 5 January 2007) has been legally rejected.” Insofar as X._ requires his immediate release, the complaint must be rejected. The President of the Canton Court asks to reject the complaint insofar as it is necessary. X._ requires unpaid legal assistance and defence and completes in its response to the complaint."""]]).toDF("text")

result = model.transform(data)
```

</div>

## Results

```bash
+----------------------------------------------------------------------------------------------------+----------+
| document| class|
+----------------------------------------------------------------------------------------------------+----------+
|Facts of fact: A. The Canton Police arrested X._ on 2. January 2007 due to suspicion of having co...|public law|
+----------------------------------------------------------------------------------------------------+----------+
```

{:.model-param}
## Model Information

{:.table-model}
|---|---|
|Model Name:|legclf_bert_swiss_judgements|
|Compatibility:|Spark NLP for Legal 1.0.0+|
|License:|Licensed|
|Edition:|Official|
|Input Labels:|[document, token]|
|Output Labels:|[class]|
|Language:|en|
|Size:|409.7 MB|
|Case sensitive:|true|
|Max sentence length:|512|

## References

Training data is available [here](https://zenodo.org/record/7109926#.Y1gJwexBw8E).

## Benchmarking

```bash
| label | precision | recall | f1-score | support |
|---------------|-----------|--------|----------|---------|
| civil-law | 0.97 | 0.96 | 0.96 | 1189 |
| insurance-law | 0.95 | 0.98 | 0.96 | 1081 |
| other | 0.92 | 0.90 | 0.91 | 40 |
| penal-law | 0.97 | 0.94 | 0.96 | 1140 |
| public-law | 0.94 | 0.97 | 0.95 | 1551 |
| social-law | 0.98 | 0.94 | 0.96 | 970 |
| accuracy | 0.96 | 5971 |
| macro-avg | 0.95 | 0.95 | 0.95 | 5971 |
| weighted-avg | 0.96 | 0.96 | 0.96 | 5971 |
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
layout: model
title: Legal Swiss Judgements Classification (French)
author: John Snow Labs
name: legclf_bert_swiss_judgements
date: 2022-10-25
tags: [fr, legal, licensed]
task: Text Classification
language: fr
edition: Spark NLP for Legal 1.0.0
spark_version: 3.0
supported: true
article_header:
type: cover
use_language_switcher: "Python-Scala-Java"
---

## Description

This model is a Bert-based model that can be used to classify Swiss Judgement documents in French language into the following 6 classes according to their case area. It has been trained with SOTA approach.

## Predicted Entities

`public law`, `civil law`, `insurance law`, `social law`, `penal law`, `other`

{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
<button class="button button-orange" disabled>Open in Colab</button>
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/legal/models/legclf_bert_swiss_judgements_fr_1.0.0_3.0_1666710348827.zip){:.button.button-orange.button-orange-trans.arr.button-icon}

## How to use



<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}

```python
document_assembler = nlp.DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")

tokenizer = nlp.Tokenizer()\
.setInputCols(["document"])\
.setOutputCol("token")

clf_model = legal.BertForSequenceClassification.pretrained("legclf_bert_swiss_judgements", "fr", "legal/models")\
.setInputCols(["document", "token"])
.setOutputCol("class")\
.setCaseSensitive(True)\
.setMaxSentenceLength(512)

clf_pipeline = Pipeline(stages=[
document_assembler,
tokenizer,
clf_model
])

model = pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))

data = spark.createDataFrame([["""Résumé : A. X. 1948) et Z. Ils se sont mariés à la xxxx 1992. Le mariage est resté sans enfants. T._ est, cependant, le père des enfants divorcés S._ et T._ (geb. 2004 et 2006). Après la suppression du budget commun, la vie séparée a dû être réglée. Disponible du 17. En décembre 2010, le président de la Cour de justice, Dorneck-Thierstein, a autorisé les époux à se séparer. Dans la mesure où cela est encore important, le juge a obligé le mari, pour l'année 2010 encore Fr. 3'000.-- à payer l'entretien de sa femme (Ziff. 3 ) De même, Z._ a été condamné, X._ à partir de janvier 2011 pour la durée ultérieure de la séparation une contribution de subsistance mensuelle de Fr. 7'085.-- de vous dépenser et de vous payer, en outre, la moitié du bonus net versé à chacun immédiatement après sa destination (Ziff. 4 ) En outre, le président de la Cour a ordonné la séparation des marchandises (Ziff. 5), dispose de la compétition du parti ou Les frais d’avocat (Ziff. 9) et impose les frais judiciaires à la moitié des deux parties (Ziff. 10 ) B. À l’encontre de cette décision, X._ a fait appel à la Cour suprême du canton de Solothurn. Elle a demandé de supprimer les paragraphes 3, 4, 5, 9 et 10 de la décision de première instance, et a présenté les demandes juridiques suivantes: Le mari est tenu de l'engager pour la période à partir de 21. Septembre 2009 à la fin du mois de décembre 2010 une contribution supplémentaire de Fr. 34'400.-- pour rembourser; pour la vie séparée à partir de janvier 2011, elle est dotée d'une contribution de subsistance de Fr. 10'000.-- pour recevoir par mois. La distribution des marchandises est de 21. Déposer en septembre 2010. En conclusion, le conjoint doit payer une contribution de parti raisonnable d'au moins Fr. 6'000.-- et pour payer tous les frais de justice. La Cour suprême du canton de Solothurn a déposé le recours à l'arrêt du 18. en mai 2011. C. À ce titre, X._ (ci-après dénommée « plaignante ») procède à la Cour fédérale. Dans sa plainte du 20. En juin 2011, elle présente la demande, la décision de la Cour suprême du canton Solothurn du 18. annuler en mai 2011 et répéter les demandes légales qu’elle a présentées devant la Cour suprême (cf. Bst. B ) En outre, il demande que la séparation des marchandises soit plus égalitaire par 7. Décembre 2010 à ordonner. Aucune consultation n’a été faite, mais les actes préjudiciels ont été reçus."""]]).toDF("text")

result = model.transform(data)
```

</div>

## Results

```bash
+----------------------------------------------------------------------------------------------------+---------+
| document| class|
+----------------------------------------------------------------------------------------------------+---------+
|Résumé : A. X. 1948) et Z. Ils se sont mariés à la xxxx 1992. Le mariage est resté sans enfants. ...|civil law|
+----------------------------------------------------------------------------------------------------+---------+

```

{:.model-param}
## Model Information

{:.table-model}
|---|---|
|Model Name:|legclf_bert_swiss_judgements|
|Compatibility:|Spark NLP for Legal 1.0.0+|
|License:|Licensed|
|Edition:|Official|
|Input Labels:|[document, token]|
|Output Labels:|[class]|
|Language:|fr|
|Size:|393.6 MB|
|Case sensitive:|true|
|Max sentence length:|512|

## References

Training data is available [here](https://zenodo.org/record/7109926#.Y1gJwexBw8E).

## Benchmarking

```bash
| label | precision | recall | f1-score | support |
|---------------|-----------|--------|----------|---------|
| civil-law | 0.81 | 0.97 | 0.88 | 869 |
| insurance-law | 0.95 | 0.94 | 0.95 | 790 |
| other | 1.00 | 0.40 | 0.57 | 15 |
| penal-law | 0.94 | 0.91 | 0.93 | 1077 |
| public-law | 0.93 | 0.85 | 0.89 | 1259 |
| social-law | 0.94 | 0.95 | 0.95 | 834 |
| accuracy | - | - | 0.91 | 4844 |
| macro-avg | 0.93 | 0.84 | 0.86 | 4844 |
| weighted-avg | 0.92 | 0.91 | 0.91 | 4844 |
```
Loading