承接 vgip/datanorm 相关项目开发

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

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

vgip/datanorm

Composer 安装命令:

composer require vgip/datanorm

包简介

Data normalization

README 文档

README

Data normalization from some open sources

Installation

System Requirements

You need PHP >= 7.4 but the latest stable version of PHP is recommended

Composer

$ composer require Vgip/Datanorm

Functionality list

Transliteration from Ukrainian into English KMU 2010-01-27 #55

use Vgip\Datanorm\Transliteration\UkrEng\Cabmin2010;

$word = 'Єзгїґіпенєп';
$cabmin2010 = new Cabmin2010();
$wordTransliterated = $cabmin2010->transliterate($word);
echo $word.' -> '.$wordTransliterated;

Kyiv street getter from kga.gov.ua

Vgip\Datanorm\Parcer\Address\Ukr\Kyiv\StreetNameKga

Get array with normalized data from CSV file

Check and normalized street name data:

  • Convert possible apostrophe symbols to one symbol (ʼ - 02BC).
  • Check id (forbidden symbols, double). If error see to $this->warning.
  • Check street type by whitelist. New type save to $this->warning and this->typeNotFound.
  • Check Kyiv district name by whitelist. New Kyiv district name save to $this->warning and this->districtNotFound.
  • Check the street names and normalized street names . (if data saved to $this->streetNormalization array)
  • Generate $this->nameDouble array - save 2 or more double street name.
  • Generate $this->nameList - all unique street names.
  • Generate $this->typeCounter - quantity of all street types in Kyiv.

Result array from method getCsvAsArray():

  • ['number'] - (int) serial number from file
  • ['id'] - (int) identifier from file
  • ['name_original'] - (string) street name from file
  • ['name'] - (string) normalized street name
  • ['type_name'] - (string) street type name from file
  • ['type_key'] - (string) street type key
  • ['district_string'] - (string) street districts from file
  • ['district_list'] - (array) street districts ['district_key', 'district_key', ...]
  • ['document_name'] - (string) Document on assigning the name of the object
  • ['document_date'] - (string) Date of the document on assigning the name of the object
  • ['document_number'] - (string) Number of the document on assigning the name of the object
  • ['document_title'] - (string) The title of the document on the naming of the object
  • ['place_description'] - (string) Location of the object in the city
  • ['name_old'] - (string) Former name of the object
  • ['type_old'] - (string)Former category (type) of the object

Example

use Vgip\Datanorm\Parcer\Address\Ukr\Kyiv\StreetNameKga;
use Vgip\Datanorm\Directory\Address\Country\Ukr\Address AS DirUkrAddress;
use Vgip\Datanorm\Directory\Address\Country\Ukr\City\Kyiv AS DirKyiv;
use Vgip\Datanorm\Directory\Lang\Ukr\Pattern AS PatternUkrAddress;
use Vgip\Datanorm\Directory\Address\Country\Ukr\StreetNormalizedList;
use Vgip\Datanorm\Directory\Address\Country\Ukr\StreetNormalization;

$dirUkrAddress = DirUkrAddress::getInstance();
$dirKyiv = DirKyiv::getInstance();
$patternUkrAddress = PatternUkrAddress::getInstance();
$streetNormalizedListObj = StreetNormalizedList::getInstance();
$streetNormalizedList = $streetNormalizedListObj->getNormalization();

/** Get configuration and whitelist data */
$pathSourceFile = join(DIRECTORY_SEPARATOR, ['file', 'Reestr_vulits_Kyiva_2020_10_25.csv']);
$streetTypeList = $dirUkrAddress->getStreetTypeWhitelist();
$districtWhitelist = $dirKyiv->getDistrictWhitelist();
$patternStreetName = $patternUkrAddress->getStreetName();

/** Object initialization */
$streetNameKga = new StreetNameKga();

/** Set parameter */
$streetNameKga->setTypeWhitelist($streetTypeList);
$streetNameKga->setDistrictWhitelist($districtWhitelist);
$streetNameKga->setStreetNormalization($streetNormalizedList);
$streetNameKga->setPatternStreetName($patternStreetName);

/** Get a result (array) with normalized data */
$data = $streetNameKga->getCsvAsArray($pathSourceFile);

/** Get other data */
$res = [];
$res['type_list'] = $streetNameKga->getTypeList();
$res['type_counter'] = $streetNameKga->getTypeCounter();
$res['name_list'] = $streetNameKga->getNameList();
$res['name_double'] = $streetNameKga->getNameDouble();
$res['district_not_whitelist'] = $streetNameKga->getDistrictNotFound();

/** Get warnings if present */
$warning = $streetNameKga->getWarning();
$warningValue = $streetNameKga->getWarningValue();
if (null !== $warning AND count($warning) > 0) {
    print_r($warning);
}
print_r($data);
print_r($res);

Ukrainian language

Apostrophe

The resulting data will contain as ukrainian apostrophe symbol "ʼ" unicode symbol U+02BC. All other similar characters in source data (' - U+0027, ’ - U+2019, etc) will be replaced to ʼ (U+02BC). U+02BC - this symbol is used in the ukrainian domain name (ICANN).

Street name normalization

  • Position and surname - Академіка Єфремова, Генерала Авдєєнка, Маршала Бірюзова
  • Name and surname - Леоніда Бикова
  • Family relationships and surname - Братів Зерових, Родини Рудинських

Versioning

Data normalization follows Semantic Versioning.

vgip/datanorm 适用场景与选型建议

vgip/datanorm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 07 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 vgip/datanorm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 vgip/datanorm 我们能提供哪些服务?
定制开发 / 二次开发

基于 vgip/datanorm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-26