Example #1
0
def classify(word):
    if CLASSIFIER is None:
        initialize_classifier()
    
    word = sanitize_input(word)

    word_features = build_unseen_word_features(word)
    word_ints = intify_unseen_word_features(word_features)
    word_enc = encode_features(word_ints)

    predicted_int = []
    for feature in word_enc:
        predicted_phone_int = CLASSIFIER.predict(feature)[0]
        predicted_int.append(predicted_phone_int)
    predicted_phones = [int_to_phone(i) for i in predicted_int]

    return predicted_phones
Example #2
0
def encode_alignments(alignments):
    features, targets = build_features(alignments)
    features_int, targets_int = intify_features(features, targets)
    features_enc = encode_features(features_int)

    return features_enc, targets_int