def load_data_and_labels(data_file):
    '\n    Loads MR polarity data from files, splits the data into words and generates labels.\n    Returns split sentences and labels.\n    '
    datapoints = load_datapoints(data_file)
    x_text = extract_phrases_in_datapoints(datapoints)
    y = [int(dp.Sentiment) for dp in datapoints]

    def one_hot(i):
        return ((([0] * i) + [1]) + ([0] * (4 - i)))
    y_vector = []
    for sentiment in y:
        y_vector.append(one_hot(sentiment))
    return [x_text, np.array(y_vector)]
Loads MR polarity data from files, splits the data into words and generates labels.
Returns split sentences and labels.
def load_data_and_labels(data_file):
    '\n    Loads MR polarity data from files, splits the data into words and generates labels.\n    Returns split sentences and labels.\n    '
    datapoints = load_datapoints(data_file)
    x_text = extract_phrases_in_datapoints(datapoints)
    y = [int(dp.Sentiment) for dp in datapoints]

    def one_hot(i):
        return ((([0] * i) + [1]) + ([0] * (4 - i)))
    y_vector = []
    for sentiment in y:
        y_vector.append(one_hot(sentiment))
    return [x_text, np.array(y_vector)]