#!/usr/bin/perl -w # enable-all-evolved-rules - ensure that all evolved rules are active in a file # # usage: enable-all-evolved-rules rules/50_scores.cf > rules/51_newscores.cf # mv rules/51_newscores.cf rules/50_scores.cf # # Note: this will even enable network rules in the non-net scoresets. # However, this should have no effect, since those check their network # status before running anyway. More serious is the proprietary tests; # these will also become enabled. Some manual fixup afterwards is # required. # # <@LICENSE> # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to you under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # use strict; my $in_mut_sect = 0; while (<>) { if (//) { $in_mut_sect = 1; } elsif (/<\/gen:mutable>/) { $in_mut_sect = 0; } if ($in_mut_sect && /^\s*score\s+(.+?)$/) { my @vals = split(' ', $1); my $new = ''; foreach my $score (@vals) { if ($score =~ /^[\-\+]*\d/ && $score+0 == 0) { $new .= "0.0001 "; # replace all zeros with 0.0001 } else { $new .= "$score "; } } $new =~ s/ +$//; print "score $new\n"; } else { print; } }