def diff2(self, other): """Compare this assignment to another one. """ checker = PlagChecker() result = checker.compare( str(self.getFile()), str(other.getFile()), self.pretty_title_or_id(), other.pretty_title_or_id() ) vis = PlagVisualizer() strList = vis.resultToHtml(result, str(self.getFile()), str(other.getFile())) return strList
# Test #=============================================================================== if __name__ == '__main__': A = "dies ist nur ein kleiner test und ich hab dich so lieb" B = "ich hab dich so lieb ach ja und dies ist nur ein kleiner test kleiner test yeah mah bin ich toll wah oder so ne" s5 = 'print \'hello\'\n\ndef test1(s):\n s = test2(s)\n if s == \'Muster\':\n return s\n else:\n return \'\'\n\ndef mah():\n s= 1+2\n return s\n\n#lala\ndef test2(s):\n if s==\'\':\n return \'\'\n elif len(s) > 5:\n s = \'muha\'\n else:\n return \'Muster\'\n\n return s\n\n' s6 = 'print \'hello\'\n\ndef mah(): return \'nok\'\n\ndef test1(s):\n s = test2(s)\n if s == \'Muster\':\n return s\n else:\n return \'\'\n\n#lala\ndef test2(s):\n if s==\'\':\n return \'\'\n elif len(s) > 5:\n s = \'muha\'\n else:\n return \'Muster\'\n\n return s\n\n' s7 = 'print \'hello\'\n\ndef test1(s):\n s = test2(s)\n if s == \'Muster\':\n return s\n else:\n return \'\'\n\n#lala\ndef test2(s):\n if s==\'\':\n return \'\'\n elif len(s) > 5:\n s = \'muha\'\n else:\n return \'Muster\'\n\n return s\n\n' nonplag = "Ja mei wat is dat denn fuer a schmarrn ^^" minimal = "dich so lieb mau kau schuschu whoowhoo nur ein kleiner test" nurzuA = "dies ist nur test und ich" stringList = [A, B, nurzuA] idList = ["student01", "student02", "student03"] from PlagDetector.PlagChecker import PlagChecker checker = PlagChecker() resultList = checker.compareList(stringList, idList, 3) for r in resultList: print r #=============================================================================== # img = createIntensityHeatmap(resultList) # img.show() #=============================================================================== img = createClusterHeatmap(resultList) img.show() stringList = [A, B, s5, s6, s7, nonplag, minimal] idList = ["student01", "student02", "student03", "student04", "student05", "student06", "student07"] from PlagDetector.PlagChecker import PlagChecker