Hebrew Legal BERT Embedding Cased model (Cased)

Description

Pretrained BERT Embedding model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. Legal-heBERT_ft is a Hebrew model originally trained by avichr.

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_heBERT_ft","he") \
    .setInputCols(["document", "token"]) \
    .setOutputCol("embeddings")
    
pipeline = Pipeline(stages=[documentAssembler, tokenizer, embeddings])

data = spark.createDataFrame([["אני אוהב את Spark NLP"]]).toDF("text")

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

Model Information

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

References

  • https://huggingface.co/avichr/Legal-heBERT_ft
  • https://github.com/avichaychriqui/HeBERT
  • https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4147127
  • https://arxiv.org/abs/1911.03090
  • https://arxiv.org/abs/2010.02559