shakespeare#
Module Contents#
- class ShakespeareDataset(client_id: int, client_str: str, data: list, targets: list)#
Bases:
torch.utils.data.Dataset
- _build_vocab()#
according all letters to build vocab Vocabulary re-used from the Federated Learning for Text Generation tutorial. https://www.tensorflow.org/federated/tutorials/federated_learning_for_text_generation :returns: all letters vocabulary list and length of vocab list
- _process_data_target()#
process client’s data and target
- __sentence_to_indices(sentence: str)#
Returns list of integer for character indices in ALL_LETTERS :param sentence: input sentence :type sentence: str
Returns: a integer list of character indices
- __letter_to_index(letter: str)#
Returns index in ALL_LETTERS of given letter :param letter: input letter :type letter: char/str[0]
Returns: int index of input letter
- __len__()#
- __getitem__(index)#