概要
以下の記事の続きです。

CWRC XML Validator APIを試す
CWRC XML Validator APIを試す
LEAF-WRITERの特徴として、以下が挙げられています。
the ability to look up and select identifiers for named entity tags (persons, organizations, places, or titles) from the following Linked Open Data authorities: DBPedia, Geonames, Getty, LGPN, VIAF, and Wikidata.
この機能は、以下のようなライブラリが使用されています。
GitHub - cwrc/wikidata-entity-lookup: Find entities (people, places, organizations) in Wikidata.
Find entities (people, places, organizations) in Wikidata. - cwrc/wikidata-entity-lookup
この機能を試しています。
使い方
以下などで、npmパッケージが公開されています。
www.npmjs.com
上記のリストにはありませんが、今回は以下を対象にします。
www.npmjs.com
以下でインストールします。
npm i wikidata-entity-lookup
wikidataLookup.findPersonは、以下のように実行することができました。
<script lang="ts" setup>
// @ts-ignore
import wikidataLookup from "wikidata-entity-lookup";
interface Entity {
id: string;
name: string;
description: string;
uri: string;
}
const query = ref<string>("");
const results = ref<Entity[]>([]);
const search = () => {
wikidataLookup.findPerson(query.value).then((result: Entity[]) => {
results.value = result;
});
};
</script>
デモ
Nuxtでの実装例を用意しました。
nuxt3-demo/pages/wikidata-entity-lookup/index.vue at main · nakamura196/nuxt3-demo
Sample Repository for Nuxt3 Including Examples of Various Library Usages - nakamura196/nuxt3-demo
以下でお試しいただけます。
nakamura196.github.io

まとめ
参考になりましたら幸いです。
動画版(生成AIによる自動生成): この記事の内容をずんだもん×四国めたんの掛け合いで解説しています。自動生成のため、内容に誤りがある可能性があります。正確な情報は記事本文をご参照ください。



コメント
…