compromise
Version:
modest natural language processing
23 lines (20 loc) • 623 B
JavaScript
//combine them with .topics() method
const find = function (n) {
// builds without the chunker have no .clauses()
const r = this.clauses ? this.clauses() : this
// Find entities and acronyms without duplicating acronyms inside entities.
let m = r.people()
m = m.concat(r.places())
m = m.concat(r.organizations())
m = m.concat(r.match('#Acronym').ifNo(m))
m = m.not('(someone|man|woman|mother|brother|sister|father)')
//return them to normal ordering
m = m.sort('seq')
// m = m.unique()
m = m.getNth(n)
return m
}
const api = function (View) {
View.prototype.topics = find
}
export default api