mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
c
This commit is contained in:
parent
41873a4d63
commit
21bf06581c
4 changed files with 26 additions and 2 deletions
|
@ -22,3 +22,4 @@ wlc==1.13
|
|||
coloredlogs==15.0.1
|
||||
requests
|
||||
markdown
|
||||
textrank4zh
|
|
@ -18,3 +18,4 @@ typing_extensions==4.5.0
|
|||
fasttext-predict==0.9.2.1
|
||||
requests
|
||||
markdown
|
||||
textrank4zh
|
|
@ -17,6 +17,7 @@ import requests
|
|||
import markdown
|
||||
import re
|
||||
import datetime
|
||||
from textrank4zh import TextRank4Keyword, TextRank4Sentence
|
||||
|
||||
from timeit import default_timer
|
||||
from html import escape
|
||||
|
@ -650,6 +651,16 @@ def health():
|
|||
return Response('OK', mimetype='text/plain')
|
||||
|
||||
|
||||
@app.route('/textrank', methods=['POST'])
|
||||
def textrank():
|
||||
res = []
|
||||
text = request.form.get('text')
|
||||
tr4s = TextRank4Sentence()
|
||||
tr4s.analyze(text=text, lower=True, source = 'all_filters')
|
||||
for item in tr4s.get_key_sentences(num=15):
|
||||
res.append(item.sentence)
|
||||
return Response(json.dumps(res), mimetype='application/json')
|
||||
|
||||
@app.route('/search', methods=['GET', 'POST'])
|
||||
def search():
|
||||
"""Search query in q and return results.
|
||||
|
|
|
@ -17,6 +17,7 @@ import requests
|
|||
import markdown
|
||||
import re
|
||||
import datetime
|
||||
from textrank4zh import TextRank4Keyword, TextRank4Sentence
|
||||
|
||||
from timeit import default_timer
|
||||
from html import escape
|
||||
|
@ -650,6 +651,16 @@ def health():
|
|||
return Response('OK', mimetype='text/plain')
|
||||
|
||||
|
||||
@app.route('/textrank', methods=['POST'])
|
||||
def textrank():
|
||||
res = []
|
||||
text = request.form.get('text')
|
||||
tr4s = TextRank4Sentence()
|
||||
tr4s.analyze(text=text, lower=True, source = 'all_filters')
|
||||
for item in tr4s.get_key_sentences(num=15):
|
||||
res.append(item.sentence)
|
||||
return Response(json.dumps(res), mimetype='application/json')
|
||||
|
||||
@app.route('/search', methods=['GET', 'POST'])
|
||||
def search():
|
||||
"""Search query in q and return results.
|
||||
|
|
Loading…
Add table
Reference in a new issue