| 1 | package Treex::Core::Node::N; | ||||||||||
| 2 | { | ||||||||||
| 3 | 60 | $Treex::Core::Node::N::VERSION = '0.08633_1'; | |||||||||
| 4 | } | ||||||||||
| 5 | |||||||||||
| 6 | 60 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 60 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 60 | ▶ | use Treex::Core::Common; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 60 | extends 'Treex::Core::Node'; | |||||||||
| 11 | |||||||||||
| 12 | 60 | has [qw(ne_type normalized_name)] => ( is => 'rw' ); | |||||||||
| 13 | |||||||||||
| 14 | sub get_pml_type_name { | ||||||||||
| 15 | 24 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
get_pml_type_name: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 16 | 24 | ▶ | return $self->is_root() ? 'n-root.type' : 'n-node.type'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | override '_get_reference_attrs' => sub { | ||||||||||
| 20 | 36 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 36 | return ('a.rf'); | |||||||||
| 22 | 60 | }; | |||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | sub get_anodes { | ||||||||||
| 26 | 3 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
get_anodes: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 27 | 3 | ▶ | my $ids_ref = $self->get_attr('a.rf') or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 3 | my $doc = $self->get_document(); | |||||||||
| 29 | 3 | return map { $doc->get_node_by_id($_) } @{$ids_ref}; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | sub set_anodes { | ||||||||||
| 33 | 1 | ▶ | my $self = shift; | ||||||||
|
Subroutine
set_anodes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 34 | 1 | return $self->set_attr( 'a.rf', [ map { $_->id } @_ ] ); | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 60 | 1; | |||||||||
| 38 | |||||||||||
| 39 | __END__ | ||||||||||
| 40 | |||||||||||
| 41 | =encoding utf-8 | ||||||||||
| 42 | |||||||||||
| 43 | =head1 NAME | ||||||||||
| 44 | |||||||||||
| 45 | Treex::Core::Node::N | ||||||||||
| 46 | |||||||||||
| 47 | =head1 VERSION | ||||||||||
| 48 | |||||||||||
| 49 | version 0.08633_1 | ||||||||||
| 50 | |||||||||||
| 51 | =head1 DESCRIPTION | ||||||||||
| 52 | |||||||||||
| 53 | A node for storing named entities. | ||||||||||
| 54 | |||||||||||
| 55 | =head1 ATTRIBUTES | ||||||||||
| 56 | |||||||||||
| 57 | =over | ||||||||||
| 58 | |||||||||||
| 59 | =item ne_type | ||||||||||
| 60 | |||||||||||
| 61 | Type of the named entity (string). | ||||||||||
| 62 | |||||||||||
| 63 | =item normalized_name | ||||||||||
| 64 | |||||||||||
| 65 | E.g. for "N.Y." this can be "New York". | ||||||||||
| 66 | |||||||||||
| 67 | =back | ||||||||||
| 68 | |||||||||||
| 69 | =head1 METHODS | ||||||||||
| 70 | |||||||||||
| 71 | =over | ||||||||||
| 72 | |||||||||||
| 73 | =item get_anodes | ||||||||||
| 74 | |||||||||||
| 75 | Return a-nodes referenced by (or corresponding to) this n-node. | ||||||||||
| 76 | |||||||||||
| 77 | =item set_anodes(@anodes) | ||||||||||
| 78 | |||||||||||
| 79 | Set a-nodes to be referenced by (or corresponding to) this n-node. | ||||||||||
| 80 | |||||||||||
| 81 | =back | ||||||||||
| 82 | |||||||||||
| 83 | =head1 AUTHOR | ||||||||||
| 84 | |||||||||||
| 85 | Martin Popel <popel@ufal.mff.cuni.cz> | ||||||||||
| 86 | |||||||||||
| 87 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 88 | |||||||||||
| 89 | Copyright © 2011-2012 by Institute of Formal and Applied Linguistics, Charles University in Prague | ||||||||||
| 90 | |||||||||||
| 91 | This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||