In the process of working, I have met many questions, some had been solved that i may forget the method to solving the problem. Some have not been solved, so it’s necessary to write these problem and conquer when inspiration comes to me.
- When I used the package of Flask to buid my api, i sent a format of string to the api, but when the symbol '# ’ in the string, the front of the '# ’ is lefted and the behind of the ‘#’ is cut nowhere, the program is as follows:
def opinionAnalysis():
sentence = None
if request.method == "POST":
sentence = request.form.get("title")
else:
sentence = request.args.get("title")
oa = OpinionAnalysis(data_dir, model_dir)
return oa.unit_sample_test(sentence)
I have used resuest.form.get
、 request.args.get
and request.values.get
, but it made no use.