Hugging Face SpacesとYOLOv5モデル(顔コレデータセットで学習済み)を使った推論アプリの構築

概要 Hugging Face Spacesと、YOLOv5モデル(顔コレデータセットで学習済み)を使った推論アプリを作成しました。 人文学オープンデータ共同利用センターが公開する顔コレデータセットは以下です。 Yingtao Tian, Chikahiko Suzuki, Tarin Clanuwat, Mikel Bober-Irizar, Alex Lamb, Asanobu Kitamoto, “KaoKore: A Pre-modern Japanese Art Facial Expression Dataset”, arXiv:2002.08595. http://codh.rois.ac.jp/face/dataset/ 推論アプリは、以下のURLからお試しいただけます。 https://huggingface.co/spaces/nakamura196/yolov5-face また以下のURLからソースコードや学習済みモデルをダウンロードすることができます。同様のアプリケーションを開発される際の参考になれば幸いです。 https://huggingface.co/spaces/nakamura196/yolov5-face/tree/main なお、アプリケーションの開発には、以下のSpaceを参考にしています。 https://huggingface.co/spaces/pytorch/YOLOv5 使い方 画像をアップロードするか、Examplesから画像を選択してご利用いただけます。以下のように認識結果を確認することができます。 『文正草子』(日本古典籍データセット(国文研所蔵)CODH配信) まとめ 検出精度が十分でない点がありますが、参考になりましたら幸いです。 現在はYOLOv5を用いたモデルですが、今後より新しいモデルも試してみたいと思います。

2024年10月5日 · 1 分 · Nakamura

ModuleNotFoundError: No module named 'huggingface_hub.utils._errors'対応

概要 Hugging FaceのSpacesにアプリをデプロイした際、以下のエラーが発生しました。このエラーに対する備忘録です。 Creating new Ultralytics Settings v0.0.6 file ✅ View Ultralytics Settings with 'yolo settings' or at '/home/user/.config/Ultralytics/settings.json' Update Settings with 'yolo settings key=value', i.e. 'yolo settings runs_dir=path/to/dir'. For help see https://docs.ultralytics.com/quickstart/#ultralytics-settings. WARNING ⚠️ DetectMultiBackend failed: No module named 'huggingface_hub.utils._errors' Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/yolov5/helpers.py", line 38, in load_model model = DetectMultiBackend( File "/usr/local/lib/python3.10/site-packages/yolov5/models/common.py", line 338, in __init__ result = attempt_download_from_hub(w, hf_token=hf_token) File "/usr/local/lib/python3.10/site-packages/yolov5/utils/downloads.py", line 150, in attempt_download_from_hub from huggingface_hub.utils._errors import RepositoryNotFoundError ModuleNotFoundError: No module named 'huggingface_hub.utils._errors' During handling of the above exception, another exception occurred: 参考 以下の記事が参考になりました。 ...

2024年10月4日 · 1 分 · Nakamura

Omeka Sで3Dモデルを公開する

概要 Omeka Sで3Dモデルを公開する方法について調べてみましたので、備忘録です。 結果、以下のように3DモデルをOmeka Sで扱うことができました。 https://omeka.aws.ldas.jp/s/sample/item/43 バージョン 使用するOmeka Sおよびモジュールのバージョンは以下です。 Omeka S 4.1.1 Common 3.4.62 IIIF Server 3.6.21 Universal Viewer 3.6.9 モジュールのインストール Common, IIIF Server, Universal Viewerモジュールをインストールします。 モジュールの設定 IIIF Serverモジュールについて、設定を2点行います。 まず、Default IIIF api version of the manifestを3にします。 また、Default IIIF image api versionをNo image serverにします。 glbファイルのアップロード 以下で公開されているglbファイルを利用させていただきます。 https://ft-lab.github.io/gltf.html 以下のように、apple.glbをメディアとして、新規のアイテムを登録します。 結果、サイトの詳細ページにおいて、Universal Viewer上に3Dモデルが表示されます。 https://omeka.aws.ldas.jp/s/sample/item/43 作成されるマニフェストファイルは以下です。 { "@context": "http://iiif.io/api/presentation/3/context.json", "id": "https://omeka.aws.ldas.jp/iiif/3/43/manifest", "type": "Manifest", "label": { "none": [ "glb" ] }, "metadata": [ { "label": { "none": [ "Title" ] }, "value": { "none": [ "glb" ] } } ], "rights": "https://rightsstatements.org/vocab/CNE/1.0/", "provider": [ { "id": "https://omeka.aws.ldas.jp/", "type": "Agent", "label": { "none": [ "Omeka S" ] } } ], "viewingDirection": "left-to-right", "seeAlso": [ { "id": "https://omeka.aws.ldas.jp/api/items/43", "type": "Dataset", "label": { "none": [ "Api rest json-ld" ] }, "format": "application/ld+json", "profile": "https://omeka.aws.ldas.jp/api-context" } ], "homepage": [ { "id": "https://omeka.aws.ldas.jp/s/aaa/item/43", "type": "Text", "label": { "none": [ "Resource in site: aaa" ] }, "format": "text/html", "language": [ "ja" ] } ], "items": [ { "@context": "http://iiif.io/api/presentation/3/context.json", "id": "https://omeka.aws.ldas.jp/iiif/3/43/canvas/p1", "type": "Canvas", "label": { "none": [ "1" ] }, "rights": "https://rightsstatements.org/vocab/CNE/1.0/", "items": [ { "id": "https://omeka.aws.ldas.jp/iiif/3/43/annotation-page/44", "type": "AnnotationPage", "items": [ { "id": "https://omeka.aws.ldas.jp/iiif/3/43/annotation/44", "type": "Annotation", "motivation": "painting", "body": { "id": "https://omeka.aws.ldas.jp/files/original/c28f7107525270b03b4314e734bbdd318d0342a4.glb", "type": "Model", "format": "model/gltf-binary", "service": [], "height": null, "width": null, "duration": null }, "target": "https://omeka.aws.ldas.jp/iiif/3/43/canvas/p1", "label": { "none": [ "[Untitled]" ] } } ] } ] } ] } まとめ Omeka Sと関連モジュールを使用することで、比較的に3Dモデルを公開することができました。 ...

