]> git.donarmstrong.com Git - deb_pkgs/scowl.git/blobdiff - 7.1/src/add-other-forms
[svn-upgrade] Tagging scowl (7.1)
[deb_pkgs/scowl.git] / 7.1 / src / add-other-forms
diff --git a/7.1/src/add-other-forms b/7.1/src/add-other-forms
new file mode 100755 (executable)
index 0000000..6320606
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+open F, "r/alt12dicts/2of12id.txt" or die;
+
+while (<F>) {
+  s/\r?\n$// or die;
+  # (uncommon flag, base word, part of speach, inflected forms)
+  ($d,$w,$p,$a) = /^([-@]?)(\w+) (.).*: ?(.*?)$/ or die;
+  next if $d; #
+  @a0 = split /  /, $a;
+  splice @a0, -1, 0, "'" if $p eq 'V' && @a0 >= 3; # insert placeholder
+  @a = ();
+  foreach (@a0) {
+    s/ {.+?}//g; s/ \(.+?\)//g; 
+    s/ \| / /g; s/ \/ / /g;
+    push @a, (split / /, $_);
+  }
+  @a = grep {!/^[@~-]/} @a;  # remove questionable entries
+  # @a now conatins a list of valid inflected forms
+  @a0 = grep {$_ ne "'"} @a;
+  # @a0 is now the same as @a except for the placeholder entries
+  next unless @a0;
+  $words = join("\n",$w, @a0)."\n";
+  if ($p eq 'V' && @a >= 4) {
+    while ($a[0] ne "'") {local $_ = shift @a; $lookup{$_} .= $words}
+    shift @a;
+  }
+  push @a, "$w\'s" if $p eq 'N';
+  $words = join("\n",$w, @a)."\n";
+  foreach (@a) {$lookup{$_} .= $words}
+}
+
+open F, "working/possessive-also.lst";
+
+while (<F>) {
+  chop;
+  $lookup{"$_\'s"} .= "$_\n";
+}
+
+while (<STDIN>) {
+  print;
+  chop;
+  print $lookup{$_};
+}