Skip to content

Commit

Permalink
sync-github-data: using pinyin-pro instead of pinyin (pingcap#1645)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mini256 authored Sep 25, 2023
1 parent ac7989e commit 660c00a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 248 deletions.
4 changes: 2 additions & 2 deletions packages/sync-github-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@types/node": "^18.16.3",
"fastify-tsconfig": "^1.0.1",
"pino-pretty": "^9.4.0",
"prisma": "^4.14.0",
"prisma": "^5.3.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^4.5.4"
},
Expand All @@ -40,7 +40,7 @@
"octokit": "^2.0.10",
"pino": "^8.7.0",
"pino-sentry-transport": "^1.0.4",
"pinyin": "3.0.0-alpha.4",
"pinyin-pro": "^3.16.6",
"reflect-metadata": "^0.1.13",
"yaml": "^2.2.2"
}
Expand Down
5 changes: 3 additions & 2 deletions packages/sync-github-data/src/libs/locator/Locator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {LocationCacheItem, Prisma, PrismaClient} from "@prisma/client";
import axios, {AxiosInstance} from 'axios';
import {NominatimProvider} from 'libs/locator/provider/nominatim';
import {Logger} from "pino";
import pinyin from 'pinyin';
import { pinyin } from 'pinyin-pro';
import 'reflect-metadata';

const ADDRESS_MIN_LENGTH = 5;
Expand Down Expand Up @@ -153,7 +153,8 @@ export class Locator {
private convertToPinYin(address: string): string {
return address.split(' ').map((part) => {
return pinyin(part, {
style: pinyin.STYLE_NORMAL,
toneType: 'none',
type: 'array'
}).join('');
}).join(' ');
}
Expand Down
Loading

0 comments on commit 660c00a

Please sign in to comment.