Greasy Fork

来自缓存

Greasy Fork is available in English.

智慧树互动分Helper

让你愉快的水问答分

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
洛白
日安装量
0
总安装量
851
评分
0 1 1
版本
1.1.4
创建于
2022-10-08
更新于
2023-06-15
大小
8.2 KB
许可证
MIT
适用于

Notice

  • 如果打开之后没有填写,请稍等一段时间
  • 如果填写之后提交为,请在后面加个空格或者其他任意操作
  • 建议对填写的文字进行一些自己的修改,比如我觉得,我认为,等等等等,的,
  • 如果长时间没有反应,直接ctrl+r刷新

感谢

本插件使用了以下插件的部分代码,在此鸣谢

http://greasyfork.icu/zh-CN/scripts/437990-aoguai-%E6%99%BA%E6%85%A7%E6%A0%91-%E7%9F%A5%E5%88%B0-%E4%B9%A0%E6%83%AF%E5%88%86%E5%B9%B3%E6%97%B6%E5%88%86%E9%97%AE%E7%AD%94%E5%9E%83%E5%9C%BE%E8%AF%9D%E7%94%9F%E6%88%90%E5%99%A8

本插件后端使用了python的语义分析库synonyms,在此鸣谢

how to use

使用两个python文件如附加文件,运行的话只需要安装好全部的库之后

python3 ./1.py

init.py

# -*- coding: utf-8 -*-
from collections import Counter
import synonyms
import chardet
import json
l=0
def get2(NumSentence,NumWord,list1):
    list2=List_set = set(list1)
    global l
    l=len(list1)
    d2 = Counter(list1)
    list2=dict(d2)
    list3=list2
    list4=[]
    Bestsentence=0
    min=1
    for i in list2:
        x=0
        for j in list2:
            if(i==j):continue
            x+=synonyms.compare(i,j, seg=True)*int(list2[i])
        x=x/(l-1)
        if x<min:
            Bestsentence=i
            min=x
        w=synonyms.seg(i)
        # print(w)
        for k in range(len(w[0])):
            if(w[1][k]=='c' or w[1][k]=='x' or w[1][k]=='uj'):continue
            list4.append(w[0][k])
            # print(w[0][k],w[1][k])
    d3 = Counter(list4)
    json1='{"sentence":'+(json.dumps(d2.most_common(NumSentence))).encode().decode('utf-8')+','+'"word":'+json.dumps(d3.most_common(NumWord)).encode().decode('utf-8')+'}'
    print(json1)
    return json1,list2

def check(j):
    ans=0
    for i in ListSentence:
        ans+=synonyms.compare(i,j,seg=True)*int(ListSentence[i])
    ans=ans/l
    return ans

1.py

#coding:utf-8
from flask import Flask, request
from flask import render_template
from init import *
list=[]
ListSentence=[]
app = Flask("my-app")
@app.route('/')
def hello_world():
    return render_template('index.html')

# @app.route('/add')
# def add():
#     return render_template('add.html')

# @app.route('/plan')
# def plan():
#     return render_template('plan.html')

# @app.route('/dictionaries')
# def english():
#     return render_template('english.html')

# @app.route('/test', methods=['POST'])
# def add():
#     print(request.headers)
#     print(type(request.json))
#     print(request.json)
#     result = request.json['a'] + request.json['b']
#     return str(result)

@app.route('/print', methods=['POST'])
def pri():
    list=[]
    result = request.json
    for i in result:
        list.append(i['answerContent'])
       # print(i,i['answerContent'])
    json1,ListSentence=get2(20,25,list)
    return json1.encode().decode("unicode_escape")

if __name__ == '__main__':
    app.config['JSON_AS_ASCII'] = False
    app.run(host='0.0.0.0', port=5000, debug=False)
    print("ok")