• # ajout

    Posté par . En réponse au journal apprendre à lire et à dactylographier en chinois avec des outils libres. Évalué à 4.

    Dans ma précipitation j'ai oublié de mettre les 3 scripts que j'évoque dans la partie Mise en oeuvre

    L'étudiant doit etre bien outillé pour aborder correctement son champ d'étude, voila le patch :

    conversion du fichier vocab.txt de gradint : vocab2wubi.sh

    #!/bin/bash
    vocabdir=/tmp/vocabdir_$(date +%d_%m_%Y)
    source=vocab.txt
    vocabtmp=vocab_tmp.txt
    vocabtmp2=vocab_tmp2.txt
    vocab2csv=vocabcsv.csv
    vocabwubi1=vocab_wubi_1.txt
    vocabwubi2=vocab_wubi_2.txt
    vocabwubifinal=vocab.wubi.final.csv
    vocabwubilast=vocab.wubi.final.0.1.csv
    ./vocab.2.csv.sh
    cd $vocabdir/
    cp $vocab2csv $vocabwubi1
    cut -f1 $vocabdir/$vocab2csv | uniconv -encode Chinese-WB | tr ' ' '.' > $vocabwubi2
    paste $vocabwubi1 $vocabwubi2 > $vocabwubifinal
    cat $vocabwubifinal | awk 'NF > 0'> $vocabwubilast
    echo "le fichier est dans" $vocabdir/$vocabwubilast
    
    

    canto2csv.sh pour la conversion du fichier de cantofish

    #!/bin/bash
    cantodir=/tmp/$cantodir_$(date +%d_%m_%Y)
    source=canto.txt
    cantofish=cantofish.txt
    cantoField1=cantoField_1_tmp.txt
    cantoField3=cantoField_3_tmp.txt
    cantoCSV=cantocsv.0.1.csv
    mkdir $cantodir
    cp $source $cantodir/$cantofish
    cd $cantodir
    cut -f1 $cantofish > $cantoField1
    cut -f3 $cantofish | cut -d "," -f1 > $cantoField3
    paste $cantoField1 $cantoField3 > $cantoCSV
    echo "le fichier est dans" $cantodir/$cantoCSV
    
    

    et final.csv pour fusionner les deux si nécessaire :

    #!/bin/bash
    vocabdir=/tmp/vocabdir_$(date +%d_%m_%Y)
    vocab2csv=vocabcsv.csv
    cantodir=/tmp/$cantodir_$(date +%d_%m_%Y)
    cantoCSV=cantocsv.0.1.csv
    finalvoc=/tmp/final.voc_$(date +%d_%m_%Y).csv
    cat $vocabdir/$vocab2csv > $finalvoc
    cat $cantodir/$cantoCSV >> $finalvoc
    echo "le fichier est dans" $finalvoc