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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more