json[1][0].text=json[1][0].text.toUpperCase()//mess around
returndoc.text()
}
// See the pointer as just array indexes
// [1st sentence, start on 2nd term, end 3rd term, expected term-id]
nlp("that's it. Back to Winnipeg!").match('#Place').pointer[0]
{
letdoc=nlp('before middle after')
letm=doc.match('middle')
// add an extra word
doc.match('before').insertAfter('EXTRA')
returnm.text()// match is consistent
}
{
letdoc=nlp(`he hadn't really walked away.`)
lettmp=doc.clone()
// throw-around our temporary text
tmp.contractions().expand()
tmp.remove('(#Adverb|not)')
// run the analysis on a normalized form
if(tmp.has('had #PastTense')){
return`[found-verb-tense] - ${doc.text()}`
}
}
{
letdoc=nlp('January the 12th of 2022 at 3pm')
// mutate a clone
lettmp=doc.clone()
tmp.remove('(the|of|at|#Time)')
tmp.numbers().toCardinal()
// now 'january 12 2022'
lettmpYear=tmp.match('#Month . [#Value]$',0)
// '2022'
// get the match in the original document
letyear=doc.match(tmpYear)// just throw it in..
// '2022' (a different one)
// prove we're in the original
returnyear.grow('*').text()
}
{
letdoc=nlp('one two three')
lettmp=doc.clone()
// mutate the original
doc.remove('two')
// return a partial match
returndoc.match(tmp).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.