forked from p46318075/CodePattern
parent
d54c43b459
commit
4134d794ab
@ -1,18 +0,0 @@
|
|||||||
from flask import Flask, request
|
|
||||||
from cppy.cp_util import *
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
|
||||||
|
|
||||||
@app.route('/word_frequency', methods=['POST'])
|
|
||||||
def word_frequency():
|
|
||||||
# 获取POST请求中的JSON数据
|
|
||||||
data = request.get_json()
|
|
||||||
data = data['file']
|
|
||||||
# 统计词频
|
|
||||||
word_freq = get_frequencies(data)
|
|
||||||
word_freq = sort_dict(word_freq)
|
|
||||||
return word_freq
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
app.run(debug=True)
|
|
||||||
|
|
Loading…
Reference in new issue