Legal Applicable Law Clause Binary Classifier

Description

This model is a Binary Classifier (True, False) for the applicable-law clause type. To use this model, make sure you provide enough context as an input. Adding Sentence Splitters to the pipeline will make the model see only sentences, not the whole text, so it’s better to skip it, unless you want to do Binary Classification as sentence level. If you have big legal documents, and you want to look for clauses, we recommend you to split the documents using any of the techniques available in our Spark NLP for Legal Workshop Tokenization & Splitting Tutorial (link here), namely:

  • Paragraph splitting (by multiline);
  • Splitting by headers / subheaders;
  • etc. Take into consideration the embeddings of this model allows up to 512 tokens. If you have more than that, consider splitting in smaller pieces (you can also check the same tutorial link provided above).

This model can be combined with any of the other “hundreds” of Legal Clauses Classifiers you will find in Models Hub, getting as an output a series of True/False values for each of the legal clause model you have added.

Predicted Entities

applicable-law, other

Copy S3 URI

How to use


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

embeddings = nlp.BertSentenceEmbeddings.pretrained("sent_bert_base_cased", "en")\
    .setInputCols("document")\
    .setOutputCol("sentence_embeddings")

doc_classifier = legal.ClassifierDLModel.pretrained("legclf_applicable_law_clause", "en", "legal/models")\
    .setInputCols(["sentence_embeddings"])\
    .setOutputCol("category")

nlpPipeline = nlp.Pipeline(stages=[
    document_assembler, 
    embeddings,
    doc_classifier])

df = spark.createDataFrame([["YOUR TEXT HERE"]]).toDF("text")

model = nlpPipeline.fit(df)

result = model.transform(df)

Results


+-------+
|result|
+-------+
|[applicable-law]|
|[other]|
|[other]|
|[applicable-law]|

Model Information

Model Name: legclf_applicable_law_clause
Compatibility: Legal NLP 1.0.0+
License: Licensed
Edition: Official
Input Labels: [sentence_embeddings]
Output Labels: [class]
Language: en
Size: 22.8 MB

References

Legal documents, scrapped from the Internet, and classified in-house + SEC documents + Lawinsider categorization

Benchmarking


          label    precision    recall    f1-score    support 
 applicable-law         1.00      1.00      1.00         28 
          other         1.00      1.00      1.00         39 
       accuracy            -         -      1.00         67 
      macro-avg         1.00      1.00      1.00         67 
   weighted-avg         1.00      1.00      1.00         67