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

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