CoolFace
Modelpublic

nilc-nlp/word2vec-cbow-100d

sourceHugging Facecc-by-4.0updated 1y agoView on Hugging Face
0likes
Model Card

NILC Portuguese Word Embeddings — Word2Vec CBOW 100d

This repository contains the Word2Vec CBOW 100d model in safetensors format.

About

NILC-Embeddings is a repository for storing and sharing word embeddings for the Portuguese language. The goal is to provide ready-to-use vector resources for Natural Language Processing (NLP) and Machine Learning tasks.

The embeddings were trained on a large Portuguese corpus (Brazilian + European), composed of 17 corpora (~1.39B tokens). Training was carried out with the following algorithms: Word2Vec, FastText, Wang2Vec, and GloVe.


📂 Files

  • embeddings.safetensors → embedding matrix ([vocab_size, 100])
  • vocab.txt → vocabulary (one token per line, aligned with rows)

🚀 Usage

python
from huggingface_hub import hf_hub_download
from safetensors.numpy import load_file

path = hf_hub_download(repo_id="nilc-nlp/word2vec-cbow-100d",
                       filename="embeddings.safetensors")

data = load_file(path)
vectors = data["embeddings"]

vocab_path = hf_hub_download(repo_id="nilc-nlp/word2vec-cbow-100d",
                             filename="vocab.txt")
with open(vocab_path) as f:
    vocab = [w.strip() for w in f]

print(vectors.shape)

Or in PyTorch:

python
from safetensors.torch import load_file
tensors = load_file("embeddings.safetensors")
vectors = tensors["embeddings"]  # torch.Tensor

📊 Corpus

The embeddings were trained on a combination of 17 corpora (~1.39B tokens):

CorpusTokensTypesGenreDescription
LX-Corpus [Rodrigues et al. 2016]714,286,6382,605,393Mixed genresLarge collection of texts from 19 sources, mostly European Portuguese
Wikipedia219,293,0031,758,191EncyclopedicWikipedia dump (2016-10-20)
GoogleNews160,396,456664,320InformativeNews crawled from Google News
SubIMDB-PT129,975,149500,302SpokenMovie subtitles from IMDb
G1105,341,070392,635InformativeNews from G1 portal (2014–2015)
PLN-Br [Bruckschen et al. 2008]31,196,395259,762InformativeCorpus of PLN-BR project (1994–2005)
Domínio Público23,750,521381,697Prose138,268 literary works
Lacio-Web [Aluísio et al. 2003]8,962,718196,077MixedLiterary, informative, scientific, law, didactic texts
Literatura Brasileira1,299,00866,706ProseClassical Brazilian fiction e-books
Mundo Estranho1,047,10855,000InformativeTexts from Mundo Estranho magazine
CHC941,03236,522InformativeTexts from Ciência Hoje das Crianças
FAPESP499,00831,746Science communicationTexts from Pesquisa FAPESP magazine
Textbooks96,20911,597DidacticElementary school textbooks
Folhinha73,5759,207InformativeChildren’s news from Folhinha (Folha de São Paulo)
NILC subcorpus32,8684,064InformativeChildren’s texts (3rd–4th grade)
Para Seu Filho Ler21,2243,942InformativeChildren’s news from Zero Hora
SARESP13,3083,293DidacticSchool evaluation texts
Total1,395,926,2823,827,725

📖 Paper

Portuguese Word Embeddings: Evaluating on Word Analogies and Natural Language Tasks Hartmann, N. et al. (2017), STIL 2017. ArXiv Paper

BibTeX

bibtex
@inproceedings{hartmann-etal-2017-portuguese,
  title        = {{P}ortuguese Word Embeddings: Evaluating on Word Analogies and Natural Language Tasks},
  author       = {Hartmann, Nathan  and Fonseca, Erick  and Shulby, Christopher  and Treviso, Marcos  and Silva, J{'e}ssica  and Alu{'i}sio, Sandra},
  year         = 2017,
  month        = oct,
  booktitle    = {Proceedings of the 11th {B}razilian Symposium in Information and Human Language Technology},
  publisher    = {Sociedade Brasileira de Computa{\c{c}}{\~a}o},
  address      = {Uberl{\^a}ndia, Brazil},
  pages        = {122--131},
  url          = {https://aclanthology.org/W17-6615/},
  editor       = {Paetzold, Gustavo Henrique  and Pinheiro, Vl{'a}dia}
}

📜 License

Creative Commons Attribution 4.0 International (CC BY 4.0)