794bd558da80b65713b51a964ec61e7ef36d4bf2,examples/intent_extraction/interactive.py,,,#,34

Before Change


args = parser.parse_args()

if not os.path.exists(args.model_path):
    print("model_path does not exist")
    sys.exit(0)
if not os.path.exists(args.dataset_path):
    print("dataset_path does not exist")
    sys.exit(0)

After Change


    print(" ".join(["%-{}s".format(x[2]) % x[1] for x in print_helper]))


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--model_path", type=validate_existing_filepath, required=True,
                        help="Model file path")
    parser.add_argument("--dataset_path", type=validate_existing_directory, required=True,
                        help="dataset directory")
    parser.add_argument("--embedding_model", type=validate_existing_filepath,
                        help="Path to word embedding model")
    parser.add_argument("--embedding_size", type=int,
                        help="Word embedding model vector size")
    args = parser.parse_args()
    if args.embedding_size is not None:
        validate((args.embedding_size, int, 1, 10000))

    model = IntentExtractionModel()
    model.load(args.model_path)

    ds = SNIPS(path=args.dataset_path)
    nlp = SpacyInstance(disable=["tagger", "ner", "parser", "vectors", "textcat"])

    emb_vectors = None
    if args.embedding_model is not None:
        print("Loading external word embedding model")
        emb_vectors, emb_size = load_word_embeddings(args.embedding_model)

    while True:
        text = input(">> ")
        tokens = process_text(text)
        enc_sent = encode_sentence(tokens, emb_vectors)
        predictions = model.predict(enc_sent)
        display_results(tokens, predictions)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: NervanaSystems/nlp-architect
Commit Name: 794bd558da80b65713b51a964ec61e7ef36d4bf2
Time: 2018-05-14
Author: peteriz@users.noreply.github.com
File Name: examples/intent_extraction/interactive.py
Class Name:
Method Name:


Project Name: NervanaSystems/nlp-architect
Commit Name: e998834136c5074583f528b7422c56ab57009c1f
Time: 2018-05-09
Author: peter.izsak@intel.com
File Name: nlp_architect/utils/text.py
Class Name: SpacyTokenizer
Method Name: __init__


Project Name: ClimbsRocks/auto_ml
Commit Name: b1756fd255d0f921cd30537d55d0dfb2a6c8ad32
Time: 2017-04-17
Author: ClimbsBytes@gmail.com
File Name: auto_ml/utils_models.py
Class Name:
Method Name: load_ml_model