ColaboratoryでIMIコンポーネントツールの実行

!apt install jq
!npm i -g npm to update
!npm install https://info.gbiz.go.jp/tools/imi_tools/resource/imi-enrichment-address/imi-enrichment-address-2.0.0.tgz

%%writefile index.js

const enrichment = require("imi-enrichment-address")

enrichment('東京都千代田区霞が関1-3-1').then(json => {
    console.log(JSON.stringify(json));
});

!node index.js | jq

fukuno.jig.jp

こちらのESモジュール版だとインストール不要で簡単

%%html
<script type="module">

import IMIEnrichmentAddress from "https://code4sabae.github.io/imi-enrichment-address/IMIEnrichmentAddress.mjs";

const main = async () => {
  const json = await IMIEnrichmentAddress("福井県鯖江市新横江2-3-4");
  alert(JSON.stringify(json, null, 2));
};
main();

</script>
%%html
<script type="module">

import IMIEnrichmentHojin from "https://code4sabae.github.io/imi-enrichment-hojin/IMIEnrichmentHojin.mjs";

const main = async () => {
  const json = await IMIEnrichmentHojin("4000012090001");
  alert(JSON.stringify(json, null, 2));
};
main();

</script>