2024年10月4日 · 2 分 · Nakamura

pythonを使ってcvatのデータを操作する

概要 pythonを使ってcvatのデータを操作する機会がありましたので、備忘録です。 セットアップ 今回はDockerを使って起動します。 git clone https://github.com/cvat-ai/cvat --depth 1 cd cvat docker compose up -d アカウントの作成 http://localhost:8080にアクセスして、アカウントを作成します。 Pythonによる操作 まず、以下のライブラリをインストールします。 pip install cvat-sdk アカウントの情報を.envに記載します。 host=http://localhost:8080 username= password= インスタンスの作成 import os from dotenv import load_dotenv import json from cvat_sdk.api_client import Configuration, ApiClient, models, apis, exceptions from cvat_sdk.api_client.models import PatchedLabeledDataRequest import requests from io import BytesIO load_dotenv(verbose=True) host = os.environ.get("host") username = os.environ.get("username") password = os.environ.get("password") configuration = Configuration( host=host, username=username, password=password ) api_client = ApiClient(configuration) タスクの作成 task_spec = { 'name': '文字の検出', "labels": [{ "name": "文字", "color": "#ff00ff", "attributes": [ { "name": "score", "mutable": True, "input_type": "text", "values": [""] } ] }], } try: # Apis can be accessed as ApiClient class members # We use different models for input and output data. For input data, # models are typically called like "*Request". Output data models have # no suffix. (task, response) = api_client.tasks_api.create(task_spec) except exceptions.ApiException as e: # We can catch the basic exception type, or a derived type print("Exception when trying to create a task: %s\n" % e) print(task) 以下のような結果が得られます。 ...

2024年10月4日 · 3 分 · Nakamura

Omeka SでのCSRF: Value is required and can’t be emptyエラーへの対応

概要 Omeka Sにおいて、多くのメディアが関連づけられたアイテムを保存しようとする際、CSRF: Value is required and can’t be emptyというエラーメッセージが表示され、保存が完了しない事象に遭遇しました。 本記事では、このエラーへの対処方法について説明します。 関連記事 以下の記事などで言及されています。既知のエラーのようで、php.iniを変更する必要があると述べられています。 https://forum.omeka.org/t/csrf-value-is-required-and-cant-be-empty/15421 https://github.com/omeka/omeka-s/issues/1472 対処方法 以下にチャットGPTによる回答を掲載します。 php.ini で max_input_vars を設定するには、以下の手順を実行してください。 php.ini ファイルを開きます。php.ini の場所は、環境によって異なるため、以下のいずれかのディレクトリにあることが多いです: /etc/php/8.x/apache2/php.ini (Apache) /etc/php/8.x/cli/php.ini (CLI) /etc/php/8.x/fpm/php.ini (PHP-FPM) max_input_vars の値を設定または変更します。設定するために、次の行を探します。または、存在しない場合は新しく追加します。 max_input_vars = 1000 1000 という値はデフォルトですが、必要に応じて大きな数に変更できます。例えば、5000に変更する場合は次のようにします。 max_input_vars = 5000 php.ini ファイルを保存します。 Webサーバーを再起動して設定を反映させます。例えば、Apache を使っている場合は、以下のコマンドを実行します。 sudo systemctl restart apache2 PHP-FPM を使用している場合は、次のように実行します。 sudo systemctl restart php8.x-fpm これで max_input_vars が設定され、Webサーバーがその設定を反映します。 まとめ 今回はmax_input_vars = 5000に設定することで、上記エラーを解消することができました。 同様のことでお困りの方の参考になりましたら幸いです。

2024年10月2日 · 1 分 · Nakamura

[2024年版] AWSサーバーレスアプリケーションによるIIIF Image Serverの構築

概要 AWSサーバーレスアプリケーションによるIIIF Image Serverの構築に関する2024年度版の記事です。 背景 以下で、serverless-iiifというリポジトリが公開されています。本リポジトリを用いることにより、AWSのサービスを用いて、コスト効率が高く、無限にスケーラブルなIIIF Image Serverを構築することができると謳われています。 https://github.com/samvera/serverless-iiif 以下で、2022年時点の使い方を紹介しましたが、今日のサービスはより使いやすいものになっていました。 方法 いくつか構築方法がありますが、GUIを通じた構築方法として、以下を参考にします。基本的な構築については、以下のサイトの通り行います。ここでは、CloudFrontとRoute 53によるカスタムドメインの設定を含む手順について紹介します。 Lambdaの作成 https://samvera.github.io/serverless-iiif/docs/quick-start/deployment-sam まず、以下にアクセスします。 https://console.aws.amazon.com/lambda/home#/create/app?applicationId=arn:aws:serverlessrepo:us-east-1:625046682746:applications/serverless-iiif カスタムドメインによる配信にあたり、いくつかの設定を行います。 まず、ForceHostの項目に、設定したいカスタムドメイン名を入力します。 さらに、SourceBucketにバケット名を入力します。以下の例ではたまたまカスタムドメインと同じ名前の例ですが、任意のバケット名を入力します。 最後に、「このアプリがカスタム IAM ロールを作成することを承認します。」にチェックを入れて、「デプロイ」ボタンを押します。 その後に遷移する以下のような画面において、「デプロイ」タブを選択して、「CloudFormation スタック」のリンクをクリックします。 「出力」タブに遷移すると、v2やv3のエンドポイントが確認できます。 tiled TIFFsの作成 以下のページなどを参考に、tiled TIFFsファイルを作成します。 https://samvera.github.io/serverless-iiif/docs/source-images または、「『石見国絵図』,写,〔江戸中期〕. 国立国会図書館デジタルコレクション 」の画像をtile TIFFsに変換したファイルを以下から取得いただけます。サンプルデータとしてお使いください。 https://github.com/nakamura196/iiif-sampledata/raw/main/1286204.tif このファイルを先に指定したAmazon S3のバケットにアップロードすると、以下のようなURLでImage APIにアクセスすることができます。 https://istxbnjtm5x7qcpkwapsznyltm0sufnb.lambda-url.us-east-1.on.aws/iiif/3/1286204/info.json 注意点として、上記の結果得られるJSONファイルのidには、https://iiif.aws.ldas.jp/iiif/3/1286204という値が指定されています。 これは、先の設定で、ForceHostに指定した値が反映されています。 なお、画像の閲覧には、神崎正英氏が作成されているImage Annotatorが便利です。以下のように、uパラメータでURLを指定すると、画像を表示することができます。 https://www.kanzaki.com/works/2016/pub/image-annotator?u=https://istxbnjtm5x7qcpkwapsznyltm0sufnb.lambda-url.us-east-1.on.aws/iiif/3/1286204/info.json カスタムドメインの設定 最後にカスタムドメインの設定を行います。 まず、CloudFrontでディストリビューションを作成します。Origin domainには、先ほどアクセスしたURLのon.awsで終わるところまでを入力します。 そして、「代替ドメイン名 (CNAME)」の箇所において、設定したいドメイン名を入力します。合わせて、「Custom SSL certificate」も設定します。 上記でCloudFrontの設定は完了です。 最後に、Route 53でCloudFrontディストリビューションへの設定を行います。 結果、以下のURLからJSONファイルを取得することができます。 https://iiif.aws.ldas.jp/iiif/3/1286204/info.json まとめ 誤っている点もあるかもしれませんが、AWSサーバーレスアプリケーションによるIIIF Image Serverの構築にあたり、参考になりましたら幸いです。 ...

