// Path: utils-basickit/src/main/java/com/cognitionis/utils_basickit/StringUtils.java
// public class StringUtils {
// 
//     /**
//      * Returns if a char is ASCII (fastest than the generic function: existsInEncoding(char c, String encoding))
//      * @param c
//      * @return
//      */
//     public static boolean isASCII(char c) {
//         return (((int) c >> 7) == 0);
//     }
// 
//     /**
//      * Returns if a char is ISO-8859-1 (fastest than the generic function: existsInEncoding(char c, String encoding))
//      * @param c
//      * @return
//      */
//     public static boolean isISO_8859_1(char c) {
//         return (((int) c) < 256);
//     }
// 
//     /**
//      * Returns if a char is of an encoding
//      * @param c
//      * @return
//      */
//     public static boolean existsInEncoding(char c, String encoding) {
//         try {
//             String s = "" + c;
//             byte bytes[] = s.getBytes(encoding);
//             String s2 = new String(bytes, encoding);
//             return (s2.equals(s));
//         } catch (Exception e) {
//             System.err.println("Errors found (StringUtils):\n\t" + e.toString());
//             if (System.getProperty("DEBUG") != null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
//                 e.printStackTrace(System.err);
//                 System.exit(1);
//             }
//             return false;
//         }
//     }
// 
//     /**
//      * Returns if a string is of an encoding
//      * @param s
//      * @return
//      */
//     public static boolean existsInEncoding(String s, String encoding) {
//         try {
//             byte bytes[] = s.getBytes(encoding);
//             String s2 = new String(bytes, encoding);
//             return (s2.equals(s));
//         } catch (Exception e) {
//             System.err.println("Errors found (StringUtils):\n\t" + e.toString());
//             if (System.getProperty("DEBUG") != null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
//                 e.printStackTrace(System.err);
//                 System.exit(1);
//             }
//             return false;
//         }
//     }
// 
//     public static int countOccurrencesOf(String source, char pattern) {
//         int count = 0;
//         if (source != null) {
//             int found = -1;
//             int start = 0;
// 
// 
//             while ((found = source.indexOf(pattern, start)) != -1) {
//                 start = found + 1;
//                 count++;
//             }
//             return count;
//         } else {
//             return 0;
//         }
//     }
// 
//     public static int countOccurrencesOf(String source, String pattern) {
//         int count = 0;
//         if (source != null) {
//             final int len = pattern.length();
//             int found = -1;
//             int start = 0;
// 
// 
//             while ((found = source.indexOf(pattern, start)) != -1) {
//                 start = found + len;
//                 count++;
//             }
//             return count;
//         } else {
//             return 0;
//         }
//     }
// 
//     public static String twoDecPosS(double d) {
//         Double a;
//         String twoDec;
//         int negative_inc = 0;
//         int decimal_pos = 0;
// 
//         a = (((int) Math.round((d) * 100.0)) / 100.0);
//         twoDec = a.toString();
// 
//         decimal_pos = twoDec.lastIndexOf('.');
//         if (decimal_pos == -1) {
//             twoDec += ".";
//             decimal_pos = twoDec.length();
//         }
//         twoDec += "00";
// 
//         twoDec = twoDec.substring(0, decimal_pos + 3);
// 
//         return twoDec;
//     }
// 
// public static <T> T[] concatArray(T[] first, T[] second) {
//   T[] result = Arrays.copyOf(first, first.length + second.length);
//   System.arraycopy(second, 0, result, first.length, second.length);
//   return result;
// }
// 
// 
// }


