| 1 | # ABSTRACT: Driver for the German tagset of the CoNLL 2006 Shared Task. | ||
| 2 | # Copyright © 2008, 2014 Dan Zeman <zeman@ufal.mff.cuni.cz> | ||
| 3 | |||
| 4 | package Lingua::Interset::Tagset::DE::Conll; | ||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | our $VERSION = '3.014'; | ||
| 8 | |||
| 9 | use utf8; | ||
| 10 | use open ':utf8'; | ||
| 11 | use namespace::autoclean; | ||
| 12 | use Moose; | ||
| 13 | extends 'Lingua::Interset::Tagset::DE::Stts'; | ||
| 14 | |||
| 15 | |||
| 16 | |||
| 17 | #------------------------------------------------------------------------------ | ||
| 18 | # Decodes a physical tag (string) and returns the corresponding feature | ||
| 19 | # structure. | ||
| 20 | #------------------------------------------------------------------------------ | ||
| 21 | sub decode | ||
| 22 | { | ||
| 23 | my $self = shift; | ||
| 24 | my $tag = shift; | ||
| 25 | # three components: coarse-grained pos, fine-grained pos, features | ||
| 26 | # example: NE\tNE\t_ | ||
| 27 | my ($pos, $subpos, $features) = split(/\s+/, $tag); | ||
| 28 | # The CoNLL tagset is derived from the STTS tagset. | ||
| 29 | # Coarse-grained POS is the STTS tag. | ||
| 30 | # Fine-grained POS is another copy of the STTS tag. | ||
| 31 | # Features is an underscore. | ||
| 32 | my $fs = $self->SUPER::decode($pos); | ||
| 33 | # Here we could set $fs->set_tagset('de::conll') but we will not so that all | ||
| 34 | # the descendants of de::stts can share the same feature structures. | ||
| 35 | return $fs; | ||
| 36 | } | ||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | #------------------------------------------------------------------------------ | ||
| 41 | # Takes feature structure and returns the corresponding physical tag (string). | ||
| 42 | #------------------------------------------------------------------------------ | ||
| 43 | sub encode | ||
| 44 | { | ||
| 45 | my $self = shift; | ||
| 46 | my $fs = shift; # Lingua::Interset::FeatureStructure | ||
| 47 | # The CoNLL tagset is derived from the STTS tagset. | ||
| 48 | # Coarse-grained POS is the STTS tag. | ||
| 49 | # Fine-grained POS is another copy of the STTS tag. | ||
| 50 | # Features is an underscore. | ||
| 51 | my $tag = $self->SUPER::encode($fs); | ||
| 52 | return "$tag\t$tag\t_"; | ||
| 53 | } | ||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | #------------------------------------------------------------------------------ | ||
| 58 | # Returns reference to list of known tags. | ||
| 59 | #------------------------------------------------------------------------------ | ||
| 60 | sub list | ||
| 61 | { | ||
| 62 | my $self = shift; | ||
| 63 | my $list = $self->SUPER::list(); | ||
| 64 | my @list = map {"$_\t$_\t_"} (@{$list}); | ||
| 65 | return \@list; | ||
| 66 | } | ||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | 1; | ||
| 71 | |||
| 72 | __END__ | ||
| 73 | |||
| 74 | =pod | ||
| 75 | |||
| 76 | =encoding UTF-8 | ||
| 77 | |||
| 78 | =head1 NAME | ||
| 79 | |||
| 80 | Lingua::Interset::Tagset::DE::Conll - Driver for the German tagset of the CoNLL 2006 Shared Task. | ||
| 81 | |||
| 82 | =head1 VERSION | ||
| 83 | |||
| 84 | version 3.014 | ||
| 85 | |||
| 86 | =head1 SYNOPSIS | ||
| 87 | |||
| 88 | use Lingua::Interset::Tagset::DE::Conll; | ||
| 89 | my $driver = Lingua::Interset::Tagset::DE::Conll->new(); | ||
| 90 | my $fs = $driver->decode("NN\tNN\t_"); | ||
| 91 | |||
| 92 | or | ||
| 93 | |||
| 94 | use Lingua::Interset qw(decode); | ||
| 95 | my $fs = decode('de::conll', "NN\tNN\t_"); | ||
| 96 | |||
| 97 | =head1 DESCRIPTION | ||
| 98 | |||
| 99 | Interset driver for the German tagset of the CoNLL 2006 Shared Task. | ||
| 100 | CoNLL tagsets in Interset are traditionally three values separated by tabs. | ||
| 101 | The values come from the CoNLL columns CPOS, POS and FEAT. For German, | ||
| 102 | these values are trivially derived from the Stuttgart-Tübingen Tagset. | ||
| 103 | Thus this driver is only a translation layer above the C<de::stts> driver. | ||
| 104 | |||
| 105 | =head1 SEE ALSO | ||
| 106 | |||
| 107 | L<Lingua::Interset>, | ||
| 108 | L<Lingua::Interset::Tagset>, | ||
| 109 | L<Lingua::Interset::Tagset::DE::Stts>, | ||
| 110 | L<Lingua::Interset::Tagset::DE::Conll2009>, | ||
| 111 | L<Lingua::Interset::FeatureStructure> | ||
| 112 | |||
| 113 | =head1 AUTHOR | ||
| 114 | |||
| 115 | Dan Zeman <zeman@ufal.mff.cuni.cz> | ||
| 116 | |||
| 117 | =head1 COPYRIGHT AND LICENSE | ||
| 118 | |||
| 119 | This software is copyright (c) 2019 by Univerzita Karlova (Charles University). | ||
| 120 | |||
| 121 | This is free software; you can redistribute it and/or modify it under | ||
| 122 | the same terms as the Perl 5 programming language system itself. | ||
| 123 | |||
| 124 | =cut |