开发者

Is there a partials-capable modern natural language date parser for Java? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend 开发者_开发问答to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 8 years ago.

Improve this question

I've got two problems and I wonder if I can solve them in one go. I'm trying to do natural language date parsing in Java (well, Scala) and have been using JChronic, the port of the excellent chronic RubyGem.

There's two problems though:

  1. JChronic uses java.util.Calendar rather than Joda-Time, and I think it is pretty reasonable to say that Joda-Time is, or should be, a replacement for the JDK date libraries. And if Joda-Time doesn't replace the existing date libraries, JSR 310 sure will sometime after Oracle finish litigation and get back to maintaining Java.

  2. JChronic doesn't handle general date-time parsing. If I tell it to parse "next thursday 4pm" or something like that, it handles it gracefully and gives me a Calendar object of the right time. But if I just say "2011" or "January 1963" or something like that, it can't handle general date ranges or Partials in Joda-Time speak.

The second of these is far more of a concern than the first. I'm trying to extract from webpages dates that are about documents (books, newspaper articles, web pages etc.) where things like publication dates and copyright dates are important.

I currently feel like I'm resigned to writing my own, or perhaps porting the ageing JChronic to use Joda-Time and adding support for partials. Is there any alternative solution that could satisfy at least (2) and maybe (1) as well?


You might want to check out SUTime which is a temporal parser. Their example code and online demo show support for partials. SUTime.Temporal objects should be able to provide you with their corresponding Joda-Time objects.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