data.vocab_data

class pytrial.data.vocab_data.Vocab[source]
add_sentence(sentence)[source]

Add a list of words to the vocabulary. If one word is in the vocab, then ignore it. Otherwise, add it to the vocab.

Parameters

sentence (list[str]) – A list of words.

property vocab

The vocabulary where key is the index and value is the word.

Returns

vocab

Return type

dict[int, str]

property words

All the words in the vocab.

Returns

words

Return type

list[str]