2024年9月9日 · 1 分 · Nakamura

Drupalのカスタムモジュールで、カスタム権限を使用する

概要 Drupalのカスタムモジュールで、カスタム権限を使用する機会がありましたので、備忘録です。 背景 以下の記事で、DrupalからGitHubのActionsを実行するモジュールを紹介しました。 ただし、権限をadminister site configurationに設定しており、管理者権限のユーザしか実行することができませんでした。 この点に対応したコミットは以下です。 https://github.com/nakamura196/Drupal-module-github_webhook/commit/c3b6f57bebfeda0556c929c8ed8ed62a0eb0a5c4 方法 以下、ChatGPT 4oの回答結果を共有します。 Drupalの_permissionには、特定のアクセス権限を設定するための値を設定できます。これによって、特定の役割を持つユーザーが、そのルートにアクセスできるかどうかを制御します。 _permissionに設定できる主な値は以下のようなものです: 一般的な権限 Drupalには、いくつかの標準的な権限が用意されています。以下は一般的に使用される権限の例です: administer site configuration - サイト全体の設定を管理できる権限 access content - コンテンツへのアクセス権限 administer users - ユーザーを管理できる権限 create content - コンテンツを作成できる権限 edit any content - 任意のコンテンツを編集できる権限 delete any content - 任意のコンテンツを削除できる権限 view user profiles - ユーザープロフィールを閲覧できる権限 administer permissions - 権限を管理できる権限 access administration pages - 管理者ページへのアクセス権限 administer taxonomy - タクソノミーを管理できる権限 カスタム権限 モジュール固有の権限を作成することもできます。例えば、github_webhookモジュールに独自の権限を作成し、_permissionで使用することも可能です。 カスタム権限を作成する場合は、github_webhook.permissions.ymlに以下のように権限を定義します: access github webhook settings: title: 'Access GitHub Webhook Settings' description: 'Allows users to access and modify GitHub Webhook settings' restrict access: TRUE そして、routing.ymlでこのカスタム権限を設定します: ...

2024年9月9日 · 1 分 · Nakamura

校異源氏物語テキストDBで公開するTEI/XMLファイルに対するDTS APIのGitHubリポジトリ

概要 以下の記事で紹介したAPIのGitHubリポジトリを公開しました。 リポジトリは以下です。 https://github.com/nakamura196/dts-typescript 不完全な点があるかと思いますが、参考になりましたら幸いです。 メモ vercelのrewrite 以下のように設定することで、/へのアクセスを/api/dtsにリダイレクトさせることができました。 { "version": 2, "builds": [ { "src": "src/index.ts", "use": "@vercel/node" } ], "rewrites": [ { "source": "/api/dts(.*)", "destination": "/src/index.ts" } ], "redirects": [ { "source": "/", "destination": "/api/dts", "permanent": true } ] } collectionのID コレクションのIDとして以下を使用しています。 const COLLECTION_ID = "urn:kouigenjimonogatari"; 当初urn:プレフィックスをつけていませんでしたが、以下のMyCapytainライブラリから使用した際、urn:がない場合、/が挿入され、うまくいかないことがありました。 https://github.com/Capitains/MyCapytain まとめ 不完全な実装が多いですが、参考になりましたら幸いです。

2024年9月4日 · 1 分 · Nakamura

校異源氏物語テキストDBで公開するTEI/XMLファイルに対するDTS APIを作成する

