Description
Given a clause classified as RETURN_OF_CONF_INFO
using the legmulticlf_mnda_sections_paragraph_other
classifier, you can subclassify the sentences as PERPETUITY
or OTHER
from it using the legclf_nda_perpetuity
model.
Predicted Entities
PERPETUITY
, OTHER
How to use
document_assembler = nlp.DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("document")
sentence_embeddings = nlp.UniversalSentenceEncoder.pretrained()\
.setInputCols("document")\
.setOutputCol("sentence_embeddings")
classifier = legal.ClassifierDLModel.pretrained("legclf_nda_perpetuity", "en", "legal/models")\
.setInputCols(["sentence_embeddings"])\
.setOutputCol("category")
nlpPipeline = nlp.Pipeline(stages=[
document_assembler,
sentence_embeddings,
classifier
])
empty_data = spark.createDataFrame([[""]]).toDF("text")
model = nlpPipeline.fit(empty_data)
text_list = ["""Notwithstanding the return or destruction of all Evaluation Material, you or your Representatives shall continue to be bound by your obligations of confidentiality and other obligations hereunder.""",
"""There are no intended third party beneficiaries to this Agreement."""]
df = spark.createDataFrame(pd.DataFrame({"text" : text_list}))
result = model.transform(df)
Results
+--------------------------------------------------------------------------------+----------+
| text| class|
+--------------------------------------------------------------------------------+----------+
|Notwithstanding the return or destruction of all Evaluation Material, you or ...|PERPETUITY|
| There are no intended third-party beneficiaries to this Agreement.| OTHER|
+--------------------------------------------------------------------------------+----------+
Model Information
Model Name: | legclf_nda_perpetuity |
Compatibility: | Legal NLP 1.0.0+ |
License: | Licensed |
Edition: | Official |
Input Labels: | [sentence_embeddings] |
Output Labels: | [class] |
Language: | en |
Size: | 22.5 MB |
References
In-house annotations on the Non-disclosure Agreements
Benchmarking
label precision recall f1-score support
OTHER 0.87 1.00 0.93 13
PERPETUITY 1.00 0.86 0.92 14
accuracy - - 0.93 27
macro-avg 0.93 0.93 0.93 27
weighted-avg 0.94 0.93 0.93 27