Skip to content

Commit

Permalink
remove code snippets from the README.(ja.).md
Browse files Browse the repository at this point in the history
  • Loading branch information
wf9a5m75 committed Oct 29, 2024
1 parent ba872b2 commit b2d6322
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 99 deletions.
49 changes: 0 additions & 49 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,52 +342,3 @@
| fuzzy | | ワイルドカードとして使用する1文字 |

</details>

## コードからの利用

```typescript
import {
AbrGeocoder,
AbrGeocoderDiContainer,
FormatterProvider,
Query,
} from '@digital-go-jp/abr-geocoder';
import path from 'node:path';
const abrgDir = `(path to working directory)`;
const rootDir = `(path to this library directory)`;
// ジオコーダ作成のためのパラメータ
const container = new AbrGeocoderDiContainer({
database: {
type: 'sqlite3',
dataDir: path.join(abrgDir, 'database'),
schemaDir: path.join(rootDir, 'schemas', 'sqlite3'),
},
cacheDir: path.join(abrgDir, 'cache'),
});
// ジオコーダーの作成
const geocoder = await AbrGeocoder.create({
container,
numOfThreads: 5, // CPUコア数に合わせて調整すると良い
});
const addresses: string[] = [
"(住所文字列1)",
"(住所文字列2)",
];
const tasks: Promise<Query> = addresses.map(address => {
return this.geocoder.geocode({
address,
tag: undefined,
searchTarget,
fuzzy,
});
});
const results = await Promise.all(tasks);
geocoder.close();
```
50 changes: 0 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,53 +334,3 @@ curl http://localhost:3000/geocode?address=東京都千代田区紀尾井町1-3
| format | | Output format for the result. |
| fuzzy | | A single character used as a wildcard. |
</details>


## Usage from your code

```typescript
import {
AbrGeocoder,
AbrGeocoderDiContainer,
FormatterProvider,
Query,
} from '@digital-go-jp/abr-geocoder';
import path from 'node:path';
const abrgDir = `(path to working directory)`;
const rootDir = `(path to this library directory)`;
// Sets up parameters
const container = new AbrGeocoderDiContainer({
database: {
type: 'sqlite3',
dataDir: path.join(abrgDir, 'database'),
schemaDir: path.join(rootDir, 'schemas', 'sqlite3'),
},
cacheDir: path.join(abrgDir, 'cache'),
});
// Creates the geocoder instance
const geocoder = await AbrGeocoder.create({
container,
numOfThreads: 5, // adjusts with the number of CPU cores
});
const addresses: string[] = [
"(Japanese address1)",
"(Japanese address2)",
];
const tasks: Promise<Query> = addresses.map(address => {
return this.geocoder.geocode({
address,
tag: undefined,
searchTarget,
fuzzy,
});
});
const results = await Promise.all(tasks);
geocoder.close();
```

0 comments on commit b2d6322

Please sign in to comment.