概要 校異源氏物語テキストDBで公開するTEI/XMLファイルに対するDTS(Distributed Text Services) APIを作成したので、備忘録です。 背景 校異源氏物語テキストDBは以下です。 https://kouigenjimonogatari.github.io/ TEI/XMLファイルを公開しています。 開発したDTS 開発したDTSは以下です。 https://dts-typescript.vercel.app/api/dts Express.jsをVercelに設置しています。 DTSは以下を参考にしてください。 https://zenn.dev/nakamura196/articles/4233fe80b3e76d MyCapytainライブラリ 以下の記事で、DTSをPythonから利用するライブラリを紹介しました。 https://zenn.dev/nakamura196/articles/1f52f460025274 本ライブラリを使用して、開発したDTSを利用してみます。 Create the resolver With the following line we create the resolver : from MyCapytain.resolvers.dts.api_v1 import HttpDtsResolver resolver = HttpDtsResolver("https://dts-typescript.vercel.app/api/dts") Require metadata : let’s visit the catalog The following code is gonna find each text that is readable by Alpheios # We get the root collection root = resolver.getMetadata() # Then we retrieve dynamically all the readableDescendants : it browse automatically the API until # it does not have seen any missing texts: be careful with this one on huge repositories readable_collections = root.readableDescendants print("We found %s collections that can be parsed" % len(readable_collections)) We found 54 collections that can be parsed Printing the full tree # Note that we could also see and make a tree of the catalog. # If you are not familiar with recursivity, the next lines might be a bit complicated def show_tree(collection, char_number=1): for subcollection_id, subcollection in collection.children.items(): print(char_number*"--" + " " + subcollection.id) show_tree(subcollection, char_number+1) print(root.id) show_tree(root) default -- urn:kouigenjimonogatari ---- urn:kouigenjimonogatari.1 ---- urn:kouigenjimonogatari.2 ---- urn:kouigenjimonogatari.3 ---- urn:kouigenjimonogatari.4 ---- urn:kouigenjimonogatari.5 ---- urn:kouigenjimonogatari.6 ---- urn:kouigenjimonogatari.7 ---- urn:kouigenjimonogatari.8 ---- urn:kouigenjimonogatari.9 ---- urn:kouigenjimonogatari.10 ---- urn:kouigenjimonogatari.11 ---- urn:kouigenjimonogatari.12 ---- urn:kouigenjimonogatari.13 ---- urn:kouigenjimonogatari.14 ---- urn:kouigenjimonogatari.15 ---- urn:kouigenjimonogatari.16 ---- urn:kouigenjimonogatari.17 ---- urn:kouigenjimonogatari.18 ---- urn:kouigenjimonogatari.19 ---- urn:kouigenjimonogatari.20 ---- urn:kouigenjimonogatari.21 ---- urn:kouigenjimonogatari.22 ---- urn:kouigenjimonogatari.23 ---- urn:kouigenjimonogatari.24 ---- urn:kouigenjimonogatari.25 ---- urn:kouigenjimonogatari.26 ---- urn:kouigenjimonogatari.27 ---- urn:kouigenjimonogatari.28 ---- urn:kouigenjimonogatari.29 ---- urn:kouigenjimonogatari.30 ---- urn:kouigenjimonogatari.31 ---- urn:kouigenjimonogatari.32 ---- urn:kouigenjimonogatari.33 ---- urn:kouigenjimonogatari.34 ---- urn:kouigenjimonogatari.35 ---- urn:kouigenjimonogatari.36 ---- urn:kouigenjimonogatari.37 ---- urn:kouigenjimonogatari.38 ---- urn:kouigenjimonogatari.39 ---- urn:kouigenjimonogatari.40 ---- urn:kouigenjimonogatari.41 ---- urn:kouigenjimonogatari.42 ---- urn:kouigenjimonogatari.43 ---- urn:kouigenjimonogatari.44 ---- urn:kouigenjimonogatari.45 ---- urn:kouigenjimonogatari.46 ---- urn:kouigenjimonogatari.47 ---- urn:kouigenjimonogatari.48 ---- urn:kouigenjimonogatari.49 ---- urn:kouigenjimonogatari.50 ---- urn:kouigenjimonogatari.51 ---- urn:kouigenjimonogatari.52 ---- urn:kouigenjimonogatari.53 ---- urn:kouigenjimonogatari.54 Printing details about a specific one # Let's get a random one ! from random import randint # The index needs to be between 0 and the number of collections rand_index = randint(0, len(readable_collections)) collection = readable_collections[rand_index] # Now let's print information ? label = collection.get_label() text_id = collection.id print("Treaing `"+label+"` with id " + text_id) Treaing `総角` with id urn:kouigenjimonogatari.47 What about more detailed informations ? Like the citation scheme ? def recursive_printing_citation_scheme(citation, char_number=1): for subcitation in citation.children: print(char_number*"--" + " " + subcitation.name) recursive_printing_citation_scheme(subcitation, char_number+1) print("Maximum citation depth : ", collection.citation.depth) print("Citation System") recursive_printing_citation_scheme(collection.citation) Maximum citation depth : 1 Citation System -- line Let’s get some references ! reffs = resolver.getReffs(collection.id) print(reffs) # Nice ! DtsReferenceSet (DtsReference https://w3id.org/kouigenjimonogatari/api/items/1587-01.json> [line]>, DtsReference https://w3id.org/kouigenjimonogatari/api/items/1587-02.json> [line]>, DtsReference https://w3id.org/kouigenjimonogatari/api/items/1587-03.json> [line]>, DtsReference https://w3id.org/kouigenjimonogatari/api/items/1587-04.json> [line]>, DtsReference ... Let’s get some random passage ! # Let's get a random one ! from random import randint # The index needs to be between 0 and the number of collections rand_index = randint(0, len(reffs)-1) reff = reffs[rand_index] passage = resolver.getTextualNode(collection.id, reff) print(passage.id, passage.reference) # Let's see the XML here # For that, we need to get the mimetype right : from MyCapytain.common.constants import Mimetypes print(passage.export(Mimetypes.XML.TEI)) urn:kouigenjimonogatari.47 DtsReference https://w3id.org/kouigenjimonogatari/api/items/1640-06.json> [line]> TEI xmlns="http://www.tei-c.org/ns/1.0">dts:fragment xmlns:dts="https://w3id.org/dts/api#"> ... 考察 上記の通り、MyCapytainライブラリの基本操作に対応したDTSを構築することができました。 ...

2024年9月4日 · 3 分 · Nakamura

DTS(Distributed Text Services)を使ってみる

