Portuguese Legal BERT Embedding Base Cased model

Description

Pretrained BERT Embedding model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. Legal-BERTimbau-base is a Portuguese model originally trained by rufimelo.

Download Copy S3 URI

How to use

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

tokenizer = Tokenizer() \
    .setInputCols("document") \
    .setOutputCol("token")
  
embeddings = BertEmbeddings.pretrained("bert_embeddings_Legal_BERTimbau_base","pt") \
    .setInputCols(["document", "token"]) \
    .setOutputCol("embeddings")
    
pipeline = Pipeline(stages=[documentAssembler, tokenizer, embeddings])

data = spark.createDataFrame([["Eu amo Spark NLP"]]).toDF("text")

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

Model Information

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

References

  • https://huggingface.co/rufimelo/Legal-BERTimbau-base
  • https://github.com/neuralmind-ai/portuguese-bert/