794bd558da80b65713b51a964ec61e7ef36d4bf2,examples/intent_extraction/interactive.py,,,#,34
Before Change
print("dataset_path does not exist")
sys.exit(0)
if args.embedding_model is not None and not os.path.exists(args.embedding_model):
print("word embedding model file was not found")
sys.exit(0)
model = IntentExtractionModel()
model.load(args.model_path)
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)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
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: pyprob/pyprob
Commit Name: 2728afcd57721b34f95ba575507a3db6c86c1f4c
Time: 2018-02-21
Author: atilimgunes.baydin@gmail.com
File Name: tests/test_model_remote.py
Class Name:
Method Name:
Project Name: okfn-brasil/serenata-de-amor
Commit Name: 3baf62ba607a95dcb0d5971594389d3586286ef6
Time: 2016-12-06
Author: andresouzapinho@gmail.com
File Name: src/fetch_foursquare_info.py
Class Name:
Method Name: