Public
Edited
Jan 23, 2024
1 star
Insert cell
Insert cell
{
let doc = nlp('london, tokyo, and rome')
let nouns = doc.splitOn('tokyo')
return nouns.out('array')
}
Insert cell
Insert cell
{
let doc = nlp('london england, tokyo, and rome')
let nouns = doc.splitAfter('@hasComma')
return nouns.out('array')
}
Insert cell
Insert cell
Insert cell
{
let doc = nlp('before middle after.')
return doc.splitOn('middle').out('array')
}
Insert cell
Insert cell
{
let doc = nlp('before middle after')
return doc.splitAfter('middle').out('array')
}
Insert cell
Insert cell
{
let doc = nlp('before middle after')
return doc.splitBefore('middle').out('array')
}
Insert cell
Insert cell
Insert cell
{
let doc = nlp('i saw Bob Dylan and Jimi Hendrix at Woodstock.')
// grab all the person-names
let people = doc.people()
// split by this list of matches
return doc.splitOn(people).out('array')
}
Insert cell
{
let doc = nlp(`i have two questions for Homer - 'Why lie?' and 'Lies, why?'`)
// grab all the quotations
let m = doc.quotations()
// split by this list of matches
return doc.splitOn(m).out('array')
}
Insert cell
Insert cell
{
let doc = nlp("one foo two foo")
// split-up by all terms
let m = doc.terms()
//join last two terms together
m = m.joinIf('two','foo')
return m.out('array')
}
Insert cell
Insert cell
{
let doc = nlp("one foo two foo")
// split-up by all terms
let m = doc.terms()
//join all terms back together
m = m.join()
return m.out('array')
}
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more