Vocabs

Vocabulary

class kospeech.vocabs.__init__.Vocabulary(*args, **kwargs)[source]

Note

Do not use this class directly, use one of the sub classes.

KsponSpeechVocabulary

class kospeech.vocabs.ksponspeech.KsponSpeechVocabulary(vocab_path, output_unit: str = 'character', sp_model_path=None)[source]
label_to_string(labels)[source]

Converts label to string (number => Hangeul)

Parameters

labels (numpy.ndarray) – number label

Returns: sentence
  • sentence (str or list): symbol of labels

load_vocab(label_path, encoding='utf-8')[source]

Provides char2id, id2char

Parameters
  • label_path (str) – csv file with character labels

  • encoding (str) – encoding method

Returns: unit2id, id2unit
  • unit2id (dict): unit2id[unit] = id

  • id2unit (dict): id2unit[id] = unit

LibriSpeechVocabulary

class kospeech.vocabs.librispeech.LibriSpeechVocabulary(vocab_path, model_path)[source]