Understanding Restriction Level of Assignment Clauses(Bert)

Description

Given a clause classified as ASSIGNMENT using the legmulticlf_mnda_sections_paragraph_other classifier, you can subclassify the sentences as PERMISSIVE_ASSIGNMENT, RESTRICTIVE_ASSIGNMENT or OTHER from it using the legclf_nda_assigments_bert model. It has been trained with the SOTA approach.

Predicted Entities

PERMISSIVE_ASSIGNMENT, RESTRICTIVE_ASSIGNMENT, OTHER

Download Copy S3 URI

How to use

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

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

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

clf_pipeline = nlp.Pipeline(stages=[
    document_assembler, 
    tokenizer,
    sequence_classifier    
])

empty_df = spark.createDataFrame([['']]).toDF("text")

model = clf_pipeline.fit(empty_df)

text_list = [
"""This Agreement will be binding upon and inure to the benefit of each Party and its respective heirs, successors and assigns""",
"""All notices and other communications provided for in this Agreement and the other Loan Documents shall be in writing and may (subject to paragraph (b) below) be telecopied (faxed), mailed by certified mail return receipt requested, or delivered by hand or overnight courier service to the intended recipient at the addresses specified below or at such other address as shall be designated by any party listed below in a notice to the other parties listed below given in accordance with this Section.""",
"""This Agreement is a personal contract for XCorp, and the rights and interests of XCorp hereunder may not be sold, transferred, assigned, pledged or hypothecated except as otherwise expressly permitted by the Company"""
]

df = spark.createDataFrame(pd.DataFrame({"text" : text_list}))

result = model.transform(df)

Results

+--------------------------------------------------------------------------------+----------------------+
|                                                                            text|                 class|
+--------------------------------------------------------------------------------+----------------------+
|This Agreement will be binding upon and inure to the benefit of each Party an...| PERMISSIVE_ASSIGNMENT|
|All notices and other communications provided for in this Agreement and the o...|                 OTHER|
|This Agreement is a personal contract for XCorp, and the rights and interests...|RESTRICTIVE_ASSIGNMENT|
+--------------------------------------------------------------------------------+----------------------+

Model Information

Model Name: legclf_nda_assigments_bert
Compatibility: Legal NLP 1.0.0+
License: Licensed
Edition: Official
Input Labels: [document, token]
Output Labels: [class]
Language: en
Size: 406.4 MB
Case sensitive: true
Max sentence length: 512

Sample text from the training dataset

In-house annotations on the Non-disclosure Agreements

Benchmarking

label                   precision  recall  f1-score  support 
OTHER                   0.98       1.00    0.99      124     
PERMISSIVE_ASSIGNMENT   1.00       0.93    0.97      15      
RESTRICTIVE_ASSIGNMENT  1.00       0.96    0.98      25      
accuracy                -          -       0.99      164     
macro avg               0.99       0.96    0.98      164     
weighted avg            0.99       0.99    0.99      164