The latest version of Legal NLP comes with a new classification model on Law Stack Exchange questions and Named-Entity Recognition on Subpoenas.
Law Stack Exchange Classifier
This new model is a text classifier trained on the Law Stack Exchange dataset. It can predict the topic of the question into one of the pre-selected law-related categories:
- constitutional law
- contract law
- criminal law
- tax law
Please note that some categories from the original data were removed (e.g., “internet”) due to limited examples. To use the model, simply download it from Spark NLP Models Hub on your pipeline:
sequenceClassifier = ( legal.BertForSequenceClassification.pretrained( "legclf_law_stack_exchange", "en", "legal/models" ) .setInputCols(["document", "token"]) .setOutputCol("class") )
With the model, questions can be categorized. For example, the following text is categorized by the model as belonging to the
I have been helping a nonprofit by developing a piece of software that they needed. The software is more-or-less built to their specs in a ‘functional’ way, but I wrote 100% of the code: they are not programmers. Anyhow, we didn’t make any kind of contract at the beginning verbally or otherwise. Who owns the copyright to all of this? Do they have any rights to it at all for providing ‘ideas’?
This model is trained on an in-house dataset to identify entities in Subpoena documents. The list of entities that the model can identify is the following:
To use the model, you can simply download it from Spark NLP Models Hub in your pipeline:
ner = legal.NerModel.pretrained()
Then it can be used to identify the entities in new subpoena documents.
We’ve got 30-days free licenses for you with technical support from our legal team of technical and SME. This trial includes complete access to more than 926 models, including Classification, NER, Relation Extraction, Similarity Search, Summarization, Sentiment Analysis, Question Answering, etc. and 120+ legal language models.
Just go to https://www.johnsnowlabs.com/install/ and follow the instructions!
How to run
Legal NLP is extremely easy to run on both clusters and driver-only environments using
! pip install johnsnowlabs
from johnsnowlabs import nlp nlp.install(force_browser=True)
# Start Spark Session spark = nlp.start() # Import the Legal NLP module from johnsnowlabs import legal
For alternative installation methods of how to install in specific environments, please check the docs.