<commit_before>#!/bin/bash
if [ ! $# -eq 2 ]; then
  echo Usage: ./ltdiff.bash old_branch new_branch
  echo e.g. ./ltdiff.bash V_1_6 V_1_7
  echo "     ./ltdiff.bash V_1_7 trunk"
  exit -1
fi

path_old="http://languagetool.svn.sourceforge.net/viewvc/languagetool/branches/$1/src/rules"
if [ $2 == "trunk" ]; then
  path_new="http://languagetool.svn.sourceforge.net/viewvc/languagetool/trunk/JLanguageTool/src/rules"
else
  path_new="http://languagetool.svn.sourceforge.net/viewvc/languagetool/branches/$2/src/rules"
fi

javac VersionDiffGenerator.java -Xlint:deprecation

if [ ! $? -eq 0 ]; then
  echo javac failed
  exit 1
fi

oldv=`echo $1 | sed "s/_/./g" | sed "s/V.//g"`
newv=`echo $2 | sed "s/_/./g" | sed "s/V.//g"`

folder=${1}_to_${2}

i=1
while read line
do
  string[$i]=$line
  i=$((i+1));
done<gen.txt

cat changes_a.html | sed "s/1title/${string[1]}/g" | sed "s/2intro/${string[2]}/g" | sed "s/3nothing/${string[3]}/g" | sed "s/0VERSION/$newv/g" > changes.html

rm -r $folder~
mv $folder $folder~
mkdir $folder

for l in `ls -d ../src/rules/*/ -l | awk -F / '{print $(NF-1)}'`
# for l in de en
do
  echo $(tput setaf 2)------------------
  echo $l
  echo ------------------$(tput sgr0)
  
  wget $path_old/$l/grammar.xml -O old
  wget $path_new/$l/grammar.xml -O new
  
  # remove xml comments
  gawk -v RS='<!--|-->' 'NR%2' old > old~
  gawk -v RS='<!--|-->' 'NR%2' new > new~
  mv old~ old
  mv new~ new
  
  java VersionDiffGenerator $l
  <commit_msg>[ltdiff] update relative path<commit_after>#!/bin/bash
if [ ! $# -eq 2 ]; then
  echo Usage: ./ltdiff.bash old_branch new_branch
  echo e.g. ./ltdiff.bash V_1_6 V_1_7
  echo "     ./ltdiff.bash V_1_7 trunk"
  exit -1
fi

path_old="http://languagetool.svn.sourceforge.net/viewvc/languagetool/branches/$1/src/rules"
if [ $2 == "trunk" ]; then
  path_new="http://languagetool.svn.sourceforge.net/viewvc/languagetool/trunk/JLanguageTool/src/rules"
else
  path_new="http://languagetool.svn.sourceforge.net/viewvc/languagetool/branches/$2/src/rules"
fi

javac VersionDiffGenerator.java -Xlint:deprecation

if [ ! $? -eq 0 ]; then
  echo javac failed
  exit 1
fi

oldv=`echo $1 | sed "s/_/./g" | sed "s/V.//g"`
newv=`echo $2 | sed "s/_/./g" | sed "s/V.//g"`

folder=${1}_to_${2}

i=1
while read line
do
  string[$i]=$line
  i=$((i+1));
done<gen.txt

cat changes_a.html | sed "s/1title/${string[1]}/g" | sed "s/2intro/${string[2]}/g" | sed "s/3nothing/${string[3]}/g" | sed "s/0VERSION/$newv/g" > changes.html

rm -r $folder~
mv $folder $folder~
mkdir $folder

for l in `ls -d ../../../rules/*/ -l | awk -F / '{print $(NF-1)}'`
# for l in de en
do
  echo $(tput setaf 2)------------------
  echo $l
  echo ------------------$(tput sgr0)
  
  wget $path_old/$l/grammar.xml -O old
  wget $path_new/$l/grammar.xml -O new
  
  # remove xml comments
  gawk -v RS='<!--|-->' 'NR%2' old > old~
  gawk -v RS='<!--|-->' 'NR%2' new > new~
  mv old~ old
  mv new~ new
  
  java VersionDiffGenerator $l
  
{'fraction_non_alphanumeric': 0.2184959349593496, 'fraction_numerical': 0.02100271002710027, 'mean_word_length': 2.8103225806451615, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6955749', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1275, 'n_words': 287}