*disclaimer
843390
NICE.tips
学習者コーパス NICE, NICER, NICESTを使った分析の際のちょっとしたこと
- CHILDESのCHATフォーマット形式のデータ(テキストファイル)から、
- データの本文部分だけを抜き出し(ヘッダー部分は削除)
- 行頭の話者記号(*JPN...:\t もしくは *NS...:\t)を削除し
- 全部小文字にして、
- 句読点・スペースを削除し(英数文字のみに)
- 単語の並びを返すスクリプト nice.body()
nice.body.R(333)
nice.body <- function(){ lines.tmp <- scan(choose.files(), what="char", sep="\n") data.tmp <- grep("\\*(JPN|NS)...:\t", lines.tmp, value=T) body.tmp <- gsub("\\*(JPN|NS)...:\t", "", data.tmp) body.tmp <- body.tmp[body.tmp != ""] #空行を削除。 body.tmp <- tolower(body.tmp) word.tmp <- unlist(strsplit(body.tmp, "\\W+")) return(word.tmp) }
> nice.body() Read 120 items [1] "education" "of" "yotori" "there" "was" "the" "education" "system" "that" [10] "called" "yotori" "in" "japan" "several" "years" "ago" "i" "heard" [19] "that" "system" "was" "made" "by" "the" "people" "who" "thought" [28] "japanese" "education" "system" "should" "be" "more" "free" "for" "children" [37] "i" "was" "born" "in" "1993" "so" "i" "was" "student" > jpn502 <- nice.body() Read 120 items > head(jpn502) [1] "education" "of" "yotori" "there" "was" "the"
https://sugiura-ken.org/wiki/