winkjs / showcase-timeline

📆 Timeline view of Wikipedia articles
https://winkjs.org/showcase-timeline/
MIT License
6 stars 2 forks source link

Extending DATE recognition? #9

Open paul-bell opened 3 years ago

paul-bell commented 3 years ago

Hello Sanjaya,

In following your timeline example at https://github.com/winkjs/showcase-timeline#winknlp-timeline, I set the text variable to the data shown below (which is pretty much a timeline by itself).

I was surprised that the program returned no DATE objects, but then realized that dates of the form shown are not valid input to the JavaScript Date constructor.

What change would be required to the program to detect this date format and report it as a DATE?

Thanks for your help.

-Paul

4:32:01 AM PDT
All suspects are now in police custody.
4:29:02 AM PDT
No further updates have been provided.
4:25:57 AM PDT
No injuries have been reported. Officers have not stated whether any shots were fired.
4:24:42 AM PDT
LAPD units advise they are holding three suspects at gunpoint.
4:24:41 AM PDT
The address reported for this incident has changed to W 76th St & S Broadway.
4:24:03 AM PDT
An officer at the scene reports seeing the possible suspect vehicle.
4:23:05 AM PDT
Police have received another report of a shooting at 7617 S Broadway.
4:23:04 AM PDT
The address reported for this incident has changed to 7617 S Broadway.
4:21:49 AM PDT
The address reported for this incident has changed to 317 W 78th St.
4:21:05 AM PDT
A possible suspect vehicle may have fled southbound.
4:20:08 AM PDT
A 911 caller has reported hearing three or four gunshots in the area. This report is unconfirmed.
4:20:07 AM PDT
Incident reported at 3171 W 78th St.
sanjayaksaxena commented 3 years ago

Hello @paul-bell

The current models are not detecting the HH:MM:SS formats; they are only detecting HH:MM formats. Therefore it is not recognizing 4:32:01 AM PDT; but it will recognize 4:32 AM PDT. It will take a while to build a new model and release it — will surely try to include it in the next minor release.

As far as JS Date is concerned, one can always transform the string to match the requirements.

paul-bell commented 3 years ago

Hey Sanjaya,

Thanks for your quick reply.

Thank you for the intent to include recognition of :SS in the next minor release; much appreciated! Any sense for when that would be?

In the meantime, I removed the :SS from the dates in the foregoing text but I am still not seeing any DATE output.

What am I doing wrong?

-Paul

paul-bell commented 3 years ago

In fact, I reverted the text as follows:

let text = "She was born in 1869. She died in 1940 at 4:32 AM PDT."

And tried as shown as well as '4:32 AM' and '4:32'. But in no case do I see a Date object output, i.e., I see both 1869 and 1940 tagged as dates, but I don't see the times - e.g.,

[
  {
    date: '1869',
    unixTime: -3187209600,
    sentence: 'She was born in <mark>1869</mark>.'
  },
  {
    date: '1940',
    unixTime: -946771200,
    sentence: 'She died in <mark>1940</mark> at 4:32'
  }
]
sanjayaksaxena commented 3 years ago

Here is an working example at https://runkit.com/sanjaya/610d223ff9810f0019f838db — time & date are clearly highlighted:

image
paul-bell commented 3 years ago

Most kind of you; thanks.

As noted above, I copied your original example: https://github.com/winkjs/showcase-timeline#winknlp-timeline. I see differences between that code and what you last posted. But my questions about that will keep till next week.

Thanks again.

-Paul