spencermountain / compromise

modest natural-language processing
http://compromise.cool
MIT License
11.31k stars 645 forks source link

Compromise-dates plugin does not detect "fortnight" as a date #1114

Open Fdawgs opened 1 month ago

Fdawgs commented 1 month ago

Node version: 20.14.0 Compromise version: 14.13.0 Compromise-dates version: 3.5.0

Using the compromise-dates plugin, "fornight" is not detected as a date value.

There does seem to be code in place for it.

Example:

'use strict'

/** @type {import('compromise').default} */
const nlp = require('compromise')
const nlpDates = require('compromise-dates')
nlp.plugin(nlpDates)

const doc = nlp("Let's play Fortnite in a fortnight")

const context = {
  today: '2023-01-01',
}

const datesViews = doc.dates(context)
const dateList = datesViews.json()

console.log(dateList[0]?.dates)
/*
Prints "undefined".

Expected it to print:
{
  start: '2023-01-15T00:00:00.000Z',
  end: '2023-01-15T23:59:59.999Z',
  timezone: 'Europe/London',
  duration: { years: 0, months: 0, days: 1, hours: 0, minutes: 0 }
}
*/