以下の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.
(機械翻訳)MyCapytainは、Canonical Text ServicesやDistributed Text ServicesといったText Services APIと連携するための多くのメソッドを提供するPythonライブラリです。また、Capitainsガイドラインに従って開発されたローカルのテキストリソースを活用するためのプログラミングインターフェースも提供しています。
セットアップ# g c p s p i d y o i t t u p M h r c y o c i l C n e n o a s n p - t e y m v a t e l h a v n l t i e v t n n / - p b r s i : n r / v / e / e a q g n c u i v t i t i r h v e u a m b t e . e n c t o s m . / t C x a t p i t a i n s / M y C a p y t a i n 使い方: DTS(Distributed Text Services)の利用# 以下で、サンプルプログラムが用意されています。
https://github.com/Capitains/MyCapytain/blob/dev/notebooks/Example DTS Remote Resolver.ipynb
以下のAlpheios.netのAPIに問い合わせを行っています。
http://texts.alpheios.net/api/dts
例えば、以下により、Alpheiosによって読み取れる各テキストを検索します。
f r # r # # r p r e o e r o s W o T i a i m o e t h t d n l e a t M v g = n d b ( y e e o l " C r t r w e e W a e e s _ e p = t s c y h o r n o f t H e l e o l o a t v t t l u i t r e r e n n p o r i h c d . D o . e a t r t t g v v i % e s e e e o s s R c t n o e o M d s s c l s l e y e o v o l t n e = l e l e a a n l r v c d m r e s e t a i a o c . r i t c n o t d ( o a a y t i t " n ( l . o s h ) l m r n . t y i e s a t s a p p a s d t i : l i a h _ / l n b a v / g l t 1 t t e e h t D c i x e e e a m t x s n p s r t c o . e s e b r a a : n e t l d d p a b a p H h b e n a t e l t r t i e c s s p o D a e D s e r d t . s e " s n c f R e e u % e t n l s / d l o a a w e l p n i n v i t t ( e / s h r r d e t : t a s h d " i i a ) t s b l b o e r n _ o e c w o s o l e n l e a h c u u t t g i o e o m n a r s t e ) i p ) c o a s l i l t y o r t i h e e s A P I u n t i l
使い方: CTS(Canonical Text Service)の利用# CTSの利用にあたっては、以下でサンプルプログラムが公開されていますが、そのままでは動きませんでした。
https://mycapytain.readthedocs.io/en/latest/
まず http://cts.dh.uni-leipzig.de/api/cts/ が http://cts.informatik.uni-leipzig.de/pbc/cts/ に変更になっているようでした。
以下を修正する必要がありました。
# f r f o r m o m M y M C y a C p a y p t y a t i a n i . n r . e r t e r t i r e i v e e v r e s r . s c . t c s t 5 s 5 i m i p m o p r o t r t H t C t T p S C t s R e t r i e v e r
そこで、以下のようにプログラムを修正することで、正しく問い合わせを行うことができました。
f r p # p r e a r o t s P i m r s a n i a s t M e g s ( y v e a p C e g a a r = e s p s y = r i a t e s g a H t e i t r n ) n t i o . p e w r C v e t e e t s r q r R . u i e g a e t e l v r t e i P t r e a o s v s . e s t c r a h t ( g e s " e 5 h ( s t " t i t u r m p r i p : n n o / : g r / c t c t c t s o H s : n t . p t t i b e p n c n C f : t t o b s r i o R m b f e a l t t e h r i . t i k p t e . a p v u r : e n a / r i l / - l c l e t e l s i . . p e i z n n i g f g . o . k r d i m e n a / g t p j i b a k c m . / e u c s n t : i s 1 - / . l " 3 e ) " i ) p z i g . d e / p b c / c t s / ? r e q u e s t = G e t P a s s a g e & u r n = u r n : c t s : p b c : b i b l e . p a r a l l e l . e n g . k i n g j a m e s : 1 . 3
結果、以下が得られました。
< < ? G / x e < < G m t r / r / e l P e < < r e < < < < r t a q r r e p u p l s e P v s u e e q l r a i o p a e s e q q u y n s c u l s r a s u u e > > s e r y s s g t e e s u a n c > a i e > s s t r g s e g o t t > n e e > e n x N U : > > h > = m a r c N P t " l m n t o u t 1 n e > s w b p . s > u : l : 0 = G r p t i / " " e n b h c / h t : c e p e t P c : D a n t a t b s o r c p s s i e m a o : s : b r a l d / a p l p i l i / g b e e n e n r e c . n < l g e < : p t / t = l / b a l e " a r i r w i x U x e b a a c t T n q l l s e . F g u e l n i - . e . e m s n 8 o s p l o e f " r t a . r > o ? g N r e e / > / a a n d n m l g s a s e l . u t / > e k b a s l i t / t . n i r e g l r u n j e c g a t t t . m h r u k e a i r i s n e e n : v / g 1 a e 1 j . n d . a 3 y 0 m < v " e / b i s u e a x : r a m 1 n s C l . > t a n 3 n s < o o : / f n a r i = e t c " q h a h u e l t e t s f T p t i e : U e x / r l t / n d r > S e w e l h r a i v x c i n h c g e . t o h h r e t g t / L p n O : s R / / D / c c o G t m o s p d . a i t h n i a f b d o i r l m m i a a t d t y e i / k a . . n u n A n o n i t d - a l t h e i e i o p n s z s a i / i g 1 d . . d 0 u e " n / t p x o b m c l t / n h c s e t : s t w / e o i m w = a i " n t h h t , t C p Y T : e S / a / U w , R w N w h . a u t t r e h n i : - G c c o t . d s o : r s p g a b / i c n d : s b / , i 1 b . Y l 0 e e " . > s p h a a r l a l l l n e o l t . e e n a g t . k o i f n g e j v a e m r e y s : t 1 r . e 3 e < / o s f o u t r h c e e > g a r d e n ? A n d t h e w o m a n s a i d u n t o t h e s e r p e n t , W e m a y e a t o f t h e f r u i t o f t h e t r e e s o f t h e g a r d e n : B u t o f t h e f r u i t o f t h e t r e e w h i c h i s i n t h e m i d s t o f t h e g a r d e n , G o d h a t h s a i d , Y e s h a l l n o t e a t o f i t , n e i t h e r s h a l l y e t o u c h i t , l e s t y e d i e . A n d t h e s e r p e n t s a i d u n t o t h e w o m a n , Y e s h a l l n o t s u r e l y d i e : F o r G o d d o t h k n o w t h a t i n t h e d a y y e e a t t h e r e o f , t h e n y o u r e y e s s h a l l b e o p e n e d , a n d y e s h a l l b e a s g o d s , k n o w i n g g o o d a n d e v i l . A n d w h e n t h e w o m a n s a w t h a t t h e t r e e w a s g o o d f o r f o o d , a n d t h a t i t w a s p l e a s a n t t o t h e e y e s , a n d a t r e e t o b e d e s i r e d t o m a k e o n e w i s e , s h e t o o k o f t h e f r u i t t h e r e o f , a n d d i d e a t , a n d g a v e a l s o u n t o h e r h u s b a n d w i t h h e r ; a n d h e d i d e a t . A n d t h e e y e s o f t h e m b o t h w e r e o p e n e d , a n d t h e y k n e w t h a t t h e y w e r e n a k e d ; a n d t h e y s e w e d f i g l e a v e s t o g e t h e r , a n d m a d e t h e m s e l v e s a p r o n s . A n d t h e y h e a r d t h e o i c e o f t h e L O R D G o d w a l k i n g i n t h e g a r d e n i n t h e c o o l o f t h e d a y : a n d A d a m a n d h i s w i f e h i d t h e m s e l v e s f r o m t h e p r e s e n c e o f t h e L O R D G o d a m o n g s t t h e t r e e s o f t h e g a r d e n . A n d t h e L O R D G o d c a l l e d u n t o A d a m , a n d s a i d u n t o h i m , W h e r e a r t t h o u ? A n d h e s a i d , I h e a r d t h y o i c e i n t h e g a r d e n , a n d I w a s a f r a i d , b e c a u s e I w a s n a k e d ; a n d I h i d m y s e l f . A n d h e s a i d , W h o t o l d t h e e t h a t t h o u w a s t n a k e d ? H a s t t h o u e a t e n o f t h e t r e e , w h e r e o f I c o m m a n d e d t h e e t h a t t h o u s h o u l d e s t n o t e a t ? A n d t h e m a n s a i d , T h e w o m a n w h o m t h o u g a v e s t t o b e w i t h m e , s h e g a v e m e o f t h e t r e e , a n d I d i d e a t . A n d t h e L O R D G o d s a i d u n t o t h e w o m a n , W h a t i s t h i s t h a t t h o u h a s t d o n e ? A n d t h e w o m a n s a i d , T h e s e r p e n t b e g u i l e d m e , a n d I d i d e a t . A n d t h e L O R D G o d s a i d u n t o t h e s e r p e n t , B e c a u s e t h o u h a s t d o n e t h i s , t h o u a r t c u r s e d a b o v e a l l c a t t l e , a n d a b o v e e v e r y b e a s t o f t h e f i e l d ; u p o n t h y b e l l y s h a l t t h o u g o , a n d d u s t s h a l t t h o u e a t a l l t h e d a y s o f t h y l i f e : A n d I w i l l p u t e n m i t y b e t w e e n t h e e a n d t h e w o m a n , a n d b e t w e e n t h y s e e d a n d h e r s e e d ; i t s h a l l b r u i s e t h y h e a d , a n d t h o u s h a l t b r u i s e h i s h e e l . U n t o t h e w o m a n h e s a i d , I w i l l g r e a t l y m u l t i p l y t h y s o r r o w a n d t h y c o n c e p t i o n ; i n s o r r o w t h o u s h a l t b r i n g f o r t h c h i l d r e n ; a n d t h y d e s i r e s h a l l b e t o t h y h u s b a n d , a n d h e s h a l l r u l e v e r t h e e . A n d u n t o A d a m h e s a i d , B e c a u s e t h o u h a s t h e a r k e n e d u n t o t h e o i c e o f t h y w i f e , a n d h a s t e a t e n o f t h e t r e e , o f w h i c h I c o m m a n d e d t h e e , s a y i n g , T h o u s h a l t n o t e a t o f i t : c u r s e d i s t h e g r o u n d f o r t h y s a k e ; i n s o r r o w s h a l t t h o u e a t o f i t a l l t h e d a y s o f t h y l i f e ; T h o r n s a l s o a n d t h i s t l e s s h a l l i t b r i n g f o r t h t o t h e e ; a n d t h o u s h a l t e a t t h e h e r b o f t h e f i e l d ; I n t h e s w e a t o f t h y f a c e s h a l t t h o u e a t b r e a d , t i l l t h o u r e t u r n u n t o t h e g r o u n d ; f o r o u t o f i t w a s t t h o u t a k e n : f o r d u s t t h o u a r t , a n d u n t o d u s t s h a l t t h o u r e t u r n . A n d A d a m c a l l e d h i s w i f e ' s n a m e E v e ; b e c a u s e s h e w a s t h e m o t h e r o f a l l l i v i n g . U n t o A d a m a l s o a n d t o h i s w i f e d i d t h e L O R D G o d m a k e c o a t s o f s k i n s , a n d c l o t h e d t h e m . A n d t h e L O R D G o d s a i d , B e h o l d , t h e m a n i s b e c o m e a s o n e o f u s , t o k n o w g o o d a n d e v i l : a n d n o w , l e s t h e p u t f o r t h h i s h a n d , a n d t a k e a l s o o f t h e t r e e o f l i f e , a n d e a t , a n d l i v e f o r e v e r : T h e r e f o r e t h e L O R D G o d s e n t h i m f o r t h f r o m t h e g a r d e n o f E d e n , t o t i l l t h e g r o u n d f r o m w h e n c e h e w a s t a k e n . S o h e d r o v e o u t t h e m a n ; a n d h e p l a c e d a t t h e e a s t o f t h e g a r d e n o f E d e n C h e r u b i m s , a n d a f l a m i n g s w o r d w h i c h t u r n e d e v e r y w a y , t o k e e p t h e w a y o f t h e t r e e o f l i f e / p a s s a g e > まとめ# 基本的な動作確認のみですが、参考になりましたら幸いです。