概要 DTS(Distributed Text Services)の使用方法を学ぶ機会があり、その備忘録です。 使用するAPI 以下で紹介されているAlpheios を使用します。 https://github.com/distributed-text-services/specifications/?tab=readme-ov-file#known-corpora-accessible-via-the-dts-api トップ https://texts.alpheios.net/api/dts collections, documents, navigationが使えることがわかります。 { "navigation": "/api/dts/navigation", "@id": "/api/dts", "@type": "EntryPoint", "collections": "/api/dts/collections", "@context": "dts/EntryPoint.jsonld", "documents": "/api/dts/document" } Collection Endpoint collections https://texts.alpheios.net/api/dts/collections 2つの下位コレクションが含まれることがわかります。 { "totalItems": 2, "member": [ { "@id": "urn:alpheios:latinLit", "@type": "Collection", "totalItems": 3, "title": "Classical Latin" }, { "@id": "urn:alpheios:greekLit", "@type": "Collection", "totalItems": 4, "title": "Ancient Greek" } ], "title": "None", "@id": "default", "@type": "Collection", "@context": { "dts": "https://w3id.org/dts/api#", "@vocab": "https://www.w3.org/ns/hydra/core#" } } Classical Latin idurn:alpheios:latinLitを指定して、コレクションをClassical Latinに限定します。 https://texts.alpheios.net/api/dts/collections?id=urn:alpheios:latinLit 3つの下位コレクションが含まれることがわかります。 { "totalItems": 3, "member": [ { "@id": "urn:cts:latinLit:phi0472", "@type": "Collection", "totalItems": 1, "title": "Catullus" }, { "@id": "urn:cts:latinLit:phi0620", "@type": "Collection", "totalItems": 1, "title": "Propertius, Sextus" }, { "@id": "urn:cts:latinLit:phi0959", "@type": "Collection", "totalItems": 1, "title": "Ovid" } ], "title": "Classical Latin", "@id": "urn:alpheios:latinLit", "@type": "Collection", "@context": { "dts": "https://w3id.org/dts/api#", "@vocab": "https://www.w3.org/ns/hydra/core#", "ns1": "http://www.w3.org/2004/02/skos/core#" }, "dts:extensions": { "ns1:prefLabel": [ { "@value": "Classical Latin", "@language": "eng" } ] } } Catullus idurn:cts:latinLit:phi0472を指定して、コレクションをCatullusに限定します。 ...

2024年9月4日 · 7 分 · Nakamura

DTSとCTSの関係

概要 DTS(Distributed Text Services)とCTS(Canonical Text Services protocol)の関係の調査結果です。 以下に記載がありました。 https://distributed-text-services.github.io/specifications/FAQ.html#what-is-the-relationship-between-dts-and-cts-are-they-redundant (機械翻訳)日本語訳 DTSとCTSの関係は何ですか?それらは重複していますか? DTS(Distributed Text Services)は、Canonical Text Services(CTS)プロトコルからインスピレーションを受け、その影響を受けて開発されました。CTSは、TEI形式でエンコードされた多くの古典的で正典的なテキストを、機械が処理可能な形でリンクドオープンデータとして提供することを可能にしました。しかし、CTS APIはCTS URN識別子システムに密接に結びついており、現代のコンテンツやパピルスや碑文などの他の形式の書き物で使用される引用システムには対応していません。また、このAPIはWeb APIに関する最新のコミュニティ標準にも準拠していません。 DTSはこれらの制限に対処し、さまざまなテキストにわたって標準化された、機械が処理可能な操作を可能にするために作成されました。DTSは、テキストコレクションを機械が処理可能なリンクドデータとして扱うためのハイパーメディア駆動のWebアプリケーションプログラミングインターフェース(API)を定義する、コミュニティ主導の取り組みです。DTS仕様は、コレクションの組織方法、参照に使用される永続的識別子の種類、メタデータに使用するオントロジー、テキスト自体の構造、APIの実装方法については規定していません。できる限り汎用的であり、コレクションのナビゲーション、テキスト内のナビゲーション、テキストコンテンツの取得のためのシンプルな操作を提供することを目指しています。DTSは、テキストコレクションを機械が処理可能なデータとして共有し、再利用するための標準的な方法を提供することを目指して、標準的で採用しやすい仕様を定義しています。 その他 参考までに、上記FAQの他の箇所の機械翻訳結果を掲載します。 DTSに関するよくある質問 DTSとは何ですか? DTSは、TEIドキュメントのコレクション向けのAPIです。 なぜTEIにコレクション用のAPIが必要なのですか? DTSは、クライアントがTEIドキュメントのコレクションと標準的な方法でやり取りできるようにします。標準APIにより、ユーザーは同じクライアントソフトウェアを使用して多くのテキストコレクションにアクセスできます。また、編集者は既存のクライアントが使用できる形でテキストコレクションを公開できるようになります。 DTSをダウンロードして使い始めるにはどうすればいいですか? ダウンロードできません。DTSはプログラム同士の通信方法を定義します。最終的にエンドユーザーがこのソフトウェアを使用します。ソフトウェア開発者向けにはDTSをサポートするライブラリがあり、それらはここにリストされています。 クライアントはこれらのドキュメントで何ができますか? クライアントがテキストデータでできることなら何でも可能です。例えば、このデータはユーザーが読める形で表示されたり、言語学的、文学的、談話的な特徴を分析したり、ユーザーがテキストに注釈を付けて有用なデータを作成できるツールで提示されたりします。 DTSは私のテキストをFAIRにするのに役立ちますか? はい!デジタルテキストコレクションの発行者は、DTS APIを使用して、そのテキストデータを見つけやすく(Findable)、アクセスしやすく(Accessible)、相互運用可能(Interoperable)で、再利用可能(Reusable)なFAIRな形にすることができます。 DTSは以下の方法でテキストデータのFAIRなデータプラクティスをサポートします: 発行者にテキストやコレクションに安定した永続的識別子を使用することを促す メタデータ記述のために標準的な語彙を使用することをサポート テキストコンテンツ自体とは別にメタデータを表現できるようにする 引用可能な単位に至るまで、テキストリソースの構造に関する情報への文書化された(が制約のない)アクセスを提供 テキストリソース間の関係を詳細に指定できるようにする DTSはどのようなAPIですか? DTSは、REST APIであり、Webブラウザのように機能します。クライアントソフトウェアがリクエストを送ると、サーバーはドキュメントを返します。クライアントはこのドキュメント内の情報を使用して、さらにリクエストを送ることができます。このAPIは、HTTPリクエストやレスポンスに含まれるドキュメントとヘッダーに基づいて完全に定義されています。つまり、DTSは言語に依存せず、デバッグが容易で、多くのユーザーに対してスケールすることができます。APIに詳しい人向けに言うと、DTSはピュアなハイパーメディア中心のREST APIで、HTTPの慣習に基づいて定義されています。 DTSは、ウェブサイトを作成するのと同じように構築されています。すべてが発見可能で、ユーザー(クライアント)が簡単に目的のものを見つけられるように整理されています。その上で、リンクされ共有されている語彙を使用し、データのウェブ全体で利用可能なものを活用しています。 Hydraとは何ですか?なぜHydraを使用するのですか? HydraはREST APIを構築するための良いフレームワークを提供します。私たちはゼロから始めるのではなく、標準を使用したかったのです。JSONとピュアなハイパーメディアベースのAPIのサポートが欲しかったため、Hydraを選びました。Hydraはコア機能を提供し、私たちのモデルに合わせてカスタマイズできる拡張性を提供します。(他の3つか4つのアプローチを試しましたが、Hydraが私たちのユースケースに最適でした。APIに関する宗教的な議論があることは承知していますが、これが私たちにとってうまく機能しました。) 私のテキストコレクションにDTS APIを実装すると、何が可能になりますか? DTS APIを実装することで、データの消費者は以下を簡単に取得できるようになります: コレクションメンバーのリスト 個々のコレクションアイテムに関するメタデータ テキスト内の引用可能なパッセージのリスト クライアントが定義したサイズ(例:10行ごとのグループ)で引用可能なパッセージのリスト ドキュメントの引用構造に関するメタデータ 引用階層の任意のレベルでの単一のテキストパッセージ 明確に定義された開始と終了のパッセージを含む範囲のテキストパッセージ 全体のテキスト DTSが必要とし、サポートする識別子スキームは何ですか? DTSは、URLパラメータとして安全に表現できる任意のコレクションおよびドキュメントの識別子スキームをサポートします。 DTSはネストされたコレクション(例:コレクションのコレクション)をサポートしますか? はい、サポートします。 DTSは複数レベルのテキスト引用階層をサポートしますか? はい、サポートします。 DTSはドキュメント内で異なるテキスト引用階層をサポートしますか? はい、サポートします。 私のテキストがTEI/XML形式で公開されていなくてもDTSを使用できますか? はい、部分的に使用できます。 ...

