Legal NLP 1.1.0 for Spark NLP has been released

Bunyamin Polat
spark-nlp
Published in
3 min readOct 28, 2022
ERNIE and BERT interpreting some legal texts

We are happy to welcome the new 1.1.0 version of Legal NLP, including 25 new models and the following new capabilities.

New Legal Longformer Embeddings

  • legal_longformer_base: Process up to 4096 tokens-long legal texts and carry out, for example, Legal Document Classification.

New Models

Document Classification

We release our first 8 document classification models at long text level (not paragraph level as clause identification). These models are based on the Longformer embeddings described above, and are just the beginning of a planned series of several hundred models to come in the next releases.

You can check the demo here.

Documents can often be of a mixed type. As these models are binary classifiers, you can plug in as many models as you want in a pipeline to check if the class is triggered or not. Many times, as in this Credit Agreement example, the model returning a positive signal will only be legclf_credit_agreement

Only “credit_agreement” being triggered as TRUE from all the 8 models included

However, mixed documents may ocur, as purchase with loans:

2 models returning TRUE on the same document for being multilabel

These are the models included in 1.1.0:

  • legclf_employment_agreement: Binary classification: is the document similar to an Employment Agreement?
  • legclf_consulting_agreement: Binary classification: is the document similar to a Consulting Agreement?
  • legclf_purchase_agreement: Binary classification: is the document similar to a Purchase Agreement?
  • legclf_service_agreement: Binary classification: is the document similar to a Service Agreement?
  • legclf_credit_agreement: Binary classification: is the document similar to a Credit Agreement?
  • legclf_management_contract: Binary classification: is the document similar to a Management Contract?
  • legclf_loan_agreement: Binary classification: is the document similar to a Loan Agreement?
  • legclf_lease_agreement: Binary classification: is the document similar to a Lease Agreement?

Text classification: Swiss judgements in 4 languages

Four legclf_bert_swiss_judgements models available in English, German, French and Italian to classify if a document is about Civil Law, Insurance Law, Public Law, Social Law, Penal Law or other.

Demo here.

Clause Classification

This models work on chunks of text of a size of paragraph or small sections, so don’t forget to carry out Document Splitting as shown in this notebook.

  • legclf_cuad_warranty_clause: Detect if a paragraph / section talks about warranties.
  • legclf_cuad_indemnifications_clause: Detect if a paragraph / section talks about indemnifications.
  • legclf_cuad_confidentiality_clause: Detect if a paragraph / section is a confidentiality clause.
  • legclf_cuad_licenses_clause: Detect if a paragraph / section talks about licenses.

Name Entity Recognition and Relation Extraction

  • Detect Subject (who?), Action (verb), Object (what?) and Indirect Object, if exists (to whom?) for warranties, indemnification, and confidentiality clauses ( legner_confidentiality , legner_warranty , legner_bert_indemnifications )
  • Detect the relations between those entities (legre_confidentiality , legre_warranty , legre_indemnifications )

Judgements NER (Indian Court, English)

  • legner_indian_court_judgement: Model to detect entities in English from Indian Judgements: Lawyer, Judge, Date, GPE, Witness, Court, Case Number…, etc.
  • legner_indian_court_preamble: Model to detect entities in English from Indian Judgements: Court, Lawyer, Petitioner, Respondent.

Demo here.

Three new demos

Support for AWS, Azure and Databricks

Legal NLP on AWS, Azure or Databricks

All Legal NLP notebooks can be run in AWS, Azure and Databricks. If you use our ready to use versions of Spark NLP in AWS, Azure or Databricks, please find the notebooks here.

If you are running on Google Colab, our notebooks are here.

Want to see more?

How to install

!pip install johnsnowlabsfrom johnsnowlabs import *
jsl.install(json_license_path=[your_finance_license_path])
jsl.start(json_license_path=[your_finance_license_path])

Do you want to request a free trial?

Go to our self-service installation page here and request a trial. Write to support@johnnsnowlabs.com if you have enquiries, or find us at our Slack Channel (#legal)

--

--