Public
Edited
Nov 3, 2022
1 fork
3 stars
Insert cell
Insert cell
{
let doc = nlp("John's family")
let json = doc.json()
return JSON.stringify(json[0].terms, null, 2)
}
Insert cell
Insert cell
Insert cell
nlp(`springfield, springfield, it's a hell of a town.`).match('springfield').tag('City').out('tags')
Insert cell
Insert cell
nlp("telegram for Heywood U. Cuddleme").people().unTag('#Person').json(0)
Insert cell
Insert cell
nlp("Moe Sizlak.").terms().canBe('#Verb').found
Insert cell
Insert cell
{
let doc = nlp("Moe Sizlak.").terms()
doc.tagSafe('#Verb') //has no effect
return doc.out('tags')[0].moe
}
Insert cell
Insert cell
// give it an ambiguous word
word = nlp('april')
Insert cell
// you can see, it's tagged as a '#Month':
word.json(0)
Insert cell
{//ok, decide it's a Person's name, instead
word.tag('FemaleName');
return word.json(0)
}
Insert cell
Insert cell
{ //add an unknown tag
word.tag('FooBar');
//change it back to a #Month
word.tag('Month');
return word.json(0).terms[0]
}
Insert cell
Insert cell
Insert cell
{
nlp.verbose(true); // open the dev console, to see the output
nlp('it is supercalifragilisticexpialidocious')
// 'it' -> Pronoun (lexicon-match)
// 'is' -> Copula (lexicon-match)
// 'supercal...' -> Adjective suffix -ous
}
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