AnubisLMS / AnubisLMS/Anubis

ADD simple cheat detection on question responses

Offen
#107 4 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @synoet Auf GitHub ansehen
backend feature
Vorherrschende Sprache
Python
Sterne
381
Forks
53
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

```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)

```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.