blob: e20c559153be7ffe6ac9c4f4f309a454712e5f19 [file] [log] [blame]
Akron627a80a2016-01-29 19:38:18 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Test::More skip_all => 'Not yet implemented';
6use lib 't/index';
7use File::Basename 'dirname';
8use File::Spec::Functions 'catdir';
9
10my $path = catdir(dirname(__FILE__), 'corpus', 'doc', '0001');
11
12use_ok('KorAP::XML::Krill');
13
14ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
15
16ok($doc->parse
17 ->tokenize
Akrona977e172016-02-23 17:41:41 +010018 ->annotate('Base', 'Sentences')
19 ->annotate('Base', 'Paragraphs')
20 ->annotate('DeReKo', 'Struct'), 'Annotate');
Akron627a80a2016-01-29 19:38:18 +010021
22# Metdata
23is($doc->text_sigle, 'Corpus_Doc.0001', 'ID-text');
24is($doc->doc_sigle, 'Corpus_Doc', 'ID-doc');
25is($doc->corpus_sigle, 'Corpus', 'ID-corpus');
26is($doc->title, 'Beispiel Text', 'title');
27is($doc->sub_title, 'Beispiel Text Untertitel', 'title');
28
Akrona977e172016-02-23 17:41:41 +010029# diag $doc->to_json;
30
Akron627a80a2016-01-29 19:38:18 +010031done_testing;
32__END__
Akrona977e172016-02-23 17:41:41 +010033
34{
35 "@context" : "http://korap.ids-mannheim.de/ns/koral/0.4/context.jsonld",
36# Add krill context!
37 "text" : {
38 "@type" : "koral:corpus",
39 "meta" : {
40 "@type" : "koral:meta",
41 "s_sigle" : "BSP",
42 "s_id" : "BSP",
43 "t_title" : "Der Name als Text",
44 "k_keywords" : ["Some", "Keywords"],
45 "d_date" : "2015-12-03"
46 },
47 "@value" : {
48 "@type" : "koral:doc",
49 "meta" : {
50 "@type" : "koral:meta",
51 "s_sigle" : "BSP/AAA",
52 "s_id" : "AAA"
53 },
54 "@value" : {
55 "@type" : "koral:text",
56 "meta" : {
57 "@type" : "koral:meta",
58 "s_sigle" : "BSP/AAA/0001",
59 "s_id" : "0001",
60 "s_language" : "de"
61 },
62 "store" : {
63 ...
64 },
65 "@value" : {
66 "@type" : "krill:stream",
67 "source" : "opennlp#tokens",
68 "layer" : ["base/s=spans"],
69 "primary" : "...",
70 "name" : "tokens",
71 "foundries": ["base","base/paragraphs","base/sentences"],
72 "stream" : [[ ... ], [ ... ]]
73 }
74 }
75 }
76 }
77}