Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compromise-dates plugin: Trailing dash retained as part of date #1170

Open
Fdawgs opened this issue Feb 11, 2025 · 0 comments
Open

Compromise-dates plugin: Trailing dash retained as part of date #1170

Fdawgs opened this issue Feb 11, 2025 · 0 comments

Comments

@Fdawgs
Copy link
Contributor

Fdawgs commented Feb 11, 2025

Node version: 20.18.1
Compromise version: 14.14.4
Compromise-dates version: 3.7.1

When a date is trailed by a dash, it is retained as part of the date. I assume this is because compromise-dates considers it part of an (incomplete) dash date-range (i.e. 2024-01-01 - 2024-01-02)?

Example:

'use strict'

const nlp = require('compromise')
const nlpDates = require('compromise-dates')
nlp.plugin(nlpDates)

const text = '2025-05-11 - They have taken the bridge and the Second Hall'

const doc = nlp(text)
console.log(doc.dates().out())
/**
 * Output: 2025-05-11 -
 * Expected: 2025-05-11
 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant