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-distilcamembert 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_distilcamembert","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_distilcamembert
Compatibility: Spark NLP 4.2.7+
License: Open Source
Edition: Official
Input Labels: [sentence]
Output Labels: [bert_sentence]
Language: fr
Size: 256.0 MB
Case sensitive: true
Max sentence length: 128

References

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