2024年9月4日 · 1 分 · Nakamura

MyCapytainライブラリを試す

概要 以下のMyCapytainライブラリを試します。 https://github.com/Capitains/MyCapytain 背景 以下の記事で、CTS(Canonical Text Service)を取り上げました。 以下のページにおいて、CITE, CTS, CapiTainSの説明がなされています。 https://brillpublishers.gitlab.io/documentation-cts/DTS_Guidelines.html The following document is about CITE, a system for the identification of texts and any other object. CTS is the name for the identification system itself. CapiTainS is the name for the software suite built around it. Before we go into details, we need to ask two questions: (機械翻訳)以下の文書は、CITE(テキストおよびその他のオブジェクトを識別するためのシステム)に関するものです。CTSは、この識別システム自体の名前です。CapiTainSは、その周りに構築されたソフトウェアスイートの名前です。詳細に入る前に、2つの質問をする必要があります。 さらに、今回使用するMyCapytainライブラリは以下のように説明されています。 MyCapytain is a python library which provides a large set of methods to interact with Text Services API such as the Canonical Text Services, the Distributed Text Services. It also provides a programming interface to exploit local textual resources developed according to the Capitains Guidelines. ...

2024年9月4日 · 6 分 · Nakamura

Canonical Text Serviceを試す

概要 Canonical Text Serviceは、以下のように説明されています。 The Canonical Text Services protocol defines interaction between a client and server providing identification of texts and retrieval of canonically cited passages of texts. (機械翻訳)Canonical Text Services (CTS) プロトコルは、テキストの識別と、正規に引用されたテキストの箇所の取得を提供するクライアントとサーバー間の相互作用を定義しています。 以下のサイトを参考にしています。 http://cts.informatik.uni-leipzig.de/Canonical_Text_Service.html 使用方法 以下を参考にしています。 https://github.com/cite-architecture/cts_spec/blob/master/md/specification.md GetCapabilities サーバーがサポートしているサービスを確認するためのリクエストです。 http://cts.informatik.uni-leipzig.de/pbc/cts/?request=GetCapabilities <GetCapabilities xmlns="http://relaxng.org/ns/structure/1.0" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ti="http://chs.harvard.edu/xmlns/cts"> <request>GetCapabilities</request> <reply> <TextInventory tiversion="5.0.rc.1"> <corpuslicense>Public Domain</corpuslicense> <corpussource>http://paralleltext.info/data/</corpussource> <corpuslanguage>arb,ceb,ces,cym,deu,eng,fin,fra,ita,mya,rus,tgl,ukr</corpuslanguage> <corpusname>Parallel Bible Corpus</corpusname> <corpusdescription>The Bible corpus contains 1169 unique translations, which have been assigned 906 different ISO-639-3 codes. This CTS instance contains 20 bible translations from PBC that are available as Public Domain.</corpusdescription> <textgroup urn="urn:cts:pbc:bible"> <groupname>bible</groupname> <edition urn="urn:cts:pbc:bible.parallel.arb.norm:"> <title>The Bible in Arabic</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1865</publicationDate> <language>arb</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.ceb.bugna:"> <title>Cebuano Ang Biblia (Bugna Version)</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1917</publicationDate> <language>ceb</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.ces.kralicka:"> <title>Czech Bible Kralicka. Version of 1613</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1613</publicationDate> <language>ces</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.cym.morgan1804:"> <title>Beibl William Morgan. William Morgan Bible in Welsh.</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1804</publicationDate> <language>cym</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.deu.elberfelder1871:"> <title>Die Bibel in Deutsch. Elberfelder Version von 1871. The Bible in German, Elberfelder Version of 1871</title> <license>´Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1871</publicationDate> <language>deu</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.deu.elberfelder1905:"> <title>Die Bibel in Deutsch. Elberfelder 1905. The Bible in German</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1905</publicationDate> <language>deu</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.deu.luther1545:"> <title>Die Bibel in Deutsch. Luther Version von 1545. The Bible in German. Luther version of 1545.</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1545</publicationDate> <language>deu</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.deu.luther1545letztehand:"> <title>Luther 1545 (Letzte Hand). The Bible in German</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1545</publicationDate> <language>deu</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.deu.luther1912:"> <title>Die Bibel in Deutsch. Luther Version von 1912. The Bible in German. Luther version of 1912.</title> <license>public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1912</publicationDate> <language>deu</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.eng.darby:"> <title>The Bible in English. Darby Translation.</title> <license>Public Domain</license> <publicationDate>1890</publicationDate> <language>eng</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.eng.kingjames:"> <title>King James Version of the Christian Bible</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1611</publicationDate> <language>eng</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.fin.1766:"> <title>Pyhä Raamattu. Version of 1776. The Bible in Finnish</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1776</publicationDate> <language>fin</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.fra.davidmartin:"> <title>The Bible in French. David Martin Version.</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1744</publicationDate> <language>fra</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.fra.kingjames:"> <title>The Bible in French. King James Version.</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1881</publicationDate> <language>fra</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.fra.louissegond:"> <title>The Bible in French. Louis Segond Version.</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1910</publicationDate> <language>fra</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.ita.diodati:"> <title>The Bible in Italian. Giovanni Diodati Bibbia Version.</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1649</publicationDate> <language>ita</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.mya.1835:"> <title>The New Testament in Myanmar</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1835</publicationDate> <language>mya</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.rus.synodal:"> <title>Синодальный перевод. The Synodal Bible in Russian.</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1876</publicationDate> <language>rus</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.tgl.1905:"> <title>The Bible in Tagalog.</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>1905</publicationDate> <language>tgl</language> <contentType>xml</contentType> </edition> <edition urn="urn:cts:pbc:bible.parallel.ukr.2009:"> <title>Ukrainian Version. The Bible in Ukranian.</title> <license>Public Domain</license> <source>http://paralleltext.info/data/ retrieved via Canonical Text Service http://cts.informatik.uni-leipzig.de/pbc/cts/</source> <publicationDate>2009</publicationDate> <language>ukr</language> <contentType>xml</contentType> </edition> </textgroup> </TextInventory> </reply> </GetCapabilities> GetPassage 指定したURN(Uniform Resource Name)に基づいて、特定のテキストの一部を取得します。 ...

