nlp("The summer wind came blowin' in").insertAfter('from across the sea').text()
nlp("back to Winnipeg!").insertBefore('That\'s it,').text()
{
letall=nlp(`your older, balder son`).adjectives()
letmore=nlp('fatter')
all.concat(more)
returnall.out('array')
}
{
letdoc=nlp(`..and that's how I got the vending machine contract for the kremlin`)
doc.match('for the kremlin').remove()
returndoc.text('trim')
}
{
letdoc=nlp('before one two three after')
letm=doc.numbers()// 'one two three'
m=m.not('two')
returnm.out('array')// 'one', 'three'
}
{
letdoc=nlp("springfield, springfield, it's a hell of a town.")
// child one
leta=doc.match('a hell of a town')
// child two
letb=a.match('a hell of a')
// transform the second child
b.replace('hell of a','reasonable')
//all views have changed
return{
a:a.text(),
b:b.text(),
doc:doc.text()
}
}
{
letdoc=nlp("before one two three after")
// keep a 'dangling' child document
letm=doc.match('one two three')
// transform the parent document
doc.replace('one two three','new')
//dangling document is updated? ❌
returnm.text()
}
{
letdoc=nlp('i walked downtown').compute('root')
doc.swap('walk','stroll')//use root-forms
returndoc.text()
}
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.