paddlespeech.t2s.frontend.vocab module

class paddlespeech.t2s.frontend.vocab.Vocab(symbols: Iterable[str], padding_symbol='<pad>', unk_symbol='<unk>', start_symbol='<s>', end_symbol='</s>')[source]

Bases: object

Vocabulary.

Args:

symbols (Iterable[str]): Common symbols. padding_symbol (str, optional): Symbol for pad. Defaults to "<pad>". unk_symbol (str, optional): Symbol for unknow. Defaults to "<unk>" start_symbol (str, optional): Symbol for start. Defaults to "<s>" end_symbol (str, optional): Symbol for end. Defaults to "</s>"

Attributes:
end_index

The index of end symbol.

num_specials

The number of special symbols.

padding_index

The index of padding symbol

start_index

The index of start symbol.

unk_index

The index of unknow symbol.

Methods

add_symbol(symbol)

Add a new symbol in vocab.

add_symbols(symbols)

Add multiple symbols in vocab.

lookup(symbol)

The index that symbol correspond.

reverse(index)

The symbol thar index cottespond.

add_symbol(symbol)[source]

Add a new symbol in vocab.

add_symbols(symbols)[source]

Add multiple symbols in vocab.

property end_index

The index of end symbol.

lookup(symbol)[source]

The index that symbol correspond.

property num_specials

The number of special symbols.

property padding_index

The index of padding symbol

reverse(index)[source]

The symbol thar index cottespond.

property start_index

The index of start symbol.

property unk_index

The index of unknow symbol.