Skip to content

Commit

Permalink
Merge pull request #31 from 365Werk/feature/parse-document-number-viz
Browse files Browse the repository at this point in the history
Feature/parse document number viz
  • Loading branch information
HergenD authored May 4, 2021
2 parents 012f7d5 + 595f050 commit 3c1ec02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "werk365/identitydocuments",
"description": "Package to parse identity documents like passports",
"license": "GPL-3.0-or-later",
"version": "2.0.2",
"version": "2.0.3",
"authors": [
{
"name": "Hergen Dillema",
Expand Down
4 changes: 4 additions & 0 deletions src/Viz/VizParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class VizParser extends Viz
private array $viz = [
'first_name' => [],
'last_name' => null,
'document_number' => null,
];

public function match(array $parsed, string $mrz, string $text): array
Expand Down Expand Up @@ -47,6 +48,9 @@ public function match(array $parsed, string $mrz, string $text): array
$lastNameScore = $this->compare($parsed['last_name'], $lastName);
$this->viz['last_name']['confidence'] = $lastNameScore;
}
if (strpos($word, preg_replace('/</', '', $parsed['document_number'])) !== false) {
$this->viz['document_number']['value'] = $word;
}
foreach ($parsed['first_name'] as $key => $first_name) {
if (! isset($firstNameScore[$key])) {
$firstNameScore[$key] = 0.4;
Expand Down

0 comments on commit 3c1ec02

Please sign in to comment.