Public
Edited
Nov 24, 2022
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
let doc = nlp("i have two questions for Homer - 'Why lie?' and 'Lies, why?'")
//get all numbers, in any form
let nums = doc.values()
return nums.out('array')
}
Insert cell
Insert cell
Insert cell
nlp(`why can't I have no kids and three money?`).numbers().json()[0]
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Insert cell
Insert cell
{
let doc = nlp('she is 5 years old')
doc.numbers().toText()
return doc.text()
}
Insert cell
Insert cell
{
let doc = nlp('she is five years old')
doc.numbers().toNumber()
return doc.text()
}
Insert cell
Insert cell
{
let doc = nlp('five bottles of beer')
doc.numbers().toOrdinal()
return doc.text()
}
Insert cell
Insert cell
{
let doc = nlp('fifth bottle of beer')
doc.numbers().toCardinal()
return doc.text()
}
Insert cell
Insert cell
nlp('$78392').numbers().toLocaleString().text()
Insert cell
Insert cell
nlp('742 Evergreen Terrace').numbers().set('eleven').text()
Insert cell
Insert cell
{
return {
'true': nlp('fourteen years old').numbers().set(1, true).all().text(), //agreement (default)
'false': nlp('fourteen years old').numbers().set(1, false).all().text(), //no agreement
}
}
Insert cell
Insert cell
Insert cell
{
let doc = nlp('three bottles of beer')
doc.numbers().minus(2)
return doc.text()
}
Insert cell
Insert cell
Insert cell
{
let doc = nlp('one bottle of beer')
doc.numbers().decrement()
return doc.text()
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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