Spanish Electra Legal Word Embeddings Small model

Description

Pretrained Spanish Legal Word Embeddings model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. legalectra-small-spanish is a English model originally trained by mrm8488.

Predicted Entities

Download Copy S3 URI

How to use

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

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

data = spark.createDataFrame([["Amo a Spark NLP."]]).toDF("text")

result = pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler() 
      .setInputCol("text") 
      .setOutputCol("document")
 
val tokenizer = new Tokenizer() 
    .setInputCols(Array("document"))
    .setOutputCol("token")

val electra = BertEmbeddings.pretrained("legalectra_small","es") 
    .setInputCols(Array("document", "token")) 
    .setOutputCol("class")

val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer, electra))

val data = Seq("Amo a Spark NLP.").toDS.toDF("text")

val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("es.embed.bert.small_legal").predict("""Amo a Spark NLP.""")

Model Information

Model Name: legalectra_small
Compatibility: Spark NLP 5.0.0+
License: Open Source
Edition: Official
Input Labels: [sentence, token]
Output Labels: [bert]
Language: es
Size: 51.2 MB
Case sensitive: true