#!/bin/bash # Downloads the beginner-level word books. The repo is CC BY-NC-SA 4.0 and its # own README calls the contents "compiled from public sources, personal use # only" -- see the note in DATA-NOTE.md before shipping any of this. set -u BASE="https://github.com/lilinji/English/raw/main" enc() { python3 -c "import urllib.parse,sys;print(urllib.parse.quote(sys.argv[1]))" "$1"; } get() { local path="$1" out="src/$2" [ -s "$out" ] && { echo " 已有 $2"; return; } curl -sL -o "$out" "$BASE/$(enc "$path")" if [ -s "$out" ] && head -c2 "$out" | grep -q PK; then echo " 取得 $2 ($(wc -c <"$out") 字节)" else echo " 失败 $2"; rm -f "$out"; fi } echo "剑桥 KET/PET:" get "9.其他(更多)/14天攻克KET核心词汇.xlsx" ket-core.xlsx get "9.其他(更多)/KET核心词 巧记速练.xlsx" ket-drill.xlsx get "9.其他(更多)/21天攻克PET核心词汇.xlsx" pet-core.xlsx get "9.其他(更多)/PET核心词 巧记速练.xlsx" pet-drill.xlsx get "9.其他(更多)/突破英文基础词汇.xlsx" basic.xlsx echo "人教版小学:" for g in 一 二 三 四 五 六; do for t in 上 下; do get "1.全国各大教材版本中小学同步/人教版/人教版一年级起点${g}年级${t}.xlsx" "rj-p1-${g}${t}.xlsx" done done echo "人教版初中(七年级):" get "1.全国各大教材版本中小学同步/人教版/人教版初中英语七年级上册.xlsx" rj-m7a.xlsx get "1.全国各大教材版本中小学同步/人教版/人教版初中英语七年级下册.xlsx" rj-m7b.xlsx # Word frequency, for the order new words are handed out in. These are # OpenSubtitles counts, i.e. spoken language: a web corpus ranks `ankle` and # `asleep` far below where a learner of spoken English needs them. # hermitdave/FrequencyWords is MIT, a cleaner licence than the word books above. echo "词频表:" if [ -s src/en_50k.txt ]; then echo " 已有 en_50k.txt" else curl -sL -o src/en_50k.txt \ "https://raw.githubusercontent.com/hermitdave/FrequencyWords/master/content/2018/en/en_50k.txt" echo " 取得 en_50k.txt ($(wc -l