Skip to content

Commit a796b3f

Browse files
committed
update docs
1 parent 8343549 commit a796b3f

File tree

2 files changed

+109
-48
lines changed

2 files changed

+109
-48
lines changed

docs/moss.md

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,6 @@
11
## Moss
22
> Derived from [Reading the Results](http://moss.stanford.edu/general/format.html).
33
4-
*PlagCheck* returns the following list of dictionaries:
5-
```json
6-
[
7-
{
8-
"file1":"filename1.py",
9-
"file2":"filename2.py",
10-
"percentage": 34,
11-
"no_of_lines_matched": 3,
12-
"lines_matched":[["2-3", "10-11"]]
13-
},
14-
....
15-
]
16-
```
17-
Each dict item contains the following items:
18-
19-
- **file1** & **file2** :
20-
The pair of file names that have similar code.
21-
22-
- **percentage** :
23-
It is the the percentage of the code in one file considered to match code in the other file.
24-
25-
- **lines_matched** :
26-
Lines Matched is approximately the number of lines of code that matched between 2 given files.
27-
28-
For example :
29-
If ***lines_matched* is [['88-99','119-131']]**
30-
31-
Then the line numbers 88-99 of *file1* matched with lines 119-131 of *file2*.
32-
33-
lines_matched is a list of lists indicating all line number matches between 2 code files.
34-
35-
36-
> For both measures(*lines_matched* & *percentage*), higher numbers mean more code matches.
37-
384

395

406
## [Tips](http://moss.stanford.edu/general/tips.html)

docs/usage.md

Lines changed: 109 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Usage
22

3-
plagcheck provides the following class constructors
3+
plagcheck provides the following classes:
44

55
### check(files, lang, user_id)
66

@@ -17,27 +17,28 @@ plagcheck provides the following class constructors
1717
import os
1818
import pprint
1919
from plagcheck import plagcheck
20+
2021
from dotenv import load_dotenv
2122
load_dotenv()
2223

23-
program_files = [
24-
"testfiles/test_python.py",
25-
"testfiles/test_python3.py",
26-
"testfiles/test_python2.py"
27-
]
28-
2924
language = "python"
3025
userid = os.environ["USER_ID"]
3126

3227

33-
cheat = plagcheck.check(program_files, language, userid)
28+
moss = plagcheck.check(language, userid)
29+
30+
moss.addFilesByWildCard("testfiles/test_python*.py")
3431

35-
# cheat.addBaseCode("submission/a01.py")
32+
# or moss.addFile("testfiles/test_python.py")
3633

37-
cheat.submit()
34+
moss.submit()
3835

39-
print(cheat.getHomePage())
40-
pprint.pprint(cheat.getResults())
36+
print(moss.getHomePage())
37+
pprint.pprint(moss.getResults())
38+
# print frequency of each shared solution
39+
pprint.pprint(moss.getShareScores())
40+
# print potential distributor-culprit relationships
41+
pprint.pprint(moss.getInsights())
4142

4243
```
4344

@@ -55,7 +56,7 @@ c.submit()
5556
### 2. getHomePage()
5657
**Parameters** : `None` <br>
5758
**Return Type** : `String` <br>
58-
**Description**: Returns the Moss Result HomePage<br>
59+
**Description**: Returns the Moss Result HomePage URL<br>
5960
**Demo**:
6061
```python
6162

@@ -84,4 +85,98 @@ c.getResults()
8485
]
8586
"""
8687

87-
```
88+
```
89+
90+
*getResults()* returns the following list of dictionaries:
91+
```json
92+
[
93+
{
94+
"file1":"filename1.py",
95+
"file2":"filename2.py",
96+
"percentage": 34,
97+
"no_of_lines_matched": 3,
98+
"lines_matched":[["2-3", "10-11"]]
99+
},
100+
....
101+
]
102+
```
103+
Each dict item contains the following items:
104+
105+
- **file1** & **file2** :
106+
The pair of file names that have similar code.
107+
108+
- **percentage** :
109+
It is the the percentage of the code in one file considered to match code in the other file.
110+
111+
- **lines_matched** :
112+
Lines Matched is approximately the number of lines of code that matched between 2 given files.
113+
114+
For example :
115+
If ***lines_matched* is [['88-99','119-131']]**
116+
117+
Then the line numbers 88-99 of *file1* matched with lines 119-131 of *file2*.
118+
119+
lines_matched is a list of lists indicating all line number matches between 2 code files.
120+
121+
122+
> For both measures(*lines_matched* & *percentage*), higher numbers mean more code matches.
123+
124+
### 4. addFilesByWildCard()
125+
**Parameters** : `String` <br>
126+
**Return Type** : `None` <br>
127+
**Description**: Add multiple files.<br>
128+
**Demo**:
129+
```python
130+
131+
c.addFilesByWildCard("testfiles/test_python*.py")
132+
# This will add all the files having names like, test_python2, test_python5 etc.
133+
134+
```
135+
136+
### 5. addFile()
137+
**Parameters** : `String` <br>
138+
**Return Type** : `None` <br>
139+
**Description**: Add a single file for submission.<br>
140+
**Demo**:
141+
```python
142+
143+
c.addFile("testfiles/test_python.py")
144+
145+
```
146+
147+
### 6. addBaseCode()
148+
**Parameters** : `String` <br>
149+
**Return Type** : `None` <br>
150+
**Description**: Add an allowed code file which is use by Moss to ignore results matching with this file<br>
151+
**Demo**:
152+
```python
153+
154+
c.addBaseCode("/base.py")
155+
156+
```
157+
158+
- Moss normally reports all code
159+
that matches in pairs of files. When a base file is supplied,
160+
program code that also appears in the base file is not counted in matches.
161+
- A typical base file will include, for example, the instructor-supplied
162+
code for an assignment. Multiple Base files are allowed.
163+
- You should use a base file if it is convenient; base files improve results, but are not usually necessary for obtaining useful information.
164+
165+
### 7. getShareScores()
166+
**Parameters** : `None` <br>
167+
**Return Type** : `Dict` <br>
168+
**Description**: Share Score is a utility which returns frequency of every individual file.<br>
169+
**Demo**:
170+
```python
171+
172+
c.getShareScores()
173+
174+
# Will return
175+
"""
176+
{'testfiles/test_python.py': 2,
177+
'testfiles/test_python2.py': 2,
178+
'testfiles/test_python3.py': 2}
179+
"""
180+
```
181+
Share Score is basically the frequency of each file appearing in Moss Results.
182+
i.e Higher the frequency, the more is that solution "shared" by different files.

0 commit comments

Comments
 (0)