Legal NER for NDA (Remedies Clauses)

Description

This is a NER model, aimed to be run only after detecting the REMEDIES clause with a proper classifier (use legmulticlf_mnda_sections_paragraph_other for that purpose). It will extract the following entities: CURRENCY, NUMERIC_REMEDY, and REMEDY_TYPE.

Predicted Entities

CURRENCY, NUMERIC_REMEDY, REMEDY_TYPE

Download Copy S3 URI

How to use

document_assembler = nlp.DocumentAssembler()\
        .setInputCol("text")\
        .setOutputCol("document")
        
sentence_detector = nlp.SentenceDetector()\
        .setInputCols(["document"])\
        .setOutputCol("sentence")

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

embeddings = nlp.RoBertaEmbeddings.pretrained("roberta_embeddings_legal_roberta_base","en") \
        .setInputCols(["sentence", "token"]) \
        .setOutputCol("embeddings")\
        .setMaxSentenceLength(512)\
        .setCaseSensitive(True)

ner_model = legal.NerModel.pretrained("legner_nda_remedies", "en", "legal/models")\
        .setInputCols(["sentence", "token", "embeddings"])\
        .setOutputCol("ner")

ner_converter = nlp.NerConverter()\
        .setInputCols(["sentence", "token", "ner"])\
        .setOutputCol("ner_chunk")

nlpPipeline = nlp.Pipeline(stages=[
        document_assembler,
        sentence_detector,
        tokenizer,
        embeddings,
        ner_model,
        ner_converter])

empty_data = spark.createDataFrame([[""]]).toDF("text")

model = nlpPipeline.fit(empty_data)

text = ["""The breaching party shall pay the non-breaching party liquidated damages of $ 1,000 per day for each day that the breach of this NDA continues."""]

result = model.transform(spark.createDataFrame([text]).toDF("text"))

Results

+------------------+--------------+
|chunk             |ner_label     |
+------------------+--------------+
|liquidated damages|REMEDY_TYPE   |
|$                 |CURRENCY      |
|1,000             |NUMERIC_REMEDY|
+------------------+--------------+

Model Information

Model Name: legner_nda_remedies
Compatibility: Legal NLP 1.0.0+
License: Licensed
Edition: Official
Input Labels: [sentence, token, embeddings]
Output Labels: [ner]
Language: en
Size: 16.3 MB

References

In-house annotations on the Non-disclosure Agreements

Benchmarking

label           precision  recall  f1-score  support 
CURRENCY        1.00       1.00    1.00      11      
NUMERIC_REMEDY  1.00       1.00    1.00      11      
REMEDY_TYPE     0.86       0.94    0.90      32      
micro-avg       0.91       0.96    0.94      54      
macro-avg       0.95       0.98    0.97      54      
weighted-avg    0.92       0.96    0.94      54