// 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.*;



    public void changeAndExtendJudgement(int j, String keyline, String annotline){
        try{
        if(keyline==null || annotline==null){
           throw new Exception("Null keyline or annotline");
        }
        //judgements.valueOf(j); // Check judgement
        judgements jdm=judgements.values()[j];  // Check judgement
        judgement=j;
        keylines+="\n"+keyline;
        annotlines+="\n"+annotline;
        } catch (Exception e) {
            System.err.println("Errors found (" + this.getClass().getSimpleName() + "):\n\t" + e.toString() + "\n");
            if (System.getProperty("DEBUG")!=null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
                e.printStackTrace(System.err);
                System.exit(1);
            }
        }
    }





    public void add_alt_attribs(String attrs, String type){
        try{
        if(type.equals("key")){
            alt_annot_attribs=attribs;
// 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.*;




    public void changeAndExtendJudgement(int j, String keyline, String annotline){
        try{
        if(keyline==null || annotline==null){
           throw new Exception("Null keyline or annotline");
        }
        //judgements.valueOf(j); // Check judgement
        judgements jdm=judgements.values()[j];  // Check judgement
        judgement=j;
        keylines+="\n"+keyline;
        annotlines+="\n"+annotline;
        } catch (Exception e) {
            System.err.println("Errors found (" + this.getClass().getSimpleName() + "):\n\t" + e.toString() + "\n");
            if (System.getProperty("DEBUG")!=null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
                e.printStackTrace(System.err);
                System.exit(1);
            }
        }
    }





    public void add_alt_attribs(String attrs, String type){
        try{
        if(type.equals("key")){
            alt_annot_attribs=attribs;
            attribs=XmlAttribs.parseXMLattrs(attrs);