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