Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanVukovic99 committed Jul 11, 2024
1 parent 23a8049 commit 30c7dfd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
51 changes: 29 additions & 22 deletions auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ convertMainDict(){
convertGlossary(){
export source_iso="$edition_iso"
export source_language="$edition_name"
export target_language="$language"
export target_iso="$language_iso"
export target_language="$gloss_lang_name"
export target_iso="$gloss_iso"
export temp_folder="data/temp"

dict_file="${DICT_NAME}-$source_iso-$target_iso-gloss.zip"
Expand All @@ -71,10 +71,6 @@ convertGlossary(){
echo "Error: Yomitan generation script failed."
fi

if [ "$keep_files" = false ]; then
rm -f "$kaikki_file"
fi

output_folder="data/language/$source_iso/$target_iso"
if [ ! -d "$output_folder" ]; then
mkdir -p "$output_folder"
Expand Down Expand Up @@ -164,12 +160,12 @@ for edition_lang in "${languages[@]}"; do
downloaded_edition_extract=false

#Iterate over every language
for source_lang in "${languages[@]}"; do
export language_iso=$(echo "${source_lang}" | jq -r '.iso')
language=$(echo "${source_lang}" | jq -r '.language')
for some_lang in "${languages[@]}"; do
export language_iso=$(echo "${some_lang}" | jq -r '.iso')
language=$(echo "${some_lang}" | jq -r '.language')

convert_main=true
convert_glossary=true
convert_glossary=false

if [ "$edition_name" != "$requested_target" ] && [ "$requested_target" != "?" ]; then
convert_main=false
Expand All @@ -179,15 +175,11 @@ for edition_lang in "${languages[@]}"; do
convert_main=false
fi

if [ "$edition_name" != "$requested_source" ] && [ "$requested_source" != "?" ]; then
convert_glossary=false
fi

if [ "$language" != "$requested_target" ] && [ "$requested_target" != "?" ]; then
convert_glossary=false
if [ "$edition_name" = "$language" ]; then
convert_glossary=true
fi

if [ "$requested_target" = "$requested_source" ]; then
if [ "$edition_name" != "$requested_source" ] && [ "$requested_source" != "?" ]; then
convert_glossary=false
fi

Expand All @@ -201,10 +193,6 @@ for edition_lang in "${languages[@]}"; do

download_language="$language"
download_iso="$language_iso"
if [ "$convert_glossary" = true ]; then
download_language="$edition_name"
download_iso="$edition_iso"
fi

export download_language
export download_iso
Expand Down Expand Up @@ -257,14 +245,33 @@ for edition_lang in "${languages[@]}"; do
fi

if [ "$convert_glossary" = true ]; then
convertGlossary
for gloss_lang in "${languages[@]}"; do

export gloss_iso=$(echo "${gloss_lang}" | jq -r '.iso')
gloss_lang_name=$(echo "${gloss_lang}" | jq -r '.language')

if [ "$gloss_lang" = "$edition_name" ]; then
continue
fi

if [ "$gloss_lang_name" != "$requested_target" ] && [ "$requested_target" != "?" ]; then
continue
fi

convertGlossary
done
fi

done

if [ "$keep_files" = false ]; then
rm -rf "$kaikki_file"
rm -rf "$target_extract_path"
edition_extract="$edition_iso-extract.jsonl"
edition_extract_path="data/kaikki/$edition_extract"
if [ -f "$edition_extract_path" ]; then
rm -rf "$edition_extract_path"
fi
fi
done
echo "All done!"
6 changes: 0 additions & 6 deletions make-glossary.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ function processTranslations(translations, glosses, senses, sense){
}
}


console.log(`Source: ${sourceIso}`);
console.log(`Target: ${targetIso}`);
console.log(`Kaikki file: ${kaikkiFile}`);
console.log(`Temp folder: ${writeFolder}`);

const partsOfSpeech = loadJsonArray(`data/language/target-language-tags/en/parts_of_speech.json`);
const skippedPartsOfSpeech = {};

Expand Down

0 comments on commit 30c7dfd

Please sign in to comment.