Treex/Core/TredView/Colors.pm

filter: Statementstmt 45.4% 10 / 22 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 2 / 6 Podpod 0.0% 0 / 2 totaltotal 31.5% 12 / 38 CC 5 SCAR 27.6
CC
5
Cov
33%
get
30.0
_build_colors
2.0
__ANON__
2.0
CRAP 15.8
« Treex/Core/Phrase/BaseNTerm.pm ↑ Summary Treex/Block/Read/BaseSplitterRole.pm »
1 package Treex::Core::TredView::Colors;
2 3 $Treex::Core::TredView::Colors::VERSION = '2.20210102';
3 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Treex::Core::Log;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 has '_colors' => (
7 is => 'ro',
8 isa => 'HashRef[Str]',
9 builder => '_build_colors'
10 );
11  
12 0 ▶sub _build_colors {
Subroutine _build_colors: not called CC=1 SCAR=6.9
13 return {
14 0 'edge' => '#555555',
15 'coord' => '#bbbbbb',
16 'error' => '#ff0000',
17 'coord_mod' => 'aquamarine4',
18  
19 'anode' => '#ff6666',
20 'anode_coord' => '#ff6666',
21 'nnode' => '#ffff00',
22 'tnode' => '#4488ff',
23 'tnode_coord' => '#ccddff',
24 'terminal' => '#ffff66',
25 'terminal_head' => '#90ee90',
26 'nonterminal_head' => '#90ee90',
27 'nonterminal' => '#ffffe0',
28 'trace' => '#aaaaaa',
29 'current' => '#ff0000',
30  
31 'coref_gram' => '#c05633',
32 'coref_text' => '#4c509f',
33 'bridging' => '#00ccff',
34 'compl' => '#629f52',
35 'coindex' => '#ffa500', #orange
36  
37 # various alignment link types
38 'alignment' => '#bebebe',
39 'left' => '#bebebe',
40 'right' => '#bebebe',
41 'int' => '#bebebe',
42 'gdfa' => '#bebebe',
43 'revgdfa' => '#bebebe',
44 'rule-based' => '#bebebe',
45 'monolingual' => '#bebebe',
46 'coref_supervised' => '#bebebe',
47 'coref_gold' => '#bebebe',
48 'copy' => '#bebebe',
49  
50 'lex' => '#006400',
51 'aux' => '#ff8c00',
52 'parenthesis' => '#809080',
53 'afun' => '#00008b',
54 'member' => '#0000ff',
55 'sentmod' => '#006400',
56 'subfunctor' => '#a02818',
57 'nodetype' => '#00008b',
58 'sempos' => '#8b008b',
59 'phrase' => '#00008b',
60 'formeme' => '#b000b0',
61 'tag' => '#004048',
62 'tag_feat' => '#7098A0',
63 'translit' => '#444400',
64 'gloss' => '#888800',
65  
66 'clause0' => '#ff00ff', #magenta
67 'clause1' => '#ffa500', #orange
68 'clause2' => '#0000ff', #blue
69 'clause3' => '#3cb371', #MediumSeaGreen
70 'clause4' => '#ff0000', #red
71 'clause5' => '#9932cc', #DarkOrchid
72 'clause6' => '#00008b', #DarkBlue
73 'clause7' => '#006400', #DarkGreen
74 'clause8' => '#8b0000', #DarkRed
75 'clause9' => '#008b8b', #DarkCyan
76  
77 '_default' => 'cyan',
78 };
79 }
80  
81 # This is just to prevent repeating warning for the same unknown color code
82 has '_unknown_codes' => (
83 is => 'ro',
84 isa => 'HashRef[Bool]',
85 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
86 3 );
87  
88 0 ▶sub get {
Subroutine get: not called CC=5 SCAR=34.0
Pod undocumented
89 0 my ( $self, $code, $markup ) = @_;
90  
91 # try to truncate complex alignment types to first one (e.g. "gdfa.int.left.right.revgdfa" -> "gdfa")
92 0 ▶ $code =~ s/\..*// if ( not exists $self->_colors->{$code} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->_colors->{$code} 0 0 0
93  
94 # warn if the appropriate color still does not exist
95 0 ▶ if ( !defined( $self->_colors->{$code} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->_colors->{$code}) 0 0 0
96 0 ▶ log_warn "Unknown color code '$code'\n" if ( !$self->_unknown_codes->{$code} );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_unknown_codes->{$code} 0 0 0
97 0 $self->_unknown_codes->{$code} = 1;
98 0 $code = '_default';
99 }
100 0 $code = $self->_colors->{$code};
101 0 ▶ return $markup ? '#{' . $code . '}' : $code;
Branch: 1 branch
BranchTrueFalseTotal
$markup ? : 0 0 0
102 }
103  
104 0 ▶sub get_clause_color {
Subroutine get_clause_color: not called CC=1 SCAR=6.9
Pod undocumented
105 0 my ( $self, $clause_number, $code, $markup ) = @_;
106 0 return $self->get( 'clause' . ( $clause_number % 10 ), $markup );
107 }
108  
109 3 1;
110  
111 __END__
« Treex/Core/Phrase/BaseNTerm.pm ↑ Summary Treex/Block/Read/BaseSplitterRole.pm »