2024年9月4日 · 12 分 · Nakamura

IIIF Presentation API v3でsvgを使ったアノテーション記述

概要 IIIF Presentation API v3でsvgを使ったアノテーション記述を行う機会がありましたので、備忘録です。 方法 以下のように記述することで、svgを使ったアノテーションを表示することができました。 { "@context": "http://iiif.io/api/presentation/3/context.json", "id": "http://127.0.0.1:62816/api/iiif/3/11/manifest", "type": "Manifest", "label": { "none": [ "きりつぼ" ] }, "rights": "http://creativecommons.org/licenses/by/4.0/", "requiredStatement": { "label": { "none": [ "Attribution" ] }, "value": { "none": [ "Provided by Example Organization" ] } }, "items": [ { "id": "http://127.0.0.1:62816/api/iiif/3/11/canvas/p1", "type": "Canvas", "width": 6642, "height": 4990, "label": { "none": [ "[1]" ] }, "thumbnail": [ { "format": "image/jpeg", "id": "https://iiif.dl.itc.u-tokyo.ac.jp/iiif/genji/TIFF/A00_6587/01/01_0023.tif/full/200,/0/default.jpg", "type": "Image" } ], "annotations": [ { "id": "http://127.0.0.1:62816/api/iiif/3/11/canvas/p1/annos", "type": "AnnotationPage", "items": [ { "id": "http://127.0.0.1:62816/api/iiif/3/11/canvas/p1/annos/1", "type": "Annotation", "motivation": "commenting", "body": { "type": "TextualBody", "value": "<p>校異源氏物語 p.21 開始位置</p><p><a href=\"http://dl.ndl.go.jp/info:ndljp/pid/3437686/30\">国立国会図書館デジタルコレクション</a>でみる</p>" }, "target": { "source": "http://127.0.0.1:62816/api/iiif/3/11/canvas/p1", "type": "SpecificResource", "selector": { "type": "SvgSelector", "value": "<svg xmlns='http://www.w3.org/2000/svg'><path xmlns=\"http://www.w3.org/2000/svg\" d=\"M2798,1309c0,-34 17,-68 51,-102c0,-34 -17,-51 -51,-51c-34,0 -51,17 -51,51c34,34 51,68 51,102z\" id=\"pin_abc\" fill-opacity=\"0.5\" fill=\"#F3AA00\" stroke=\"#f38200\"/></svg>" } } } ] } ], "items": [ { "id": "http://127.0.0.1:62816/api/iiif/3/11/canvas/p1/page", "type": "AnnotationPage", "items": [ { "id": "http://127.0.0.1:62816/api/iiif/3/11/canvas/p1/page/imageanno", "type": "Annotation", "motivation": "painting", "body": { "id": "http://127.0.0.1:62816/api/iiif/3/11/image", "type": "Image", "format": "image/jpeg", "service": [ { "id": "https://iiif.dl.itc.u-tokyo.ac.jp/iiif/genji/TIFF/A00_6587/01/01_0023.tif", "type": "ImageService2", "profile": "level2" } ], "width": 6642, "height": 4990 }, "target": "http://127.0.0.1:62816/api/iiif/3/11/canvas/p1" } ] } ] } ] } 表示結果は以下です。 ...

2024年9月3日 · 2 分 · Nakamura

Archivematicaでフォルダにメタデータを登録する際には、日本語のフォルダ名は避ける

概要 Archivematicaでフォルダにメタデータを登録する際には、日本語のフォルダ名は避ける必要がありましたので、その備忘録です。 メタデータ 以下のような/metadata/metadata.csvファイルを用意することにより、AIPにメタデータを含めることができます。 filename dc.type objects/aaa フォルダ objects/aaa/MARBLES.TGA 画像 この時、aaaを日本語で用意すると、当該レコードに関するメタデータが登録されませんでした。 まとめ 同様のことでお困りの方の参考になりましたら幸いです。

2024年8月27日 · 1 分 · Nakamura

GUIE(Google Universal Image Embedding)の学習済みモデルを使用して類似画像検索を行う

