diff --git a/Model/app.py b/Model/app.py index dc16f80..05d556b 100644 --- a/Model/app.py +++ b/Model/app.py @@ -7,6 +7,7 @@ from spellCheck import pusan_univ_spell from lenCheck import countCheck from ExpressCheck import Express, ExpressShort +from calculateCheck import calculate_score, calculate_score53 app = Flask(__name__) #상태 알아보기2 cors = CORS(app, resources={r"*": {"origins": "https://port-0-docker-essay-score-jvvy2blm7ipnj3.sel5.cloudtype.app"}}) @@ -15,45 +16,7 @@ @app.route("/", methods=['GET', 'POST']) def index(): return render_template('./index.html') - -#점수 계산 함수 -def calculate_score53(sim, sp, le, ex): - #53번 기준 30점 - #유사도 22점, 맞춤법 5점, 글자 수 2점, 표현 점수 1점 - if sim > 1: - sim = 1 - sp_score = 5 - (0.2 * sp) - if sp_score < 0: - sp_score = 0 - if ex >= 3: - ex_score = 1 - elif ex> 0: - ex_score = 0.5 - else: - ex_score = 0 - result = round(22*(1-sim),2) + sp_score + le + ex_score - return result -def calculate_score(num, sim, sp, ex): - if sim > 1: - sim = 1 - #51번 - if num == 51: - #print('51번 채점중') - if sp!= 0: - result = round(3 - sim*3,2) + round(1/sp,2) + ex * 1 - else: - result = round(3 - sim*3,2) + 1.00 + ex * 1 - - #52번 - elif num == 52: - #print('52번 채점') - if sp!= 0: - result = round(3 - sim*3,2) + round(1.5/sp,2)+ 0.5 * ex - else: - result = round(3 - sim*3,2) + 1.5+ 0.5 * ex - - return result @app.route('/main' , methods=['POST']) def get_score(): diff --git a/Model/calculateCheck.py b/Model/calculateCheck.py new file mode 100644 index 0000000..9adb632 --- /dev/null +++ b/Model/calculateCheck.py @@ -0,0 +1,38 @@ +#점수 계산 함수 +def calculate_score53(sim, sp, le, ex): + #53번 기준 30점 + #유사도 22점, 맞춤법 5점, 글자 수 2점, 표현 점수 1점 + if sim > 1: + sim = 1 + sp_score = 5 - (0.2 * sp) + if sp_score < 0: + sp_score = 0 + if ex >= 3: + ex_score = 1 + elif ex> 0: + ex_score = 0.5 + else: + ex_score = 0 + result = round(22*(1-sim),2) + sp_score + le + ex_score + return result +def calculate_score(num, sim, sp, ex): + if sim > 1: + sim = 1 + #51번 + if num == 51: + #print('51번 채점중') + if sp!= 0: + result = round(3 - sim*3,2) + round(1/sp,2) + ex * 1 + else: + result = round(3 - sim*3,2) + 1.00 + ex * 1 + + #52번 + elif num == 52: + #print('52번 채점') + if sp!= 0: + result = round(3 - sim*3,2) + round(1.5/sp,2)+ 0.5 * ex + else: + result = round(3 - sim*3,2) + 1.5+ 0.5 * ex + + + return result \ No newline at end of file