Search code examples
stanford-nlpsutime

Custom rule for SUTime is not working


I'm trying to annotate things like in 10 minutes, but for some reason I can't get it work.

I'm using a custom model file for my rules which is loaded after defs.sutime.txt, english.sutime.txt and english.holidays.sutime.txt.

My current rule is this:

{ 
    ( /in/ (?$a [ { temporal::IS_TIMEX_DURATION } ] ) )
    =>
    RelativeTime( $a[0].temporal.value )
}

Solution

  • I found the answer:

    ENV.defaults["ruleType"] = "composite"
    
    {
        ( /in/ (?$a [ { temporal::IS_TIMEX_DURATION } ] ) )
        =>
        TemporalCompose( OFFSET, TIME_REF, $a[0].temporal )
    }