#!/usr/bin/env Rscript # Evaluate tagged output with gold standard # Jon Dehdari, 2009 # Usage: eval(gold.set,test.set) eval <- function(gold.set, test.set) { # If any words don't match in both sets, warn the user if( any( gold.set[,1] != test.set[,1]) ) { warning("Words in test set don't match words in gold standard") } else { matches = gold.set[,2] == test.set[,2] length(matches[matches == T]) / length(matches) } }