// Path: utils-basickit/src/main/java/com/cognitionis/utils_basickit/XmlAttribs.java
// public class XmlAttribs {
// 
// 
//      public static HashMap<String, String> parseAttrs(String attrs) {
//         // if separated by blanks or consists of only one argument with a quoted value use XML
//         if(attrs.matches(".*=\"[^\"]*\"\\s+.*") || attrs.matches("[^=]*=\"[^\"]*\"")){
//             return parseXMLattrs(attrs);
//         }else{ // otherwise use ";" separator that handles both quoted and un quoted values
//             return parseSemiColonAttrs(attrs);
//         }
//      }
// 
//      public static HashMap<String, String> parseXMLattrs(String attrs) {
//         HashMap<String, String> parsed_attrs=null;
//         try{
//         attrs=attrs.trim().replaceAll("\\s+", " ");
//         if(attrs.endsWith("\"")){attrs=attrs.substring(0, attrs.length()-1);}
//         String[] attrs_arr = attrs.split("\" ");
//         parsed_attrs = new HashMap<String, String>();
//         for (int i = 0; i < attrs_arr.length; i++) {
//             if (attrs_arr[i].matches("[^=]+=\"[^=]+")) {
//                 parsed_attrs.put(attrs_arr[i].substring(0, attrs_arr[i].indexOf("=\"")), attrs_arr[i].substring(attrs_arr[i].indexOf("=\"") + 2));
//             }
//         }
//         } catch (Exception e) {
//             System.err.println("Errors found (XmlAttribs):\n\t" + e.toString() + "\n");
//             if (System.getProperty("DEBUG") != null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
//                 e.printStackTrace(System.err);
//                 System.exit(1);
//             }
//             return null;
//         }
//         return parsed_attrs;
//     }
// 
//      public static HashMap<String, String> parseSemiColonAttrs(String attrs) {
//         HashMap<String, String> parsed_attrs=null;
//         try{
//         String[] attrs_arr = attrs.trim().replaceAll("\\s+", " ").split(";");
//         parsed_attrs = new HashMap<String, String>();
//         for (int i = 0; i < attrs_arr.length; i++) {
//             if (attrs_arr[i].matches("[^=]+=[^=]+")) {
//                 String name=attrs_arr[i].substring(0, attrs_arr[i].indexOf('='));
//                 String value=attrs_arr[i].substring(attrs_arr[i].indexOf('=') + 1);
//                 if (value.matches("\".*\"")) {
//                     value = value.substring(1, value.length() - 1);
//                 }
//                 parsed_attrs.put(name, value);
//             }
//         }
//         } catch (Exception e) {
//             System.err.println("Errors found (XmlAttribs):\n\t" + e.toString() + "\n");
//             if (System.getProperty("DEBUG") != null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
//                 e.printStackTrace(System.err);
//                 System.exit(1);
//             }
//             return null;
//         }
//         return parsed_attrs;
//     }
// 
// 
// 
// 
// }


import com.cognitionis.utils_basickit.XmlAttribs;
import java.util.*;
package com.cognitionis.nlp_files.annotation_scorers;



/**
 *
 * @author Héctor Llorens
 * @since 2011
 */
public class Judgement implements Comparable<Judgement> {
    // public and static to be accessed from outside in switchs if needed
    public static enum judgements {corr,inco,spur,miss;}  // Correct, Incorrect, Spurious, Missing

    private int judgement;
    private String element;
    private HashMap <String,String> attribs;
    private HashMap <String,String> alt_annot_attribs;
    private HashMap <String,Integer> alt_annot_attribs_scores;
    private int numline;  //
    private String keylines;
    private String annotlines;


