Skip to content

Commit

Permalink
fix issue #3
Browse files Browse the repository at this point in the history
  • Loading branch information
xinmei.kxm committed Jul 19, 2017
1 parent c1e0901 commit 727833b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -10,7 +10,7 @@
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
<directory>resource</directory>
<includes>
<include>**/*</include>
</includes>
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/com/time/nlp/TimeUnit.java
Expand Up @@ -981,7 +981,7 @@ private void preferFutureWeek(int weekday, Calendar c) {
Calendar curC = Calendar.getInstance();
if (this.normalizer.getTimeBase() != null) {
String[] ini = this.normalizer.getTimeBase().split("-");
curC.set(Integer.valueOf(ini[0]).intValue(), Integer.valueOf(ini[1]).intValue(), Integer.valueOf(ini[2]).intValue()
curC.set(Integer.valueOf(ini[0]).intValue(), Integer.valueOf(ini[1]).intValue() - 1, Integer.valueOf(ini[2]).intValue()
, Integer.valueOf(ini[3]).intValue(), Integer.valueOf(ini[4]).intValue(), Integer.valueOf(ini[5]).intValue());
}
int curWeekday = curC.get(Calendar.DAY_OF_WEEK);
Expand Down
8 changes: 4 additions & 4 deletions test/com/shinyke/TimeAnalyseTest.java
Expand Up @@ -39,9 +39,9 @@ public void testTimeNLP() throws URISyntaxException {
TimeNormalizer normalizer = new TimeNormalizer(url.toURI().toString());
normalizer.setPreferFuture(true);

// normalizer.parse("7月17日下午4点");// 严格时间格式的识别
// normalizer.parse("本周日到下周日提醒我跑步");// 严格时间格式的识别
// TimeUnit[] unit = normalizer.getTimeUnit();
// System.out.println("7月17日下午4点");
// System.out.println("本周日到下周日提醒我跑步");
// System.out.println(DateUtil.formatDateDefault(unit[0].getTime()) + "-" + unit[0].getIsAllDayTime());


Expand Down Expand Up @@ -117,9 +117,9 @@ public void testTimeNLP() throws URISyntaxException {
// }

//例3
normalizer.parse("去年11月起正式实施的刑法修正案(九)中明确,在法律规定的国家考试中,组织作弊的将入刑定罪,最高可处七年有期徒刑。另外,本月刚刚开始实施的新版《教育法》中也明确...", "2017-07-19-00-00-00");
normalizer.parse("本周日到下周日提醒我跑步", "2017-07-19-00-00-00");
TimeUnit[] unit = normalizer.getTimeUnit();
System.out.println("去年11月起正式实施的刑法修正案(九)中明确,在法律规定的国家考试中,组织作弊的将入刑定罪,最高可处七年有期徒刑。另外,本月刚刚开始实施的新版《教育法》中也明确...");
System.out.println("本周日到下周日提醒我跑步");
for(int i = 0; i < unit.length; i++){
System.out.println("时间文本:"+unit[i].Time_Expression +",对应时间:"+ DateUtil.formatDateDefault(unit[i].getTime()));
}
Expand Down

0 comments on commit 727833b

Please sign in to comment.