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

Bug: Missed #Month tags #972

Closed
thegoatherder opened this issue Oct 24, 2022 · 2 comments
Closed

Bug: Missed #Month tags #972

thegoatherder opened this issue Oct 24, 2022 · 2 comments

Comments

@thegoatherder
Copy link
Contributor

#Month seems to get missed for some texts prefixed with for :

const nlp = require('compromise')

const text = [
  'for January 2022',    // broken
  'for February 2022',
  'for March 2022',
  'for April 2022',      // broken
  'for May 2022',
  'for June 2022',       // broken
  'for July 2022',
  'for August 2022',     // broken
  'for September 2022',
  'for October 2022',
  'for November 2022',
  'for December 2022',
  'in January 2022',
  'in February 2022',
  'in March 2022',
  'in April 2022',
  'in May 2022',
  'in June 2022',
  'in July 2022',
  'in August 2022',
  'in September 2022',
  'in October 2022',
  'in November 2022',
  'in December 2022',
  'on January 2022',
  'on February 2022',
  'on March 2022',
  'on April 2022',
  'on May 2022',
  'on June 2022',
  'on July 2022',
  'on August 2022',
  'on September 2022',
  'on October 2022',
  'on November 2022',
  'on December 2022',
  'January 2022',
  'February 2022',
  'March 2022',
  'April 2022',
  'May 2022',
  'June 2022',
  'July 2022',
  'August 2022',
  'September 2022',
  'October 2022',
  'November 2022',
  'December 2022',
]

const monthCheck = text.map((t) => ({ text: t, hasMonth: nlp(t).match('#Month').length > 0 }))
console.log(monthCheck.filter((m) => !m.hasMonth))

Expected Result
All items in the array should have a #Month tag - so the console.log() should output an empty array

Actual Result

[
  { text: 'for January 2022', hasMonth: false },
  { text: 'for April 2022', hasMonth: false },
  { text: 'for June 2022', hasMonth: false },
  { text: 'for August 2022', hasMonth: false }
]
@thegoatherder
Copy link
Contributor Author

Changing the last line to:

monthCheck.filter((m) => !m.hasMonth).forEach((t) => nlp(t.text).debug())

Outputs this

┌─────────
  │ 'for'      - Preposition
  │ 'January'  - Noun, Singular, ProperNoun, Person
  │ '2022'     - Value, Cardinal, NumericValue, Year, Date



  ┌─────────
  │ 'for'      - Preposition
  │ 'April'    - Noun, Singular, ProperNoun, Person
  │ '2022'     - Value, Cardinal, NumericValue, Year, Date



  ┌─────────
  │ 'for'      - Preposition
  │ 'June'     - Noun, Singular, ProperNoun, Person
  │ '2022'     - Value, Cardinal, NumericValue, Year, Date



  ┌─────────
  │ 'for'      - Preposition
  │ 'August'   - Noun, Singular, ProperNoun, Person
  │ '2022'     - Value, Cardinal, NumericValue, Year, Date

Problem seems to be related to #Person tag replacing the #Month tag

@spencermountain
Copy link
Owner

fixed in 14.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants