🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

智慧树互动分Helper

让你愉快的水问答分

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

ผู้เขียน
洛白
จำนวนติดตั้งประจำวัน
0
จำนวนติดตั้งทั้งหมด
851
คะแนน
0 1 1
เวอร์ชัน
1.1.4
สร้างเมื่อ
08-10-2022
อัปเดตเมื่อ
15-06-2023
Size
8.15 กิโลไบต์
สัญญาอนุญาต
MIT
ปรับใช้กับ

Notice

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

感谢

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

https://greasyfork.org/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")