[LON-CAPA-cvs] cvs: loncom /localize/localize x_chef.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Tue, 06 Nov 2007 20:01:39 -0000
albertel Tue Nov 6 15:01:39 2007 EDT
Modified files:
/loncom/localize/localize x_chef.pm
Log:
- support the quant/numerate helper routines in the chef filter
Index: loncom/localize/localize/x_chef.pm
diff -u loncom/localize/localize/x_chef.pm:1.3 loncom/localize/localize/x_chef.pm:1.4
--- loncom/localize/localize/x_chef.pm:1.3 Tue Nov 6 14:35:12 2007
+++ loncom/localize/localize/x_chef.pm Tue Nov 6 15:01:37 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Russian Localization Lexicon
#
-# $Id: x_chef.pm,v 1.3 2007/11/06 19:35:12 albertel Exp $
+# $Id: x_chef.pm,v 1.4 2007/11/06 20:01:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -96,6 +96,7 @@
chef: token(s) /\z/
token: end_of_sentence
+ | quant
| Bbork
| an | An
| au | Au
@@ -119,6 +120,7 @@
end_of_sentence: /[.?!]+/ /\s+/ { $niw = 0; $i_seen = 0; $Apache::localize::x_chef::result .= $item[1] . "\nBork Bork Bork!\n" }
Bbork: <reject: $niw> /([Bb]ork)/ ...NW { $Apache::localize::x_chef::result .= "$1" }
+ quant: /(\[.+?\])/ { $Apache::localize::x_chef::result .= $1; }
an: /an/ { $niw = 1; $Apache::localize::x_chef::result .= 'un' }
An: /An/ { $niw = 1; $Apache::localize::x_chef::result .= 'Un' }
au: /au/ { $niw = 1; $Apache::localize::x_chef::result .= 'oo' }
@@ -154,6 +156,15 @@
};
}
+sub quant {
+ my $self = shift;
+ return &chefify2($self->SUPER::quant(@_));
+}
+sub numerate {
+ my $self = shift;
+ return &chefify2($self->SUPER::numerate(@_));
+}
+
sub chefify2 {
my ($str) = @_;
my $backup=$str;