    public Judgement(int j, String elem, String attrs, int nline, String keyline, String annotline){
        try{
        if(elem==null || keyline==null || annotline==null){
           throw new Exception("Null element, keyline or annotline");
        }
        //judgements.valueOf(j); // Check judgement
        judgements jdm=judgements.values()[j];  // Check judgement
        judgement=j;

        element=elem;
// Path: utils-basickit/src/main/java/com/cognitionis/utils_basickit/XmlAttribs.java
// public class XmlAttribs {
// 
// 
//      public static HashMap<String, String> parseAttrs(String attrs) {
//         // if separated by blanks or consists of only one argument with a quoted value use XML
//         if(attrs.matches(".*=\"[^\"]*\"\\s+.*") || attrs.matches("[^=]*=\"[^\"]*\"")){
//             return parseXMLattrs(attrs);
//         }else{ // otherwise use ";" separator that handles both quoted and un quoted values
//             return parseSemiColonAttrs(attrs);
//         }
//      }
// 
//      public static HashMap<String, String> parseXMLattrs(String attrs) {
//         HashMap<String, String> parsed_attrs=null;
//         try{
//         attrs=attrs.trim().replaceAll("\\s+", " ");
//         if(attrs.endsWith("\"")){attrs=attrs.substring(0, attrs.length()-1);}
//         String[] attrs_arr = attrs.split("\" ");
//         parsed_attrs = new HashMap<String, String>();
//         for (int i = 0; i < attrs_arr.length; i++) {
//             if (attrs_arr[i].matches("[^=]+=\"[^=]+")) {
//                 parsed_attrs.put(attrs_arr[i].substring(0, attrs_arr[i].indexOf("=\"")), attrs_arr[i].substring(attrs_arr[i].indexOf("=\"") + 2));
//             }
//         }
//         } catch (Exception e) {
//             System.err.println("Errors found (XmlAttribs):\n\t" + e.toString() + "\n");
//             if (System.getProperty("DEBUG") != null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
//                 e.printStackTrace(System.err);
//                 System.exit(1);
//             }
//             return null;
//         }
//         return parsed_attrs;
//     }
// 
//      public static HashMap<String, String> parseSemiColonAttrs(String attrs) {
//         HashMap<String, String> parsed_attrs=null;
//         try{
//         String[] attrs_arr = attrs.trim().replaceAll("\\s+", " ").split(";");
//         parsed_attrs = new HashMap<String, String>();
//         for (int i = 0; i < attrs_arr.length; i++) {
//             if (attrs_arr[i].matches("[^=]+=[^=]+")) {
//                 String name=attrs_arr[i].substring(0, attrs_arr[i].indexOf('='));
//                 String value=attrs_arr[i].substring(attrs_arr[i].indexOf('=') + 1);
//                 if (value.matches("\".*\"")) {
//                     value = value.substring(1, value.length() - 1);
//                 }
//                 parsed_attrs.put(name, value);
//             }
//         }
//         } catch (Exception e) {
//             System.err.println("Errors found (XmlAttribs):\n\t" + e.toString() + "\n");
//             if (System.getProperty("DEBUG") != null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
//                 e.printStackTrace(System.err);
//                 System.exit(1);
//             }
//             return null;
//         }
//         return parsed_attrs;
//     }
// 
// 
// 
// 
// }


// Path: nlp-files/src/main/java/com/cognitionis/nlp_files/annotation_scorers/Judgement.java
import com.cognitionis.utils_basickit.XmlAttribs;
import java.util.*;

package com.cognitionis.nlp_files.annotation_scorers;



/**
 *
 * @author Héctor Llorens
 * @since 2011
 */
public class Judgement implements Comparable<Judgement> {
    // public and static to be accessed from outside in switchs if needed
    public static enum judgements {corr,inco,spur,miss;}  // Correct, Incorrect, Spurious, Missing

    private int judgement;
    private String element;
    private HashMap <String,String> attribs;
    private HashMap <String,String> alt_annot_attribs;
    private HashMap <String,Integer> alt_annot_attribs_scores;
    private int numline;  //
    private String keylines;
    private String annotlines;


    public Judgement(int j, String elem, String attrs, int nline, String keyline, String annotline){
        try{
        if(elem==null || keyline==null || annotline==null){
           throw new Exception("Null element, keyline or annotline");
        }
        //judgements.valueOf(j); // Check judgement
        judgements jdm=judgements.values()[j];  // Check judgement
        judgement=j;

        element=elem;
        attribs=XmlAttribs.parseXMLattrs(attrs);