概要 GUIE(Google Universal Image Embedding)の学習済みモデルを使用して類似画像検索を行うサンプルプログラムを作成しました。以下からノートブックにアクセスいただけます。 https://colab.research.google.com/github/nakamura196/000_tools/blob/main/guie_sample.ipynb 参考 以下のノートブックの出力ファイルであるモデルを利用しています。 https://www.kaggle.com/code/francischen1991/tf-baseline-v2-submission 使用上の注意 Kaggleのアカウント ノートブックの実行には、Kaggleのアカウントが必要です。Kaggle API Keyを取得して、それらをシークレットに登録します。 以下が表示された場合には、「アクセスを許可」を押してください。 また、Kaggleからモデルをダウンロードする部分で、一定時間待つ必要があります。 実行結果 以下のように、類似画像検索の結果が表示されます。 ジャパンサーチで公開されているギャラリー「祇園祭」の一部画像を利用しています。 https://jpsearch.go.jp/gallery/ndl-kbjG03kKgjp メモ torchvisionのバージョン Google Colabにデフォルトでインストールされているtorchvisionではうまく動作せず、バージョンを0.12.0あたりまで下げる必要がありました。 まとめ 今後、Elasticsearchの近似最近傍探索を使って、今回作成したベクトルに対する検索を行いたいと思います。 https://www.elastic.co/guide/en/elasticsearch/reference/current/knn-search.html 参考になりましたら幸いです。

2024年8月27日 · 1 分 · Nakamura

DrupalからGitHubのActionsを実行するモジュールを作成しました。

概要 DrupalからGitHubのActionsを実行するモジュールを作成しました。 https://github.com/nakamura196/Drupal-module-github_webhook 以下、使い方について説明します。 使い方 設定 モジュールのインストール後、以下にアクセスします。 /admin/config/github_webhook 以下のような画面に遷移します。 大きく、Respositories とTrigger Webhook に分かれています。 まず、Respositories のRepository 1にGitHub Actionsの実行対象のリポジトリの情報を入力します。Add repositoryやRemove repositoryから、リポジトリの追加と削除を行うことができます。 Event Typeには、GitHub Actions側で設定した値を入力します。初期値のwebhookは、以下のようなActionsを想定しています。 name: Deploy to GitHub Pages on: push: branches: ["main"] workflow_dispatch: repository_dispatch: types: [webhook] permissions: contents: read pages: write id-token: write concurrency: group: "pages" cancel-in-progress: true jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 ... 設定後、画面下部の送信 ボタンを押して保存します。 ...

2024年8月24日 · 1 分 · Nakamura

Nuxtで@elastic/search-uiを使ったサンプルリポジトリを作成しました。

概要 Nuxtで@elastic/search-uiを使ったサンプルリポジトリを作成しました。 https://github.com/nakamura196/nuxt-search-ui-demo 以下からお試しいただけます。 https://nakamura196.github.io/nuxt-search-ui-demo 背景 @elastic/search-uiは以下のように説明されています。 https://www.elastic.co/docs/current/search-ui/overview A JavaScript library for the fast development of modern, engaging search experiences with Elastic. Get up and running quickly without re-inventing the wheel. (機械翻訳)Elasticを使用して、モダンで魅力的な検索エクスペリエンスを迅速に開発するためのJavaScriptライブラリです。車輪を再発明することなく、すぐに使い始めることができます。 以下でVue.jsを使ったサンプルリポジトリが公開されています。 https://github.com/elastic/vue-search-ui-demo 今回は上記のリポジトリを参考に、Nuxtを使ったサンプルリポジトリを作成しました。 メモ 初期検索 以下のように指定することで、初期読み込み時の検索を実行することができました。 https://github.com/nakamura196/nuxt-search-ui-demo/blob/main/searchConfig.ts#L49 alwaysSearchOnInitialLoad: true, 公式ドキュメントの以下に記載がありました。 https://www.elastic.co/docs/current/search-ui/api/react/search-provider 参考: カスタムconnectorの作成 以下を参考にカスタムconnectorを作成することで、Elasticsearch以外のAPIでも使用することができました。 https://www.elastic.co/docs/current/search-ui/guides/building-a-custom-connector 具体的には以下のような手順を参考に、Drupalで作成したJSON:API Search APIと組み合わせて使用することも可能でした。 https://next-drupal.org/guides/search-api まとめ 検索機能を持つアプリケーションの作成にあたり、参考になりましたら幸いです。

2024年8月23日 · 1 分 · Nakamura

縦書きに対応したText Overlay pluginを導入済みのMiradorのリポジトリ

概要 縦書きに対応したText Overlay pluginを導入済みのMiradorのリポジトリを更新しました。 https://github.com/nakamura196/mirador-integration-textoverlay 参考 変更元のText Overlay pluginのリポジトリは以下です。 https://github.com/dbmdz/mirador-textoverlay デモ 以下のページで動作内容をご確認いただけます。 https://nakamura196.github.io/mirador-integration-textoverlay/ 画面右上の「Text visible」ボタンを押すと、テキストが表示されます。ロード中のままとなってしまう場合には、ページの再読み込みをしてください。 参考 以下の記事で紹介した方法を使い、Text Overlay pluginをMirador 3に追加しています。 使用例 Text Overlay pluginの使用方法などについては、以下の記事を参考にしてください。 まとめ 今後、テキスト表示にあたり、ロードしたままになってしまう不具合を解消したいと思います。 IIIF画像とテキストの応用にあたり、参考になりましたら幸いです。

2024年8月23日 · 1 分 · Nakamura

Archivematicaのサンプルデータ

概要 Archivematicaのサンプルデータは以下のリポジトリに格納されています。 https://github.com/artefactual/archivematica-sampledata 補足 Archivematicaでは、Standard, Zipped directory, Zipped bagなど、複数の入力タイプをサポートしています。 これらのタイプごとにどのようなファイルおよびフォルダを用意すればよいのか、という際に、上記のリポジトリのデータが参考になります。 例: メタデータを記述したCSVファイルと共に登録する マニュアルの記載箇所は以下です。 https://www.archivematica.org/en/docs/archivematica-1.16/user-manual/transfer/transfer/#transfers-with-metadata 以下にサンプルがあります。 https://github.com/artefactual/archivematica-sampledata/tree/master/SampleTransfers/CSVmetadata 例: Submission documentationと共に登録する マニュアルの記載箇所は以下です。 https://www.archivematica.org/en/docs/archivematica-1.16/user-manual/transfer/transfer/#create-submission 以下にサンプルがあります。「メタデータを記述したCSVファイルと共に登録する」と同じです。 https://github.com/artefactual/archivematica-sampledata/tree/master/SampleTransfers/CSVmetadata まとめ 参考になりましたら幸いです。

2024年8月23日 · 1 分 · Nakamura