英単語帳スクリプト
昨日から英単語帳を作り始めた。まずは以下のテキスト形式で個人用Wikiに置いておくことにした。
- intrinsic: 備わっている - susceptible: 敏感である - explicit: 明白な - multiplicative: 倍数的な - exploit: 活用する - shakeout: 暴落 - articulation: ろれつ, メリハリ - spurred: せきたてられた, 拍車をつけた - spurious: 偽の, 私生児の - prosecute: 起訴する ...
また上記のままだと英語と日本語が両方見えてしまうので、英語もしくは日本語のみに表示の切替が出来るように以下のようなスクリプトを書いた。任意のエントリを切り出す機能も加えた。
#!/usr/bin/perl #This is a script for extracting word(s) from word list #[Format of Word List] # English:Japanese # Usage: # ./show_words.pl : Show English words in the list # ./show_words.pl -j : Show Japanese words in the list # ./show_words.pl [entry] : Extract entry from the list # # $SHOW_JP=0; $GREP_WORD = ""; if($ARGV[0] eq "-j"){ $SHOW_JP = 1; }elsif($ARGV[0] ne ""){ $GREP_WORD = $ARGV[0]; } open(FILE,"words.txt"); while(<FILE>){ $line = $_; $line =~ s/^- //g; $line =~ s/^-//g; if($GREP_WORD ne ""){ if($line =~ /$GREP_WORD/){ print $line; } }else{ if($line =~ /(.*)\:(.*)\n/){ if($SHOW_JP == 1){ print "$2\n"; }else{ print "$1\n"; } } } } close(FILE);
I've started making a word list since yesterday. I write the entry by specified format and made a filter script to show only English or Japanese.