Class TimeUtil


  • public class TimeUtil
    extends Object
    Time Util class
    Author:
    chenxin
    • Field Detail

      • DATETIME_NONE

        public static final int DATETIME_NONE
        date-time part index constants we consider a date-time as the following seven parts: +------+-------+-----+---------------+------+--------+--------+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | +------+-------+-----+---------------+------+--------+--------+ | year | month | day | timing method | hour | minute | second | +------+-------+-----+---------------+------+--------+--------+ and the numeric value before every part. Note: NLPSeg's date-time recognition base on this logic 1, the odd index is the entity part 2, the even index is the numeric value part
        See Also:
        Constant Field Values
    • Constructor Detail

      • TimeUtil

        public TimeUtil()
    • Method Detail

      • getDateTimeIndex

        public static final int getDateTimeIndex​(String entity)
        get and return the time part index of the specified IWord#entity
        Parameters:
        entity -
        Returns:
        int or -1 for failed
      • createDateTimePool

        public static final IWord[] createDateTimePool()
        create and return a date-time pool
        Returns:
        IWord[]
      • fillDateTimePool

        public static final int fillDateTimePool​(IWord[] wPool,
                                                 IWord word)
        fill the date-time pool specified part through the specified time entity string.
        Parameters:
        wPool -
        word -
        Returns:
        int
      • fillDateTimePool

        public static final void fillDateTimePool​(IWord[] wPool,
                                                  int pIdx,
                                                  IWord word)
        fill the date-time pool specified part with part index constant
        Parameters:
        wPool -
        pIdx -
        word -
      • getTimeKey

        public static final String getTimeKey​(String entity)
        get and return the time key part of the specified entity string
        Parameters:
        entity -
        Returns:
        String
      • getTimeKey

        public static final String getTimeKey​(IWord word)
      • getTimeKey

        public static final String getTimeKey​(int pIdx)
        get and return the time key part with the part index value
        Parameters:
        pIdx -
        Returns:
        String
      • fillTimeToPool

        public static final void fillTimeToPool​(IWord[] wPool,
                                                String timeVal)
        fill a date-time time part with a standard time format like '15:45:36' to the specified time pool
        Parameters:
        wPool -
        timeVal -