import com.cognitionis.utils_basickit.StringUtils;
import java.util.*;
        } else {
            if (System.getProperty("DEBUG") != null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
                System.err.println("Warining: error normalizing fraction (" + snumber + ") it has been set to 0.0 by default.");
            }
            return 0.0;
        }
    }

    // UK English       "and" is hundreds/thousands and tens/units separator
    // UK/US English    "-" is tens and units separator
    // 1506 --> one thousand five hundred and six
    // English units are always singular. Plural (milions) are only informal/indefinite (e.g., there were millions of people)
    // FREELING ERRORS IN NUMEK:      Eleven_hundred_ten_thousand_and_six = 1110006 (tens Hundreds are correct in English "informal")
    public String text2number(String snumber) {
        //Double number = new Double(0.0); // NO BECAUSE DO NOT SAVE OBJECTS BY REFERENCE...
        Number number = new Number();
        try {
            snumber = snumber.trim().toLowerCase().replaceAll("\\s+(st|nd|rd|th|o|a)$", "");
            // a twenty year period exception
            snumber = snumber.replaceAll("^(?:a|an)\\s+((?:"+units_re+"|"+tens_re+"|"+irregular_tens_re+").*)$", "$1");

            Integer magnitude = 0; // order of magnitude
            Integer max_magn = MAX_NUMBERS_ORDER;
            String[] elements = snumber.split("(\\s*-\\s*|\\s+" + numdelim + "\\s+|\\s+)");

            //System.out.println(snumber + " - numelems: "+elements.length);

            // already numeric expression
            if (locale.getLanguage().equalsIgnoreCase("es")) {
                snumber = snumber.replaceFirst(",", ".");
// Path: utils-basickit/src/main/java/com/cognitionis/utils_basickit/StringUtils.java
// public class StringUtils {
// 
//     /**
//      * Returns if a char is ASCII (fastest than the generic function: existsInEncoding(char c, String encoding))
//      * @param c
//      * @return
//      */
//     public static boolean isASCII(char c) {
//         return (((int) c >> 7) == 0);
//     }
// 
//     /**
//      * Returns if a char is ISO-8859-1 (fastest than the generic function: existsInEncoding(char c, String encoding))
//      * @param c
//      * @return
//      */
//     public static boolean isISO_8859_1(char c) {
//         return (((int) c) < 256);
//     }
// 
//     /**
//      * Returns if a char is of an encoding
//      * @param c
//      * @return
//      */
//     public static boolean existsInEncoding(char c, String encoding) {
//         try {
//             String s = "" + c;
//             byte bytes[] = s.getBytes(encoding);
//             String s2 = new String(bytes, encoding);
//             return (s2.equals(s));
//         } catch (Exception e) {
//             System.err.println("Errors found (StringUtils):\n\t" + e.toString());
//             if (System.getProperty("DEBUG") != null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
//                 e.printStackTrace(System.err);
//                 System.exit(1);
//             }
//             return false;
//         }
//     }
// 
//     /**
//      * Returns if a string is of an encoding
//      * @param s
//      * @return
//      */
//     public static boolean existsInEncoding(String s, String encoding) {
//         try {
//             byte bytes[] = s.getBytes(encoding);
//             String s2 = new String(bytes, encoding);
//             return (s2.equals(s));
//         } catch (Exception e) {
//             System.err.println("Errors found (StringUtils):\n\t" + e.toString());
//             if (System.getProperty("DEBUG") != null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
//                 e.printStackTrace(System.err);
//                 System.exit(1);
//             }
//             return false;
//         }
//     }
// 
//     public static int countOccurrencesOf(String source, char pattern) {
//         int count = 0;
//         if (source != null) {
//             int found = -1;
//             int start = 0;
// 
// 
//             while ((found = source.indexOf(pattern, start)) != -1) {
//                 start = found + 1;
//                 count++;
//             }
//             return count;
//         } else {
//             return 0;
//         }
//     }
// 
//     public static int countOccurrencesOf(String source, String pattern) {
//         int count = 0;
//         if (source != null) {
//             final int len = pattern.length();
//             int found = -1;
//             int start = 0;
// 
// 
//             while ((found = source.indexOf(pattern, start)) != -1) {
//                 start = found + len;
//                 count++;
//             }
//             return count;
//         } else {
//             return 0;
//         }
//     }
// 
//     public static String twoDecPosS(double d) {
//         Double a;
//         String twoDec;
//         int negative_inc = 0;
//         int decimal_pos = 0;
// 
//         a = (((int) Math.round((d) * 100.0)) / 100.0);
//         twoDec = a.toString();
// 
//         decimal_pos = twoDec.lastIndexOf('.');
//         if (decimal_pos == -1) {
//             twoDec += ".";
//             decimal_pos = twoDec.length();
//         }
//         twoDec += "00";
// 
//         twoDec = twoDec.substring(0, decimal_pos + 3);
// 
//         return twoDec;
//     }
// 
// public static <T> T[] concatArray(T[] first, T[] second) {
//   T[] result = Arrays.copyOf(first, first.length + second.length);
//   System.arraycopy(second, 0, result, first.length, second.length);
//   return result;
// }
// 
// 
// }


// Path: knowledgek/src/main/java/com/cognitionis/knowledgek/NUMEK/NUMEK.java
import com.cognitionis.utils_basickit.StringUtils;
import java.util.*;

        } else {
            if (System.getProperty("DEBUG") != null && System.getProperty("DEBUG").equalsIgnoreCase("true")) {
                System.err.println("Warining: error normalizing fraction (" + snumber + ") it has been set to 0.0 by default.");
            }
            return 0.0;
        }
    }

    // UK English       "and" is hundreds/thousands and tens/units separator
    // UK/US English    "-" is tens and units separator
    // 1506 --> one thousand five hundred and six
    // English units are always singular. Plural (milions) are only informal/indefinite (e.g., there were millions of people)
    // FREELING ERRORS IN NUMEK:      Eleven_hundred_ten_thousand_and_six = 1110006 (tens Hundreds are correct in English "informal")
    public String text2number(String snumber) {
        //Double number = new Double(0.0); // NO BECAUSE DO NOT SAVE OBJECTS BY REFERENCE...
        Number number = new Number();
        try {
            snumber = snumber.trim().toLowerCase().replaceAll("\\s+(st|nd|rd|th|o|a)$", "");
            // a twenty year period exception
            snumber = snumber.replaceAll("^(?:a|an)\\s+((?:"+units_re+"|"+tens_re+"|"+irregular_tens_re+").*)$", "$1");

            Integer magnitude = 0; // order of magnitude
            Integer max_magn = MAX_NUMBERS_ORDER;
            String[] elements = snumber.split("(\\s*-\\s*|\\s+" + numdelim + "\\s+|\\s+)");

            //System.out.println(snumber + " - numelems: "+elements.length);

            // already numeric expression
            if (locale.getLanguage().equalsIgnoreCase("es")) {
                snumber = snumber.replaceFirst(",", ".");
                if (StringUtils.countOccurrencesOf(snumber, '.') > 1) {