##Association rule or Market basket library(“arules”) removewords=c(names(termFrequency)[which(termFrequency==1)],’en’,’f’,’nicht’,’es’,’luck’,’giving’,’thought’,’value’,’indeed’,’almost’,’apparently’,’exist’,’d’,’net’,’ture’,’dans’,’des’,’et’,’ne’,’une’,’le’) VerbList=sapply(DATA_.input, function(x){strsplit(x[[1]],’ ‘)}) VerbList=sapply(VerbList, function(x){ Idx=which(x==”” | x %in% removewords) if(length(Idx)>0)x=x[-Idx] else x=x x=unique(x)} ) VerbList=sapply(VerbList,function(x){ paste(x,collapse=’,’)}) temp=which(VerbList==”) VerbList=VerbList[-temp] head(VerbList) write(VerbList,file=’C:\\Users\\folder\\Desktop\\VerbList_a’) verbWordList<- read.transactions(“C:\\Users\\folder\\Desktop\\VerbList_a”, format=”basket”,sep=”,”) rules <- apriori(verbWordList, parameter = list(support = 0.01,confidence = 0.01,minlen=2)) rules.sorted <- sort(rules, by=”support”) inspect(rules.sorted) #inspect(rules.sorted[1:5]) if(length(rules.sorted)>0){ rules.table=list(Keywords=lapply(1:length(rules.sorted), function(i){ wlist=do.call(‘c’,c(LIST(lhs(rules.sorted[i])),LIST(rhs(rules.sorted[i])))) }), quality=quality(rules.sorted)) } #changed … Read more