French Legal CamemBERT Embedding Cased model

Description

Pretrained CamemBERT Embedding model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. legal-camembert is a French model originally trained by maastrichtlawtech.

Download Copy S3 URI

How to use

documentAssembler = DocumentAssembler() \
    .setInputCol("text") \
    .setOutputCol("document")

tokenizer = Tokenizer() \
    .setInputCols("document") \
    .setOutputCol("token")
  
embeddings = CamemBertEmbeddings.pretrained("camembert_embeddings_legal_camembert","fr") \
    .setInputCols(["document", "token"]) \
    .setOutputCol("embeddings")
    
pipeline = Pipeline(stages=[documentAssembler, tokenizer, embeddings])

data = spark.createDataFrame([["J'adore Spark NLP"]]).toDF("text")

result = pipeline.fit(data).transform(data)

Model Information

Model Name: camembert_embeddings_legal_camembert
Compatibility: Spark NLP 4.2.7+
License: Open Source
Edition: Official
Input Labels: [sentence]
Output Labels: [bert_sentence]
Language: fr
Size: 415.6 MB
Case sensitive: true
Max sentence length: 128

References

  • https://huggingface.co/maastrichtlawtech/legal-camembert
  • https://antoinelouis.co
  • https://www.maastrichtuniversity.nl/about-um/faculties/law/research/law-and-tech-lab