spencermountain / compromise

modest natural-language processing

Home Page:http://compromise.cool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught TypeError: Cannot read properties of undefined (reading 'map')

MarketingPip opened this issue · comments

There is an error with using .out().

Example of usage that throws error:

import nlp from "compromise"


let doc = nlp("some terms here")

console.log(doc.chunks().out("terms"))//

Line with error has been commented.

  // some handy ad-hoc outputs
  if (method === 'terms') {
    let list = []
    this.docs.forEach(s => {
      let terms = s.terms.map(t => t.text) // ERROR COME'S FROM HERE
      terms = terms.filter(t => t)
      list = list.concat(terms)
    })
    return list
  }

Adding this issue so I don't forget to resolve this (unless you get to it before me).

Good catch! Thank you

@spencermountain - you're welcome! ps; check the gist I tagged you in!

fixed in 14.10.1 - thanks!