コード例 #1
0
def search():
    form = LoginForm()
    #form.username.data= 7536970
    if request.method == 'POST':
        acptcrt = clean_text(getacptnccriteria(str(
            form.username.data))).replace("given",
                                          "").replace("when",
                                                      "").replace("user", "")
        result = findsimilartc(acptcrt)
        tc_ids = result[0]
        accuracy = result[1]
        to_be_rendered = list(zip(tc_ids, accuracy))
    if request.method == 'GET':
        acptcrt = clean_text(getacptnccriteria(str(USERSTRYID))).replace(
            "given", "").replace("when", "").replace("user", "")
        result = findsimilartc(acptcrt)
        tc_ids = result[0]
        accuracy = result[1]
        to_be_rendered = list(zip(tc_ids, accuracy))
    # if form.validate_on_submit():
    #     acptcrt = clean_text(getacptnccriteria(str(form.username.data))).replace("given", "").replace("when","").replace("user", "")

    # return render_template('homechart.html', title='Sign In', form=form, tc_ids=tc_ids)
    #return render_template('home.html', title='Sign In', form=form, tc_ids=tc_ids, accuracy=accuracy)
    return render_template('home.html',
                           title='Sign In',
                           form=form,
                           result=to_be_rendered)
コード例 #2
0
ファイル: app.py プロジェクト: samuelhepner/tagger-ds
def personal():
    data = request.get_json()
    uid = data['id']
    sender = data['sender']
    subject = data['subject']
    message = data['message']
    text = sender + ' ' + subject + ' ' + message
    text_clean = clean_text(text)
    text_vect = personal_vect.transform([text_clean])
    predict = personal_model.predict(text_vect)
    print(predict[0])
    email = {
        'message-id': uid,
        'from': sender,
        'subject': subject,
        'message': message,
        'personal': predict.tolist()
    }

    return jsonify(email)
コード例 #3
0
def hello_world(id):
    id = int(id)
    acptcrt = clean_text(getacptnccriteria(id)).replace("give", "").replace(
        "when", "").replace("user", "")
    return jsonify({"test_case_ids": findsimilartcwitacc(acptcrt)})
コード例 #4
0
#basic1 is dsa model
model.save("dellcom.model")
# print("Model Saved")

model = Doc2Vec.load("dellcom.model")

# to find the vector of a document which is not in training data
# test_data = word_tokenize(acptcrtlst[0].lower())
# v1 = model.infer_vector(test_data)
# print("V1_infer", v1)

# to find most similar doc using tags
# similar_doc = model.docvecs.most_similar('1')
# print(similar_doc)
print(acptcrtlst[0])
tokens = [clean_text(str(acptcrtlst[0]))]
print(listToString(tokens))
# tokens = tokens.remove("Given")

new_vector = model.infer_vector(listToString(tokens).split())
# sims = model.docvecs.most_similar([new_vector])
# print(sims)
most_similar_docs = []
# for d in model.docvecs.most_similar([new_vector]):
#     print(int(d[0]))
#     most_similar_docs.append(coupleddata[d[0]])
MOST_SIMILAR_TCS =model.docvecs.most_similar([new_vector])

similar_tcs = [tc_tuple[0] for tc_tuple in MOST_SIMILAR_TCS]
for item in similar_tcs:
    print(item+"===="+tfsconnect.getworkitemtitle(item))