feat: scan

This commit is contained in:
hashbro
2026-09-13 00:31:54 +08:00
parent 558912864d
commit 4fa162c72c
5 changed files with 70 additions and 54 deletions
+23 -2
View File
@@ -36,7 +36,7 @@ class MnemonicDetectorTest extends TestCase
}
#[Test]
public function marks_nine_hits_as_suspected_not_confirmed(): void
public function marks_dense_ocr_holes_as_suspected_not_confirmed(): void
{
$ocr = <<<'TXT'
palance cousin endorse
@@ -52,7 +52,7 @@ TXT;
}
#[Test]
public function eight_hits_are_suspected(): void
public function eight_consecutive_hits_are_suspected(): void
{
$text = 'cousin endorse refuse private dog solution april picture';
$hit = (new MnemonicDetector)->detect($text);
@@ -62,6 +62,27 @@ TXT;
$this->assertSame(8, $hit['word_count']);
}
#[Test]
public function ignores_sparse_english_prose(): void
{
$ocr = '7134 bom CA i a ating Heath Mag Daly craving If You\'re Craving Sugar '
.'Your body may need protein + stable blood sugar What\'s happening: Blood sugar spikes '
.'crash more cravings what eat instead cogs chicken';
$this->assertNull((new MnemonicDetector)->detect($ocr));
}
#[Test]
public function two_ocr_holes_with_ten_hits_are_suspected(): void
{
$ocr = 'cousin endorse refuse private dog solution puddy april picture father palance lab';
$hit = (new MnemonicDetector)->detect($ocr);
$this->assertNotNull($hit);
$this->assertFalse($hit['confirmed']);
$this->assertSame(10, $hit['word_count']);
}
#[Test]
public function ignores_repetitive_plumbing_copy(): void
{