stanfordnlp/imdb
Viewer β’ Updated β’ 100k β’ 170k β’ 956
Word-level and BPE tokenisers for English movie reviews, trained with the Hugging Face
tokenizers library on the 50,000 unlabelled reviews
(the unsupervised split) of stanfordnlp/imdb.
They were made for a university NLP project comparing sentiment classifiers on IMDb.
| file | model | vocabulary |
|---|---|---|
word_vs_32000_mf_2.json |
whole words; other words become [UNK] |
32,000 |
bpe_vs_8000_mf_2.json |
BPE (pieces inside a word start with ##) |
8,000 |
bpe_vs_16000_mf_2.json |
BPE | 16,000 |
bpe_vs_32000_mf_2.json |
BPE | 32,000 |
bpe_vs_64000_mf_2.json |
BPE | 64,000 |
mf_2: tokens (word-level) or merges (BPE) seen fewer than 2 times were not added to the vocabulary.
from huggingface_hub import hf_hub_download
from tokenizers import Tokenizer
tokenizer = Tokenizer.from_file(hf_hub_download("stevenmaschan/imdb-tokenizers", "bpe_vs_32000_mf_2.json"))
tokenizer.encode("I didn't like it!!!!!").tokens
# ['i', 'did', "n't", 'like', 'it', '!', '!']
The cleaning is part of each tokeniser, so raw reviews can be passed in directly:
<br />) become spaces.\x96, \x97, \x85, \x91) become -, ... and ';
runs of two or more hyphens become -; curly (β) and acute (Β΄) apostrophes become '.!, ? and . are capped at !!, ?? and ....didn't β did n't, kubrick's β kubrick 's.