{"id":15029834,"url":"https://github.com/geocurly/name-splitter","last_synced_at":"2026-04-04T06:38:21.653Z","repository":{"id":62509963,"uuid":"253231227","full_name":"geocurly/name-splitter","owner":"geocurly","description":"Split name utility","archived":false,"fork":false,"pushed_at":"2020-08-29T10:07:14.000Z","size":112,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-19T22:50:55.616Z","etag":null,"topics":["name-splitter","php74","russian-name-splitter","splitter"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geocurly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-05T12:37:24.000Z","updated_at":"2020-05-29T19:53:38.000Z","dependencies_parsed_at":"2022-11-02T10:30:45.734Z","dependency_job_id":null,"html_url":"https://github.com/geocurly/name-splitter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geocurly%2Fname-splitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geocurly%2Fname-splitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geocurly%2Fname-splitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geocurly%2Fname-splitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geocurly","download_url":"https://codeload.github.com/geocurly/name-splitter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243349479,"owners_count":20276610,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["name-splitter","php74","russian-name-splitter","splitter"],"created_at":"2024-09-24T20:11:43.679Z","updated_at":"2025-12-28T08:05:13.249Z","avatar_url":"https://github.com/geocurly.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# name-splitter\n\n### Unfortunately, utility supports only сyrillic names\n\nThere is a name split utility. It's take input string and parse it to the object. \n\n## Usage:\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nuse NameSplitter\\NameSplitter;\n\n$splitter = new NameSplitter(['enc' =\u003e 'CP1251']);\n$result = $splitter-\u003esplit('Иванов Иван Иванович');\n[$surname, $name, $middleName] = [\n    $result-\u003egetSurname(),\n    $result-\u003egetName(),\n    $result-\u003egetMiddleName(),\n];\n``` \n\n## Quality\n\nThe NameSplitter's tests cover ~ 13000 cases of russian names with accuracy 99.65. Every case took a part with many templates, so result cases count was 124283. \nYou can run tests with your data set (use `--verbose` option to see templates errors):\n```bash\n[aleksandr@aleksandr name-splitter]$ ./bin/name-split-test --file=$(realpath fio.csv)\n\nTESTED TEMPLATES:\n%Surname %Name %Middle\n%Name %Middle %Surname\n%Name %Middle\n%Name %Surname\n%Surname %Name\n%Surname %StrictInitials\n%StrictInitials %Surname\n%Surname %SplitInitials\n%SplitInitials %Surname\n\nACCURACY: 99.65\nCOUNT CASE TOTAL: 124283\nCOUNT CASE PASS:  123848\nCOUNT CASE ERROR: 435\n```\nFormat for `fio.csv` file is:\n```csv\nSomeSurname;SomeName;SomeMiddleName\n``` \n\n## Problems\n* Utility can't recognize templates like `%Name %Surname` when surname matches with middle name (for example `Иван Иванович`).\n* Some templates may not correctly work when split name doesn't exist in [dictionaries](https://github.com/geocurly/name-splitter/tree/master/resources/dictionaries/ru)\n\n## Decision\nYou can use pre and post templates:\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nuse NameSplitter\\{\n    NameSplitter,\n    Template\\SimpleMatch,\n    Contract\\TemplateInterface as TPL,\n    Contract\\StateInterface\n};\n\n$before = [\n    // for this case we explicitly match name parts with template\n    new SimpleMatch([\n        TPL::SURNAME =\u003e 'Difficult Surname', \n        TPL::NAME =\u003e 'Difficult Name'\n    ]),\n    static function(StateInterface $state) {\n        // TODO there is will be your implementation\n        return [\n            TPL::SURNAME =\u003e $surname ?? null, \n            TPL::NAME =\u003e $name ?? null,\n        ];\n    },\n];\n\n// There are may be any callable types if they take to input the StateInterface\n$after = [];\n\n$splitter = new NameSplitter([], $before, $after);\n$result = $splitter-\u003esplit('Difficult Surname Difficult Name');\n``` \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeocurly%2Fname-splitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeocurly%2Fname-splitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeocurly%2Fname-splitter/lists"}