Natural Language date and time parser for java

后端 未结 8 1261
[愿得一人]
[愿得一人] 2020-12-01 20:57

I am working on a Natural Language parser which examines a sentence in english and extracts some information like name, date etc.

for example: \"Lets meet next t

相关标签:
8条回答
  • 2020-12-01 21:30

    You can use JChronic, the Java port of Chronic.

    0 讨论(0)
  • 2020-12-01 21:33

    For my use case, I had more luck with chrono-java - sadly it looks stale and is not available in any Maven repository (also not via https://jitpack.io/ since the build is broken), so you have to fix and build it for yourself.

    However, checking out the code and fixing a dependency (maven-javadoc-plugin was missing groupId and I updated the version), allowed me to build and run a simple example successfully:

    List<ParsedResult> results = Chrono.Parse("Datum  Freitag, 08.04. bis einschl. Sonntag 10.04.2016");
        results.forEach(result -> System.out.println(result));
    

    resulted in 2 Dates being extracted:

    ParsedResult: " 08.04" > 04/08/2018 12:00
    ParsedResult: "10.04.2016" > 04/10/2016 12:00
    
    0 讨论(0)
  • 2020-12-01 21:38

    Natty is a really good replacement for JChronic.

    0 讨论(0)
  • 2020-12-01 21:40

    I would suggest using UIMA with OpenNLP connectors and same hand made regexp rules.

    0 讨论(0)
  • 2020-12-01 21:48

    Pretty old question bur PrettyTime::NLP is another option to try

    0 讨论(0)
  • 2020-12-01 21:49

    Have you tried jchronic? However, I doubt any library could directly work with sentences: you'd have to extract sentence fragments and feeding them to a NLP date parsing framework yourself, perhaps on a trial-n-error basis (larger and larger fragments until the framework throws an error).

    0 讨论(0)
提交回复
热议问题