|< 1 2 3 >| | 23 Einträge, 3 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
use Data::Dumper qw/Dumper/;
use WWW::Leo;
my $input = 'noname.pl';
# Hauptfenster
my $nw = MainWindow->new();
# Titel des Hauptfensters
$nw->title ('Man Machine Interfaces II - UE - BSP 2');
# Text-Widget
my $In = $nw->Text (-wrap => 'none')->grid(-column => 0, -row => 0);
my $Out = $nw->Text (-wrap => 'none')->grid(-column => 1, -row => 0);
# Menü
my $mbar = $nw->Menu();
$nw->configure (-menu => $mbar);
my $file = $mbar->cascade (-label => "File", -underline => 0, -tearoff => 0);
$file->command (-label => "New", -command => [\&neu, "new"], -accelerator => 'Crtl-N', -underline => 0);
$file->command (-label => "Open", -command => [\&open, "open"], -accelerator => 'Crtl-O', -underline => 0);
$file->command (-label => "Save", -command => [\&save, "save"], -accelerator => 'Crtl-S', -underline => 0);
$file->separator();
$file->command (-label => "Exit", -command => [$nw => 'destroy'], -accelerator => 'Crtl-B', -underline => 0);
my $do = $mbar->cascade (-label => "Do", -underline => 0, -tearoff => 0);
$do->command (-label => "Translation", -command => sub {translate($In, $Out)}, -accelerator => 'Crtl-T', -underline => 0);
# Dictionary-Listbox
my $Dict = $nw->Listbox()->grid(-column => 0, -row => 1, -columnspan => 2, -sticky => 'we');
$Dict->insert("end", "the - das");
$Dict->insert("end", "sea - meer");
$Dict->insert("end", "is - ist");
$Dict->insert("end", "blue - blau");
MainLoop();
sub file {
} # sub file
sub neu {
my $tw = $nw->Toplevel(-title => 'New');
$tw->Label(-text => "Name of the File: ")->pack();
my $in = $tw->Entry(-textvariable => \$input)->pack();
$in->bind('<Return>', [\&create, $tw]);
} # sub neu
# Erzeugen einer neuen Datei
sub create {
CORE::open (IFILE, ">> $input") or die "can't create '$input':$!\n";
close IFILE;
$_[1]->destroy(); #Fenster wieder löschen
} # sub create
sub open {
my $tw = $nw->Toplevel(-title => 'Open');
$tw->Label(-text => "Open which File: ")->pack();
my $in = $tw->Entry(-textvariable => \$input)->pack();
$in->bind('<Return>', [ \&read, $tw ]);
} # sub open
# Datei zum Lesen und Schreiben Öffnen
sub read {
CORE::open (IFILE, "< $input") or die "can't open '$input':$!\n";
while (<IFILE>) {
$In->insert("end", $_);
}
close IFILE;
$_[1]->destroy(); #Fenster wieder löschen
} # sub read
sub save {
my $tw = $nw->Toplevel(-title => 'Save');
$tw->Label(-text => "Save : $input")->pack();
my $in=$tw->Entry(-textvariable => \$input)->pack();
print $input , "\n";
$in->bind('<Return>', [\&write, $tw]);
} # sub save
#Speichern der Eingabe
sub write {
CORE::open (IFILE, "+< $input") or die "can't open '$input':$!\n";
print IFILE $In->get('1.0', 'end');;
close IFILE or die $!;
$_[1]->destroy(); #Fenster löschen
} # sub write
sub perl {
system("/usr/bin/perl $input");
} # sub perl
sub translate {
my $text = $In->getSelected();
my $leo = WWW::LEO->new();
$leo->query();
if ($leo->num_results) {
print Dumper $leo->de_en();
}else{
print "Sorry, your query for '%s'gave no results.\n", $leo->query;}
$Out->query('end',$leo);
}
1
2
3
4
5
Sorry, your query for '%s'gave no results.
Use of uninitialized value in print at C:\bsp2_final.pl line 114.
Tk::Error: Can't locate auto/Tk/Text/query.al in @INC (@INC contains: C:/Perl/si
te/lib C:/Perl/lib .) at C:\bsp2_final.pl line 115
(menu invoke)
1
2
3
4
5
6
7
8
9
10
sub translate {
my $text = $In->getSelected();
my $leo = WWW::LEO->new();
$leo->query($text);
if ($leo->num_results) {
print Dumper $leo->en_de();
}else{
print "Sorry, your query for '%s'gave no results.\n", $leo->query;}
$Out->query('end',$leo);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$VAR1 = [
[
'hello',
'hallo'
],
[
'hullo',
'hallo'
],
[
'hallo',
'das Hallo'
],
[
'hello',
'das Hallo'
],
[
'Hello!',
'Hallo!'
],
[
'Hey!',
'Hallo!'
],
[
'Howdy! [Amer.] [coll.]',
'Hallo!'
]
];
Tk::Error: Can't locate auto/Tk/Text/query.al in @INC (@INC contains: C:/Perl/si
te/lib C:/Perl/lib .) at C:\bsp2_final.pl line 115
(menu invoke)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
$VAR1 = [
[
'It\'s me!',
'Ich bin\'s!'
],
[
'I\'ll eat my hat! [coll.]',
'Da fress\' ich einen Besen!'
],
[
'I\'m on my way!',
'Ich bin schon unterwegs!'
],
[
'I\'ll bet you!',
'Da geh ich jede Wette ein!'
],
[
'Good riddance!',
'Ein Gl³ck, dass ich den los bin!'
],
[
'I\'m too beat-up.',
'Ich bin zu kaputt.'
],
[
'I\'d like to be a fly on the wall.',
'Da w³rde ich gern Mõuschen spielen. [fig.]'
],
[
'It\'s a case of Hobson\'s choice.',
'Da habe ich wohl keine andere Wahl.'
],
[
'I am.',
'Ich bin.'
],
[
'I\'m for it.',
'Ich bin daf³r.'
],
[
'I agree.',
'Ich bin einverstanden.'
],
[
'I am agreed.',
'Ich bin einverstanden.'
],
[
'I\'m for the high jump. [sl.]',
'Ich bin erledigt.'
],
[
'I\'m for it. [sl.]',
'Ich bin erledigt.'
],
[
'I\'m a goner [sl.]',
'Ich bin erledigt.'
],
[
'I\'m toast. [sl.]',
'Ich bin erledigt.'
],
[
'My goose is cooked.',
'Ich bin erledigt.'
],
[
'My goose is cooked.',
'Ich bin geliefert.'
],
[
'I ain\'t [coll.]',
'ich bin nicht'
],
[
'I\'m broke.',
'Ich bin pleite.'
],
[
'I have had enough.',
'Ich bin satt.'
],
[
'I\'m seasick.',
'Ich bin seekrank.'
],
[
'my neck of the woods',
'da, wo ich herkomme'
],
[
'It is my turn',
'Ich bin an der Reihe'
],
[
'I beg to differ.',
'Ich bin anderer Ansicht.'
],
[
'I\'m curious about it.',
'Ich bin darauf gespannt.'
],
[
'I\'m all mixed up.',
'Ich bin ganz durcheinander.'
],
[
'I feel tired out.',
'Ich bin ganz erledigt.'
],
[
'I\'m all ears.',
'Ich bin ganz Ohr.'
],
[
'I disapprove of the memorial.',
'Ich bin gegen das Denkmal.'
],
[
'I\'m of good cheer.',
'Ich bin guten Mutes.'
],
[
'I\'m a stranger here.',
'Ich bin hier fremd.'
],
[
'I\'m badly off.',
'Ich bin schlecht dran.'
],
[
'I\'m very much in favor [AE] of it.',
'Ich bin sehr daf³r.'
],
[
'I\'m very much in favour [BE] of it.',
'Ich bin sehr daf³r.'
],
[
'That question is outside my province.',
'Daf³r bin ich nicht zustõndig.'
],
[
'Modesty is my middle name. [fig.]',
'Ich bin die Bescheidenheit in Person.'
],
[
'I\'m in favor [AE] of going.',
'Ich bin daf³r zu gehen.'
],
[
'I\'m in favour [BE] of going.',
'Ich bin daf³r zu gehen.'
],
[
'I don\'t feel happy about it.',
'Ich bin dar³ber nicht erfreut.'
],
[
'I owe you an explanation.',
'Ich bin dir eine Erklõrung schuldig.'
],
[
'I\'m sort of glad ... [fam.]',
'Ich bin eigentlich froh ...'
],
[
'I don\'t hold with that.',
'Ich bin gegen so was.'
],
[
'I escaped by the skin of my teeth.',
'Ich bin gerade noch davongekommen.'
],
[
'as',
'da'
],
[
'because áconj.',
'da'
],
[
'here',
'da'
],
[
'since',
'da'
],
[
'that',
'da'
],
[
'there',
'da'
],
[
'given that',
'da'
],
[
'in that',
'da'
],
[
'bin',
'der Abfallbehõlter'
],
[
'bin',
'der Abfalleimer'
],
[
'bin',
'der Behõlter'
],
[
'bin',
'das Behõltnis'
],
[
'bin',
'der Bunker'
],
[
'bin',
'der Kasten'
],
[
'bin',
'offener Kasten'
],
[
'ich',
'p'
]
];
WWW::LEO=HASH(0x2f20238)
1
2
3
4
5
6
7
8
9
10
sub translate {
my $text = $In->getSelected();
my $leo = WWW::LEO->new();
$leo->query($text);
if ($leo->num_results) {
print Dumper $leo->en_de();
}else{
print "Sorry, your query for '%s'gave no results.\n", $leo->query;}
$Out->insert('end',$leo);
}
Quoteokay, werde mal außer haus fahren und mich am abend noch einmal hinsetzen.
Quotewo kann ich eine bessere dokumentation zu www::leo finden außer unter cpan?
Quoteen_de :
Returns a reference to an array whose elements are references to arrays containing the English and German result pairs in elements 0 and 1, respectively.
en :
Convenience method: Returns an array reference containing the English results.
de :
Convenience method: Returns an array reference containing the English results.
Quotehab das noch probiert jetzt zeigt er im dos-modus für "ich bin da" folgendes an:
[riesen lange Liste]
Quote
1 2 3 4 5 6 7 8 9
sub translate { my $text = $In->getSelected(); my $leo = WWW::LEO->new(); $leo->query($text); if ($leo->num_results) { my $arrayref = $leo->de_en(); $Out->insert('end', $arrayref->[0]); } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sub translate {
use WWW::Babelfish;
my $text = $In->getSelected();
my $babel = WWW::Babelfish->new( service => 'Babelfish', agent => 'Mozilla/8.0' );
die ( "Babelfish server unavailable\n" ) unless defined($babel);
my $eng_text = $babel->translate(
'source' => 'German',
'destination' => 'English',
'text' => $text,
'delimiter' => "\n\t",
'ofh' => \*STDOUT
);
$Out->insert('end', $eng_text || 'No Translation available');
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sub translate {
my $text = $In->getSelected();
my $babel = WWW::Babelfish->new( service => 'Babelfish', agent => 'Internet Explorer/7.0' );
die ( "Babelfish server unavailable\n" ) unless defined($babel);
my $eng_text = $babel->translate(
'source' => 'German',
'destination' => 'English',
'text' => $text,
'delimiter' => "\n\t",
'ofh' => \*STDOUT
);
$Out->insert('end', $eng_text || 'No Translation available');
}
|< 1 2 3 >| | 23 Einträge, 3 Seiten |