トップ 履歴 一覧 Farm ソース 検索 ヘルプ PDF RSS ログイン

checkWordList.R

*disclaimer
633034

checkWordList.R

  • 語彙リストを比較する
  • 一単語一行
  • types2にチェックしたい単語リスト(例えば学生のエッセイ)
  • wordlistに参照したい語彙リスト(例えばJACET8000等の語彙リスト
  • 一般的な語彙リストには含まれない「珍しい」単語の一覧が出る
    • めっちゃ遅い
    • 含まれない単語の数が、一個多い? (2019-12-23)

  • setdiffと同じこと
    • 参考: intersect こちらは共通部分の抽出

checkWordList2.R(342)

# 2018-03-29 copyleft sugiura@nagoya-u.jp

checkWordList2 <- function(a,b){
  
  types2 <- a
  wordlist <- b
  
  i <- 0
  k <- 0
  koreda <- 0

  k <- length(types2)
  w <- length(wordlist)
  
  cat("words to check:", k, "\n")
  cat("base word list:", w)
    
  for(i in 1:k){
   are <- types2[i]
  
    fuitti <- 0
    itti <- 0

    for(j in 1:w){
    
     kore <- wordlist[j]
     if(are == kore){
      itti <- itti + 1
     } else {
      fuitti <- fuitti + 1
     }
      if(length(wordlist) == fuitti){
      koreda <- c(koreda, i)
    }
   }
  }

  for(h in 1:length(koreda)){
    m <- koreda[h]
    print(types2[m])
  }
  cat(length(koreda), "rare words") 
}

checkWordList.R(356)

# 2018-03-24 copyleft sugiura@nagoya-u.jp

checkWordList <- function(){
  
  i <- 0
  k <- 0
  koreda <- 0

  k <- length(types2)
  w <- length(wordlist)
  
  cat("words to check:", k, "\n")
  cat("base word list:", w)
    
  for(i in 1:k){
   are <- types2[i]
  
    fuitti <- 0
    itti <- 0

    for(j in 1:w){
    
     kore <- wordlist[j]
     if(are == kore){
      itti <- itti + 1
     } else {
      fuitti <- fuitti + 1
     }
      if(length(wordlist) == fuitti){
      koreda <- c(koreda, i)
    }
   }
  }

  for(h in 1:length(koreda)){
    m <- koreda[h]
    print(types2[m])
  }
  cat(length(koreda), "rare words") 
}