Permalink
Browse files

first shot at vocabular learning tool

  • Loading branch information...
0 parents commit 50c86c70d3d9c19e9cf28c644ec5e88c445fa79e @moritz committed Oct 21, 2010
Showing with 58 additions and 0 deletions.
  1. +1 −0 README
  2. +17 −0 data/words-no-de
  3. +40 −0 trainer.pl
1 README
@@ -0,0 +1 @@
+very simplistic, pre-alpha vocabular trainer
@@ -0,0 +1,17 @@
+jeg - ich
+du - du
+han - er
+hun - sie (singular)
+det - es
+ve - wir
+dere - ihr
+de - sie (plural)
+og - und
+å bo - wohnen
+å ha - haben
+å hete - heissen
+ákomme fra - herkommen
+desvarre - leider
+heldigvis - zum Glück
+eller - oder
+vor så god - bitteschön
@@ -0,0 +1,40 @@
+use v6;
+
+my $fn = 'data/words-no-de';
+
+
+my $file = open $fn;
+
+say $file.get;
+my @words;
+
+for $file.lines -> $l {
+ my @lang = $l.split(/\s+ '-' \s+ /);
+ if @lang != 2 {
+ warn "Igoring line '$l'";
+ next;
+ }
+ @lang[$_].=trim for ^2;
+ @words.push: @lang[0] => @lang[1];
+}
+
+unless @words {
+ die "No valid lines in data file found";
+
+}
+
+loop {
+ my $pair = @words.pick;
+ my ($fl, $sl) = $pair.kv;
+ my $response = prompt("(de) $sl = (no) ");
+ if $response eq $fl {
+ say ":-)";
+ } else {
+ say ":-( $fl";
+
+ }
+
+}
+
+
+# vim: ft=perl6

0 comments on commit 50c86c7

Please sign in to comment.