Resolve Dates#

Syntax:

To set the date of a document.

wow::set_document_date

To resolve a date or a TimePhrase.

wow::resolve_date

Example:

“date: 10/Jan/2020. John went to london 2 days ago.”

Try

wow -p english,english-dates -i "date: 10/Jan/2020. John went to london 2 days ago." --tool stagger -a Date

Output:

Sentence:(0,18)
date : 10 / Jan / 2020 .
- Date -> 10 / Jan / 2020 @ abs_date=10/01/2020;
Sentence:(19,50)
John went to london 2 days ago .
- Date -> 2 days ago @ abs_date=08/01/2020;

You can also set the date using rule yourself, that what we do in our english-dates domain. But you also need to capture the Date’s that need to be resolved.

// Capture the original date of the publication.
rule:{ "Published" (Det|Prep)* {<>+} = wow::set_document_date Punct};

// capture the dates to resolve.
rule:{ Num 'day ago' } = wow::resolve_date;

Note

But it’s better just to use TimePhrase That will cover most of the relative dates.

Document Date#

The document date can also be set using the API using the option in the processing call. with the wow you can use the document-options in (wow)

--document-options '{ "document_date" : "10/Jan/2021" }'

Options#

set_document_date#

note (API option/Wow attribute), example you use.

--document-options '{ "document_date_format" : "%D" }'

from the command line, or set the data in wowool { … } =wow::set_document_date@( format=”%D” );

  • (document_date/-) : The original date of the document.

  • (date_order/date_order) : “MDY” The format on how to pare a give date that will be set.

  • (document_date_format/format) : The format of the date that will appear as an attribute. ex: “%Y-%d-%m”

  • (initial_date/ ) : initial date will set the date of a document only once. This is use full if there are multiple dates in your document and only one to use the first one. see datetime

resolve_date#

  • (document_date_format/format) : The format of the date that will appear as an attribute. ex: “%Y-%d-%m”

Note

You can use the environment variable to set the format EOT_DOCUMENT_DATE_FORMAT

Try:

wow -p "english,english-dates" -i "Published on the 10/Jan/2020. John went to london 2 days ago." --tool stagger -a Date

Output:

- Date -> 10/Jan/2020 @ abs_date=10/01/2020;
- Date -> 2 days ago @ abs_date=08/01/2020;