MCPcopy Index your code
hub / github.com/clips/pattern / test_intertextuality

Method test_intertextuality

test/test_metrics.py:142–152  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

140 print "pattern.metrics.readability()"
141
142 def test_intertextuality(self):
143 # Evaluate accuracy for plagiarism detection.
144 from pattern.db import Datasheet
145 data = Datasheet.load(os.path.join(PATH, "corpora", "plagiarism-clough&stevenson.csv"))
146 data = [((txt, src), int(plagiarism) > 0) for txt, src, plagiarism in data]
147 def plagiarism(txt, src):
148 return metrics.intertextuality([txt, src], n=3)[0,1] > 0.05
149 A, P, R, F = metrics.test(lambda x: plagiarism(*x), data)
150 self.assertTrue(P > 0.96)
151 self.assertTrue(R > 0.94)
152 print "pattern.metrics.intertextuality()"
153
154 def test_ttr(self):
155 # Assert type-token ratio: words = 7, unique words = 6.

Callers

nothing calls this directly

Calls 2

testMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected