Package org.lionsoul.jcseg.util
Class TimeUtil
- java.lang.Object
-
- org.lionsoul.jcseg.util.TimeUtil
-
public class TimeUtil extends Object
Time Util class- Author:
- chenxin
-
-
Field Summary
Fields Modifier and Type Field Description static intDATETIME_Astatic intDATETIME_Dstatic intDATETIME_Hstatic intDATETIME_Istatic intDATETIME_Mstatic intDATETIME_NONEdate-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.static intDATETIME_Sstatic intDATETIME_Y
-
Constructor Summary
Constructors Constructor Description TimeUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IWord[]createDateTimePool()create and return a date-time poolstatic voidfillDateTimePool(IWord[] wPool, int pIdx, IWord word)fill the date-time pool specified part with part index constantstatic intfillDateTimePool(IWord[] wPool, IWord word)fill the date-time pool specified part through the specified time entity string.static voidfillTimeToPool(IWord[] wPool, String timeVal)fill a date-time time part with a standard time format like '15:45:36' to the specified time poolstatic intgetDateTimeIndex(String entity)get and return the time part index of the specified IWord#entitystatic StringgetTimeKey(int pIdx)get and return the time key part with the part index valuestatic StringgetTimeKey(String entity)get and return the time key part of the specified entity stringstatic StringgetTimeKey(IWord word)
-
-
-
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
-
DATETIME_Y
public static final int DATETIME_Y
- See Also:
- Constant Field Values
-
DATETIME_M
public static final int DATETIME_M
- See Also:
- Constant Field Values
-
DATETIME_D
public static final int DATETIME_D
- See Also:
- Constant Field Values
-
DATETIME_A
public static final int DATETIME_A
- See Also:
- Constant Field Values
-
DATETIME_H
public static final int DATETIME_H
- See Also:
- Constant Field Values
-
DATETIME_I
public static final int DATETIME_I
- See Also:
- Constant Field Values
-
DATETIME_S
public static final int DATETIME_S
- See Also:
- Constant Field Values
-
-
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(int pIdx)
get and return the time key part with the part index value- Parameters:
pIdx-- Returns:
- String
-
-