def myFun(model_answer, answer, out_of): # for Keywords if (len(answer.split())) <= 5: return 0 k = keywordVal.givKeywordsValue(model_answer, answer) # for Grammer req = requests.get("https://api.textgears.com/check.php?text=" + answer + "&key=JmcxHCCPZ7jfXLF6") no_of_errors = len(req.json()['errors']) if no_of_errors > 5 or k == 6: g = 0 else: g = 1 # for Question Specific Tags q = math.ceil(fuzz.token_set_ratio(model_answer, answer) * 6 / 100) print("Keywords : ", k) print("Grammar : ", g) print("QST : ", q) predicted = nav_test.predict(k, g, q) result = predicted * out_of / 10 return result[0]
def givVal(model_answer, keywords, answer, out_of): # KEYWORDS =>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # TODO : Enhacnce this thing if (len(answer.split())) <= 5: return 0 # # count = 0 # keywords_count = len(keywords) # for i in range(keywords_count): # if keywords[i] in answer: # # print (keywords[i]) # count = count + 1 # k = 0 # if count == keywords_count: # k = 1 # elif count == (keywords_count - 1): # k = 2 # elif count == (keywords_count - 2): # k = 3 # elif count == (keywords_count - 3): # k = 4 # elif count == (keywords_count - 4): # k = 5 # elif count == (keywords_count - 5): # k = 6 k = keywordVal.givKeywordsValue(model_answer, answer) # print("checkkkkkk", k) # GRAMMAR =>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> req = requests.get("https://api.textgears.com/check.php?text=" + answer + "&key=JmcxHCCPZ7jfXLF6") no_of_errors = len(req.json()['errors']) if no_of_errors > 5 or k == 6: g = 0 else: g = 1 # QST =>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # print("fuzz1 ratio: ", fuzz.ratio(model_answer, answer)) q = math.ceil(fuzz.token_set_ratio(model_answer, answer) * 6 / 100) print("Keywords : ", k) print("Grammar : ", g) print("QST : ", q) predicted = nav_test.predict(k, g, q) # Mathematical model-> # predicted / 10 # what? / out_of result = predicted * out_of / 10 return result[0]
def myFun(model_answer, answer, para): # KEYWORDS =>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # TODO : Enhance this thing ka, f = keywordVal.givKeywordsValue(model_answer, answer) # GRAMMAR =>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> cosine = ka * 100 kval = 0 if cosine > 90: kval = 1 elif cosine > 80: kval = 2 elif cosine > 60: kval = 3 elif cosine > 40: kval = 4 elif cosine > 20: kval = 5 else: kval = 6 if para > 5 or kval == 6: g = 0 else: g = 1 # QST =>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> qa = math.ceil(fuzz.token_set_ratio(model_answer, answer)) if qa > 90: q = 1 elif qa > 80: q = 2 elif qa > 60: q = 3 elif qa > 40: q = 4 elif qa > 20: q = 5 else: q = 6 print("Keywords : ", kval) print("Grammar : ", g) print("QST : ", q) predicted = nav_test.predict(kval, g, q) print(predicted) return predicted