Class DateNormalization

java.lang.Object
org.opensextant.extractors.xtemporal.DateNormalization

public class DateNormalization extends Object
Author:
ubaldino
  • Field Details

    • INVALID_DATE

      public static int INVALID_DATE
    • INVALID_DAY

      public static int INVALID_DAY
    • NO_YEAR

      public static int NO_YEAR
    • NO_MONTH

      public static int NO_MONTH
    • NO_DAY

      public static int NO_DAY
  • Constructor Details

    • DateNormalization

      public DateNormalization()
  • Method Details

    • format_date

      public static String format_date(Date d)
      Format_date.
      Parameters:
      d - date obj
      Returns:
      formatted date
    • normalizeDate

      public static void normalizeDate(Map<String,String> elements, DateMatch dt) throws ParseException
      For now this reports only DATE and standard TIME fields. Timezone is still
      Parameters:
      elements - pattern fields
      dt - found date
      Throws:
      ParseException - the parse exception
    • normalize_tz

      public static org.joda.time.DateTimeZone normalize_tz(Map<String,String> elements)
      Z or Zulu is not always recognized as UTC / GMT+0000.
      Parameters:
      elements - pattern fields
      Returns:
      the date time zone
    • normalizeTime

      public static int normalizeTime(Map<String,String> elements, String tmField)
      Given a field hh, mm, or ss, get field from map and normalize/validate the value.
      Parameters:
      elements - the elements
      tmField - the tm field
      Returns:
      the int
    • normalize_year

      public static int normalize_year(Map<String,String> elements)
      Normalize_year.
      Parameters:
      elements - all matched fields
      Returns:
      year fixed if possible, otherwise INVALID_DATE
    • normalize_month

      public static int normalize_month(Map<String,String> elements) throws ParseException
      Normalize_month.
      Parameters:
      elements - the elements
      Returns:
      the int
      Throws:
      ParseException - the parse exception
    • normalize_month_name

      public static int normalize_month_name(Map<String,String> elements) throws ParseException
      Normalize_month_name.
      Parameters:
      elements - pattern fields
      Returns:
      the month numeric
      Throws:
      ParseException - the parse exception
    • normalize_day

      public static int normalize_day(Map<String,String> elements)
      Normalize_day.
      Parameters:
      elements - pattern fields
      Returns:
      the int
    • getIntValue

      public static int getIntValue(String val)
      Gets the int value.
      Parameters:
      val - the val
      Returns:
      the int value