承接 michielgerritsen/extract-address-parts 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

michielgerritsen/extract-address-parts

最新稳定版本:v1.0.6

Composer 安装命令:

composer require michielgerritsen/extract-address-parts

包简介

Get the (Dutch) street, house number, and extension from a concatenated string

README 文档

README

Extract information from Dutch addresses

I have been in this situation multiple times: You need to provide an housernumber and addition for some API. But the provided dataset only has the complete address. This library tries to solve this issue. For instance:

  • Kerkstraat 95A
    • Street: Kerkstraat
    • Housenumber: 95
    • Addition: A

This library has 3 ways available to extract the data:

  • AddressExtraction - The default. Tries to extract by using regex.
  • PrecisionAddressExtraction - This uses library files with all known Dutch streetnames and tries to match them.
  • CombinedAddressExtraction - A combination of the previoius 2: It tries the PrecisionAddressExtraction first, and if that fails, fallsback to the AddressExtraction.

This is a lightweight repository, it has no external dependencies, except for PHPUnit for testing.

Installation

composer require michielgerritsen/extract-address-parts

Usage

AddressExtraction

use MichielGerritsen\ExtractAddressParts\AddressExtraction;
use MichielGerritsen\ExtractAddressParts\PrecisionAddressExtraction;
use MichielGerritsen\ExtractAddressParts\CombinedAddressExtraction;
use MichielGerritsen\ExtractAddressParts\VO\AddressExtractionResult;
use MichielGerritsen\ExtractAddressParts\Exceptions\AddressExtractionError;

/** @var AddressExtractionResult $result */
try {
  $result = (new AddressExtraction())->process(['Kerkstraat 95A']);
  $result = (new PrecisionAddressExtraction())->process(['Kerkstraat 95A']);
  $result = (new CombinedAddressExtraction())->process(['Kerkstraat 95A']);
} catch (AddressExtractionError $exception) {
  die('Uh oh, this address seems to be invalid.');
}

$result->getStreet(); // Kerkstraat
$result->getHousenumber(); // 95
$result->getAddition(); // A

Contributing

Pull the repository, run composer install. Testing can be done by composer test.

统计信息

  • 总下载量: 7.3k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: WTFPL
  • 更新时间: 2020-06-25