line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HPSG::Mason::Interp; |
2
|
1
|
|
|
1
|
|
3950
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
50
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
HPSG::Mason::Interp - Mason components for rendering Head-driven Phrase Structure Grammar feature structures to \LaTeX |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=cut |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
7
|
use base qw( HTML::Mason::Interp ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
810
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use HTML::Mason; |
13
|
|
|
|
|
|
|
use FindBin; |
14
|
|
|
|
|
|
|
use File::Spec; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use File::ShareDir; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 VERSION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Version 0.04 |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use HPSG::Mason::Interp; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my %phrase; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$phrase{I} = |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
expression_arg => |
35
|
|
|
|
|
|
|
{ |
36
|
|
|
|
|
|
|
expr_type => 'phrase', |
37
|
|
|
|
|
|
|
syn_arg => { head_arg => { pos => 'noun', |
38
|
|
|
|
|
|
|
agr_arg => { agr_cat => '1sing', |
39
|
|
|
|
|
|
|
per => '1st', |
40
|
|
|
|
|
|
|
num => 'sg', |
41
|
|
|
|
|
|
|
}, |
42
|
|
|
|
|
|
|
case => 'nom' |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
val_arg => { spr => [ ], |
45
|
|
|
|
|
|
|
comps => [ ], |
46
|
|
|
|
|
|
|
mod => [ ], |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
sem_arg => { mode => 'ref', |
50
|
|
|
|
|
|
|
index => '{\it i}', |
51
|
|
|
|
|
|
|
restr => [ { reln => 'speaker', |
52
|
|
|
|
|
|
|
inst => 'i', |
53
|
|
|
|
|
|
|
} ] |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
tag => 9, |
57
|
|
|
|
|
|
|
daughters => [ 'I' ], |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $outbuf; |
61
|
|
|
|
|
|
|
my $interp = HPSG::Mason::Interp->new( outbuf => \$outbuf); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$interp->exec( '/tree.mas', { root => $phrase{I} } ); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $fname = 'lex_I.tex'; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
open( my $fh, q{>}, $fname ) or die "couldn't open file '$fname': $!"; |
68
|
|
|
|
|
|
|
print $fh $outbuf; |
69
|
|
|
|
|
|
|
close $fh; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 FUNCTIONS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 new |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
See HTML::Mason::new, we just add the search path for some stock components |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub new { |
80
|
|
|
|
|
|
|
my $class = shift; |
81
|
|
|
|
|
|
|
my %args = @_; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
my $share_dir = File::ShareDir::dist_dir('HPSG-Mason'); |
84
|
|
|
|
|
|
|
my %data_dir = exists $args{data_dir} ? ( data_dir => $args{data_dir} ) : (); |
85
|
|
|
|
|
|
|
my $comp_root = $args{comp_root} || []; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
return |
88
|
|
|
|
|
|
|
HTML::Mason::Interp->new( comp_root => |
89
|
|
|
|
|
|
|
[ [ 'HPSG-Mason' => File::Spec->catfile( $share_dir,'comps' ) ], |
90
|
|
|
|
|
|
|
@$comp_root, |
91
|
|
|
|
|
|
|
], |
92
|
|
|
|
|
|
|
%data_dir, |
93
|
|
|
|
|
|
|
out_method => $args{outbuf}, |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 AUTHOR |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
C.J. Adams-Collier, C<< >> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 BUGS |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
104
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
105
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SUPPORT |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
perldoc HPSG::Mason::Interp |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
You can also look for information at: |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=over 4 |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * CPAN Ratings |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
L |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item * Search CPAN |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
L |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=back |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Copyright 2009 C.J. Adams-Collier, all rights reserved. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
146
|
|
|
|
|
|
|
under the same terms as Perl itself. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
1; # End of HPSG::Mason::Interp |