R R.scripts {{ref myAllTypes.R}} {{pre # 2018-03-18 copyleft sugiura@nagoya-u.jp myAllTypes <- function() { output.file = choose.files() type.all <- "" files <- list.files() for (i in files) { type <- "" token <- "" lines.tmp <- scan(i, 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.lower <- tolower(body.tmp) body.token <- unlist(strsplit(body.lower, "\\W")) body.token <- body.token[body.token != ""] type <- unique(body.token) type.all <- c(type.all, type) } type.all <- type.all[type.all != ""] type.all <- sort(unique(type.all)) write(type.all, file=output.file) } }}