AnubisLMS / AnubisLMS/Anubis

ADD simple cheat detection on question responses

未关闭
#107 4 条评论 0 个 reaction 已指派 1 人 已被 @synoet 认领 在 GitHub 查看
backend feature
主要语言
Python
星标
381
派生
53
PR 合并指标
30 天内没有已合并 PR

描述

```python
from difflib import SequenceMatcher
import json
import pandas as pd

def similar(a, b):
return SequenceMatcher(None, a, b).ratio()

a = json.load(open('./assignment-final-question-assignments.json'))
netids = list(a.keys())

first = next(a.values())
pools = list(map(lambda x: x['question']['pool'], first['questions']))
results = {_pool: [] for _pool in pools}

for netid in netids:
for question in a[netid]['questions']:
pool = question['pool']
text = question['response']['text']
row = []
for _netid in netids:
_text=None
for _q in a[netid]['questions']:
if _q['pool'] == pool:
_text = _q['response']['text']
break
ratio = similar(text, _text)
if len(text) == 0 or len(_text) == 0 or netid == _netid:
ratio = 0
row.append(ratio)
results[pool].append(row)

```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。