R_concordancer のバックアップ(No.1) - アールメカブ

アールメカブ


R_concordancer のバックアップ(No.1)


Rでコンコーダンサー (とか言ってみる)

library(languageR)

place <- which(alice == "place")

for(i in place){
  x <- i - 2; y <- i + 2
  if(x< 0) x <- 0
  if(y > length(alice)) y <- length(alice)
#  cat(alice[x:y],"\n")
  for(z in x:y){
   cat(sprintf("%10s", alice[z]))
#    if(z == y){
#      cat("\n")
#    }
  }
  cat("\n")
}
       in     bill's      place        for          a
       an       open      place       with          a
       at        the      place      where         it
     move        one      place         on         he
      the dormouse's      place        and      alice
     took        the      place         of        the
      the      whole      place     around        her
     take        the      place         of        the