-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
53 lines (40 loc) · 1.16 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import fire
from omegaconf import OmegaConf
from plagiarism.detector import extrinsic_plg, intrinsic_plg
from plagiarism.util import metric
from plagiarism.vectorizer import TFIDFHashing, SE
def extrinsic_se(config):
conf = OmegaConf.load(config)
extrinsic_plg(
conf.extrinsic.source.pth,
conf.extrinsic.suspicious.pth,
conf.extrinsic.source.dir,
conf.extrinsic.suspicious.dir,
conf.extrinsic.index,
conf.extrinsic.save,
SE(),
)
def extrinsic_tfidf(config):
conf = OmegaConf.load(config)
extrinsic_plg(
conf.extrinsic.source.pth,
conf.extrinsic.suspicious.pth,
conf.extrinsic.source.dir,
conf.extrinsic.suspicious.dir,
conf.extrinsic.index,
conf.extrinsic.save,
TFIDFHashing(),
)
def intrinsic(config):
conf = OmegaConf.load(config)
intrinsic_plg(
conf.intrinsic.suspicious.pth,
conf.intrinsic.suspicious.dir,
conf.intrinsic.features,
conf.intrinsic.save,
)
def evaluation(config):
conf = OmegaConf.load(config)
print(metric(**conf.evaluation))
if __name__ == "__main__":
fire.Fire()