最近のRのメモ

Shell script

NICEのデータ処理(第5章)

学習者データのみのファイルを自動作成

#!/bin/sh    # これは bash のみ。zsh などでは不要
cd `dirname $0`   # どこに移しても実行可能
for file_name in `ls *.txt`   #ディレクトリ内のすべての text ファイルを file_nameに格納
do
# *JPN(日本人学習者)の行を取り出して、*JPNを削除した行だけを .out ファイルに出力
grep \*JPN $file_name | perl -pe 's/^\*JPN[0-9]+:\t//g;' > $file_name.out
done
killall Terminal     # 終了したらターミナルを閉じる

学習者の各テキストの発話文数と単語数を一括集計

for file_name in `ls *.out`
do
wc -lw $file_name >> count.list.text
done
     30     319 JPN501.txt.out
     29     365 JPN502.txt.out
     13     201 JPN503.txt.out
     27     260 JPN504.txt.out
     25     418 JPN505.txt.out
     20     260 JPN506.txt.out
     26     355 JPN507.txt.out
     20     195 JPN508.txt.out
     19     260 JPN509.txt.out
     14     183 JPN510.txt.out

TTRを求めてみる

諸注意


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS