Skip to content

Commit

Permalink
ready for 0.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhupesh-V committed Mar 10, 2020
1 parent 5096122 commit 7f1aabc
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 44 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog


## [0.4] - March 10, 2020

### Changed [⚠️ Breaking Changes]
- `getShareScores` & `getInsights` have been decoupled from the check class, they now have to imported separately.
- Minor changes in the `analyze.py` module.


## [0.3] - Jan 1, 2020

### Added
Expand Down
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog


## [0.4] - March 10, 2020

### Changed [⚠️ Breaking Changes]
- `getShareScores` & `getInsights` have been decoupled from the check class, they now have to imported separately.
- Minor changes in the `analyze.py` module.


## [0.3] - Jan 1, 2020

### Added
Expand Down
18 changes: 14 additions & 4 deletions docs/insights.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@

PlagCheck provides algorithmic analysis of Moss results.

### Terminologies

## M-group
### 1. Node
Nodes are results returned by Moss i.e every
individual file.

### 2. Tags
Tags are roles which a file serves i.e. a tag is
a potential distributor or potential culprit or
both.

### 3. M-group
m-groups (moss-groups) are groups of solution which have similar code.
For example A student who solves a programming problem may share their
solution with 3 of his/her friends, that is a single m-group with 4 nodes.

For example if you run [demo.py](https://github.com/codeclassroom/PlagCheck/blob/master/demo.py), `insights()` will return the following data:
```python
```java

{'DCtoC Paths': [('testfiles/test_java5.java', 'testfiles/test_java2.java'),
('testfiles/test_java4.java', 'testfiles/test_java2.java')],
Expand All @@ -21,11 +31,11 @@ For example if you run [demo.py](https://github.com/codeclassroom/PlagCheck/blob

```

This analysis can be visulaized into following _Disconnected Directed Graph_
This analysis can be visualized into following _Disconnected Directed Graph_

![moss results](https://drive.google.com/uc?export=view&id=1Lc8obgjihfo7EGimn300mTtqfmHK0Zem)

We assign Tags to every individual file which has been returned by Moss.
We assign Tags to every individual Node.

1. D - Distributor
Student(s) who distributed their
Expand Down
18 changes: 13 additions & 5 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@

Installing plagcheck is pretty simple, just run

`pip install plagcheck`
```bash
pip install plagcheck
```

Install a specific verison

`pip install plagcheck==0.2`
```bash
pip install plagcheck==0.4
```

or directly from GitHub if you cannot wait to test new features

`pip install git+https://github.com/codeclassroom/PlagCheck.git`
```bash
pip install git+https://github.com/codeclassroom/PlagCheck.git
```

If you have already installed it and want to update
If you have a old version, update it using

`pip install --upgrade plagcheck`
```bash
pip install --upgrade plagcheck
```
55 changes: 30 additions & 25 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Usage

plagcheck provides the following classes:
plagcheck provides the following classes & methods:

### check(files, lang, user_id)

Expand All @@ -16,29 +16,33 @@ plagcheck provides the following classes:
"""Usage example"""
import os
import pprint
from plagcheck import plagcheck
from plagcheck.plagcheck import check, insights, share_scores

from dotenv import load_dotenv
load_dotenv()

language = "python"
language = "java"
userid = os.environ["USER_ID"]


moss = plagcheck.check(language, userid)
moss = check(language, userid)

moss.addFilesByWildCard("testfiles/test_python*.py")
moss.addFilesByWildCard("testfiles/test_java*.java")

# or moss.addFile("testfiles/test_python.py")

moss.submit()

print(moss.getHomePage())
pprint.pprint(moss.getResults())
# print frequency of each shared solution
pprint.pprint(moss.getShareScores())

result = moss.getResults()

pprint.pprint(result)

# print potential distributor-culprit relationships
pprint.pprint(moss.getInsights())
pprint.pprint(insights(result))
# print frequency of each shared solution
pprint.pprint(share_scores(result))

```

Expand Down Expand Up @@ -72,18 +76,6 @@ c.getHomePage()
```python

c.getResults()
"""
[
{
"file1":"filename1.py",
"file2":"filename2.py",
"percentage": 34,
"no_of_lines_matched": 3,
"lines_matched":[["2-3", "10-11"]]
},
....
]
"""

```

Expand Down Expand Up @@ -162,14 +154,16 @@ program code that also appears in the base file is not counted in matches.
code for an assignment. Multiple Base files are allowed.
- You should use a base file if it is convenient; base files improve results, but are not usually necessary for obtaining useful information.

### 7. getShareScores()
**Parameters** : `None` <br>
<hr>

### share_scores()
**Parameters** : `Moss Results`(returned by `getResults()`) <br>
**Return Type** : `Dict` <br>
**Description**: Share Score is a utility which returns frequency of every individual file.<br>
**Demo**:
```python

c.getShareScores()
print(share_scores(moss_data))

# Will return
"""
Expand All @@ -179,4 +173,15 @@ c.getShareScores()
"""
```
Share Score is basically the frequency of each file appearing in Moss Results.
i.e Higher the frequency, the more is that solution "shared" by different files.
i.e Higher the frequency, the more is that solution "shared" by different files.

### insights()
**Parameters** : `Moss Results`(returned by `getResults()`) <br>
**Return Type** : `Dict` <br>
**Description**: See [Insights](/insights).<br>
**Demo**:
```python

print(insights(moss_data))

```
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ nav:
- Documentation: index.md
- Installation: installation.md
- Usage: usage.md
- Insights: insights.md
- PlagCheck Insights: insights.md
- Moss: moss.md
- Changelog: changelog.md
- About: about.md
Expand Down
13 changes: 7 additions & 6 deletions plagcheck/plagcheck_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for the MOSS interface package for CodeClassroom"""
from plagcheck import analyze, plagcheck
from plagcheck.plagcheck import insights, share_scores


def test_check():
Expand All @@ -11,15 +12,15 @@ def test_check():
temp.addFile("testfiles/test_python2.py")
temp.submit()
results = temp.getResults()
insights = temp.getInsights()
share_scores = temp.getShareScores()
moss_insights = insights(results)
moss_share_scores = share_scores(results)

assert share_scores == {
assert moss_share_scores == {
"testfiles/test_python.py": 1,
"testfiles/test_python2.py": 1,
}

assert insights == {"DCtoC Paths": [], "DtoC Paths": [], "DtoDC Paths": []}
assert moss_insights == {"DCtoC Paths": [], "DtoC Paths": [], "DtoDC Paths": []}

assert results == [
{
Expand Down Expand Up @@ -48,8 +49,8 @@ def test_Mgroups():
mg = analyze.Mgroups()
mg.createNodes({"1", "2", "3"})

mg.relatesTo(45, 88, "3", "1")
mg.relatesTo(46, 90, "3", "2")
mg.relate(45, 88, "3", "1")
mg.relate(46, 90, "3", "2")

mg.set_tags()

Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@

setuptools.setup(
name="plagcheck",
version="0.3",
version="0.4",
license="MIT",
author="Bhupesh Varshney",
author_email="[email protected]",
description="Moss Results scraper with powerful insights & analysis",
keywords="moss plagiarism analysis cheat mosspy",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/codeclassroom/PlagCheck",
url="https://codeclassroom.github.io/PlagCheck/",
project_urls={
"Documentation": "https://github.com/codeclassroom/PlagCheck/blob/master/docs/docs.md",
"Documentation": "https://plagcheck.readthedocs.io/en/latest/?badge=latest",
"Source Code": "https://github.com/codeclassroom/PlagCheck",
"Funding": "https://www.patreon.com/bePatron?u=18082750",
"Say Thanks!": "https://github.com/codeclassroom/PlagCheck/issues/new?assignees=&labels=&template=---say-thank-you.md&title=",
Expand Down

0 comments on commit 7f1aabc

Please sign in to comment.