<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_labels_encoder(self, data_dir):
 """Builds encoder for the given class labels. Args: data_dir: data directory Returns: An encoder for class labels. """

    label_filepath = os.path.join(data_dir, self.vocab_filename)
    return text_encoder.TokenTextEncoder(label_filepath)