blob: 7c823ea8deb23137fe2ce607432825a3ec82da74 [file] [log] [blame]
Nils Diewald6c44f422014-10-31 02:16:14 +00001#!/usr/bin/env perl
2# source ~/perl5/perlbrew/etc/bashrc
3# perlbrew switch perl-blead@korap
4use strict;
5use warnings;
6use Test::More;
7
8use Benchmark qw/:hireswallclock/;
9
10my $t = Benchmark->new;
11
12use utf8;
13use lib 'lib', '../lib';
14
15
16use File::Basename 'dirname';
17use File::Spec::Functions 'catdir';
18
19use_ok('KorAP::Document');
20
21# GOE/AGA/03828
22my $path = catdir(dirname(__FILE__), 'GOE/AGA/03828');
23
24ok(my $doc = KorAP::Document->new( path => $path . '/' ), 'Load Korap::Document');
25ok($doc->parse, 'Parse document');
26
27# Tokenization
28use_ok('KorAP::Tokenizer');
29
30my ($token_base_foundry, $token_base_layer) = (qw/OpenNLP Tokens/);
31
32# Get tokenization
33my $tokens = KorAP::Tokenizer->new(
34 path => $doc->path,
35 doc => $doc,
36 foundry => $token_base_foundry,
37 layer => $token_base_layer,
38 name => 'tokens'
39);
40ok($tokens, 'Token Object is fine');
41ok($tokens->parse, 'Token parsing is fine');
42ok($tokens->add('Base', 'Sentences'), 'Add base sentences');
43ok($tokens->add('Base', 'Paragraphs'), 'Add base paragraphs');
44ok($tokens->add('OpenNLP', 'Sentences'), 'Add opennlp sentences');
45ok($tokens->add('OpenNLP', 'Morpho'), 'Add opennlp morpho');
46ok($tokens->add('TreeTagger', 'Sentences'), 'Add tt sentences');
47ok($tokens->add('TreeTagger', 'Morpho'), 'Add tt morpho');
48ok($tokens->add('CoreNLP', 'NamedEntities'), 'Add corenlp ne');
49ok($tokens->add('CoreNLP', 'Sentences'), 'Add corenlp sentences');
50ok($tokens->add('CoreNLP', 'Morpho'), 'Add corenlp morpho');
51ok($tokens->add('CoreNLP', 'Constituency'), 'Add corenlp constituency');
52ok($tokens->add('Glemm', 'Morpho'), 'Add glemm morpho');
53ok($tokens->add('Connexor', 'Sentences'), 'Add cnx sentences');
54ok($tokens->add('Connexor', 'Morpho'), 'Add cnx morpho');
55ok($tokens->add('Connexor', 'Phrase'), 'Add cnx phrase');
56ok($tokens->add('Connexor', 'Syntax'), 'Add cnx syntax');
57ok($tokens->add('Mate', 'Morpho'), 'Add mate morpho');
58# $tokens->add('Mate', 'Dependency');
59ok($tokens->add('XIP', 'Sentences'), 'Add xip sentences');
60ok($tokens->add('XIP', 'Morpho'), 'Add xip morpho');
61ok($tokens->add('XIP', 'Constituency'), 'Add xip constituency');
62# $tokens->add('XIP', 'Dependency');
63ok($tokens->to_json, 'To json');
64
65diag timestr(timediff(Benchmark->new, $t));