forked from ourresearch/openalex-text-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
28 lines (23 loc) · 791 Bytes
/
utils.py
File metadata and controls
28 lines (23 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from flask import request
def get_title_and_abstract():
if request.method == "GET":
title = request.args.get("title")
abstract = request.args.get("abstract")
else:
title = request.json.get("title")
abstract = request.json.get("abstract")
return title, abstract
def get_natural_language_text():
if request.method == "GET":
natural_language_text = request.args.get("natural_language")
else:
natural_language_text = request.json.get("natural_language")
return natural_language_text
def get_related_to_text():
if request.method == "GET":
text_input = request.args.get("text")
else:
text_input = request.json.get("text")
return text_input
def format_score(score):
return round(score, 3)