// Path: src/edu/toronto/cs/xcurator/utils/IOUtils.java
// public class IOUtils {
// 
//     public static List<String> readFileLineByLine(String file) {
//         String content = null;
//         try {
//             content = FileUtils.readFileToString(new File(file));
//         } catch (IOException ex) {
//             Logger.getLogger(IOUtils.class.getName()).log(Level.SEVERE, null, ex);
//         }
//         List<String> lines = Arrays.asList(content.split("\\r\\n|\\n|\\r"));
//         return lines;
//     }
// 
//     public static <T> String printMapAsJson(Map<String, T> map) {
//         StringBuilder sb = new StringBuilder();
//         if (map.isEmpty()) {
//             return "{}";
//         }
//         sb.append("{");
//         for (String key : map.keySet()) {
//             final Object val = (Object) map.get(key);
//             sb.append("\"").append(key).append("\":");
//             if (val.getClass().isPrimitive()) {
//                 sb.append("\"");
//             }
//             sb.append(val.toString());
//             if (val.getClass().isPrimitive()) {
//                 sb.append("\"");
//             }
//             sb.append(",");
//         }
//         sb.deleteCharAt(sb.length() - 1);
//         sb.append("}");
//         return sb.toString();
//     }
// 
//     public static void main(String[] args) {
//         Map<String, String> map = new HashMap<>();
//         map.put("hello", "345");
//         map.put("bye", "byebye");
//         System.out.println(printMapAsJson(map));
//     }
// }


import edu.toronto.cs.xcurator.utils.IOUtils;
import edu.toronto.cs.xml2rdf.xml.XMLUtils;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
            System.out.println("size: " + result.size());
            System.out.println();
            System.out.println("ground:\n " + ground);
            System.out.println("size: " + ground.size());
            System.out.println();
            System.out.println("intersection:\n " + intersection);
            System.out.println("size: " + intersection.size());
            System.out.println();
        }

        double pr = (double) intersection.size() / result.size();
        double re = (double) intersection.size() / ground.size();

        Accuracy ac = new Accuracy(pr, re);

        return ac;
    }

    private static void printAccuracyStats(Set<String> attributeSet, Set<String> grAttributesSet, boolean verbose) {
        Accuracy acAttr = evaluate(attributeSet, grAttributesSet, verbose);
        final String P = df.format(acAttr.precision());
        System.out.println("Prec:" + "\t" + P);
        final String R = df.format(acAttr.recall());
        System.out.println("Recall:" + "\t" + R);
        final String F1 = df.format(acAttr.fscore(1.0));
        System.out.println("F1:" + "\t" + F1);
        System.out.println(P + "\t" + R + "\t" + F1);
    }

    public static Set<String> readAttrEntFile(String filename) {
// Path: src/edu/toronto/cs/xcurator/utils/IOUtils.java
// public class IOUtils {
// 
//     public static List<String> readFileLineByLine(String file) {
//         String content = null;
//         try {
//             content = FileUtils.readFileToString(new File(file));
//         } catch (IOException ex) {
//             Logger.getLogger(IOUtils.class.getName()).log(Level.SEVERE, null, ex);
//         }
//         List<String> lines = Arrays.asList(content.split("\\r\\n|\\n|\\r"));
//         return lines;
//     }
// 
//     public static <T> String printMapAsJson(Map<String, T> map) {
//         StringBuilder sb = new StringBuilder();
//         if (map.isEmpty()) {
//             return "{}";
//         }
//         sb.append("{");
//         for (String key : map.keySet()) {
//             final Object val = (Object) map.get(key);
//             sb.append("\"").append(key).append("\":");
//             if (val.getClass().isPrimitive()) {
//                 sb.append("\"");
//             }
//             sb.append(val.toString());
//             if (val.getClass().isPrimitive()) {
//                 sb.append("\"");
//             }
//             sb.append(",");
//         }
//         sb.deleteCharAt(sb.length() - 1);
//         sb.append("}");
//         return sb.toString();
//     }
// 
//     public static void main(String[] args) {
//         Map<String, String> map = new HashMap<>();
//         map.put("hello", "345");
//         map.put("bye", "byebye");
//         System.out.println(printMapAsJson(map));
//     }
// }


// Path: src/edu/toronto/cs/xcurator/eval/EvalUtil.java
import edu.toronto.cs.xcurator.utils.IOUtils;
import edu.toronto.cs.xml2rdf.xml.XMLUtils;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

            System.out.println("size: " + result.size());
            System.out.println();
            System.out.println("ground:\n " + ground);
            System.out.println("size: " + ground.size());
            System.out.println();
            System.out.println("intersection:\n " + intersection);
            System.out.println("size: " + intersection.size());
            System.out.println();
        }

        double pr = (double) intersection.size() / result.size();
        double re = (double) intersection.size() / ground.size();

        Accuracy ac = new Accuracy(pr, re);

        return ac;
    }

    private static void printAccuracyStats(Set<String> attributeSet, Set<String> grAttributesSet, boolean verbose) {
        Accuracy acAttr = evaluate(attributeSet, grAttributesSet, verbose);
        final String P = df.format(acAttr.precision());
        System.out.println("Prec:" + "\t" + P);
        final String R = df.format(acAttr.recall());
        System.out.println("Recall:" + "\t" + R);
        final String F1 = df.format(acAttr.fscore(1.0));
        System.out.println("F1:" + "\t" + F1);
        System.out.println(P + "\t" + R + "\t" + F1);
    }

    public static Set<String> readAttrEntFile(String filename) {
        List<String> lines = IOUtils.readFileLineByLine(filename);