()
Train the speller if all data fits into RAM
Train the speller if all data fits into RAM
Train the speller if all data fits into RAM
def train_speller_w_all_data():
    """Train the speller if all data fits into RAM"""
    questions, answers = generate_news_data()
    chars_answer = set.union(*(set(answer) for answer in answers))
    chars_question = set.union(*(set(question) for question in questions))
    chars = list(set.union(chars_answer, chars_question))
    X_train, X_val, y_train, y_val, y_maxlen, ctable = vectorize(questions, answers, chars)
    print ("y_maxlen, chars", y_maxlen, "".join(chars))
    model = generate_model(y_maxlen, chars)
    iterate_training(model, X_train, y_train, X_val, y_val, ctable)
def train_speller_w_all_data ( ) : questions , answers = generate_news_data ( ) chars_answer = set . union ( * ( set ( answer ) for answer in answers ) ) chars_question = set . union ( * ( set ( question ) for question in questions ) ) chars = list ( set . union ( chars_answer , chars_question ) ) X_train , X_val , y_train , y_val , y_maxlen , ctable = vectorize ( questions , answers , chars ) print ( "y_maxlen, chars" , y_maxlen , "" . join ( chars ) ) model = generate_model ( y_maxlen , chars ) iterate_training ( model , X_train , y_train , X_val , y_val , ctable )