vormid=scan("sonavorm2.txt", what=character(), encoding = "UTF-8"); vormid=vormid[1:1000] #vormid=scan("d:/jaagup/17/01/soned2013_top1000.txt", what=character(), encoding = "UTF-8", sep="\n"); sonad=scan("tekstsonad.txt", what=character(), encoding = "UTF-8"); vastussona=vector(mode="character", length(sonad)) vastuskogus=vector(mode="character", length(sonad)) vastuspikkus=vector(mode="numeric", length(sonad)) for(koht in 1:length(sonad)){ #for(koht in 1:100){ sona=tolower(sonad[koht]) print(sona) lopp=1 while(length(grep(paste("^", substring(sona, 1, lopp), sep=""), vormid))>1 & lopptulemus$koht tulemus$oige=as.character(tulemus$sona)==tulemus$vastus tulemus$tundmine=substring(tulemus$sona, 1, tulemus$koht) #tulemus #colnames(tulemus) write.table(tulemus, "sagedased2.csv", sep=";", row.names=FALSE, quote=FALSE)