R !!!quanteda を使った例 *サンプル:学習者コーパスNICEST1.0の学習者データ8つ *フォルダー内に、テキストデータのみのテキストファイルが複数入っている *作業ディレクトリーをそのフォルダーに設定してある状態で {{pre > getwd() [1] "C:/Users/hpsg/Documents/NICEST-samples" > list.files() [1] "JAN0001_P1B.txt" "JAN0001_P2B.txt" "JAN0001_P3B.txt" "JAN0001_P4B.txt" "JAN0001_P5B.txt" "JAN0001_P6B.txt" [7] "JAN0001_P7B.txt" "JAN0001_P8B.txt" }} *readtextパッケージのreadtext()を使ってテキストを読み込む {{pre nicest.tmp <- readtext("*.txt") > nicest.tmp readtext object consisting of 8 documents and 0 docvars. # Description: df[,2] [8 x 2] doc_id text 1 JAN0001_P1B.txt "\"Some peopl\"..." 2 JAN0001_P2B.txt "\"You may th\"..." 3 JAN0001_P3B.txt "\"Compared w\"..." 4 JAN0001_P4B.txt "\"You may ha\"..." 5 JAN0001_P5B.txt "\"Elderly pe\"..." 6 JAN0001_P6B.txt "\"Group tour\"..." # ... with 2 more rows }} *コーパスデータ化する {{pre nicestJ1 <- corpus(nicest.tmp) nicestJ1 Corpus consisting of 8 documents and 0 docvars. }}