A starting point for an NLP++ text analyzer, with continuous integration that runs it on every push.
NLP++ is a programming language for natural language processing. An analyzer is a sequence of passes; each pass matches pattern rules against a parse tree and runs code when a rule fires, and a built-in knowledge base holds what the analyzer learns as it reads.
- Click Use this template above, then Create a new repository.
- Add the topic
nlp-plus-plusto your repository (the gear next to About) so other NLP++ projects can find it. - Clone it and open the folder in VS Code with the VisualText extension installed. The extension installs the NLP engine and its help.
spec/analyzer.seq the pass sequence
spec/*.nlp the passes
input/ text files to analyze
kb/user/ knowledge base sources: .dict dictionaries and .kbb knowledge bases
The analyzer builds a knowledge base and exports it as JSON:
kbinitcreates akbconcept off the knowledge-base root, keeps it in the global variableG("kb"), and fills in a small example (animalswithdogandcat). Replace the example with concepts your grammar passes find in the text.outputsaves the knowledge base withSaveKBand exports it withJsonKB.KBFuncsis VisualText's shared knowledge-base function library, whereSaveKBandJsonKBcome from. Leave it as it is and put your own functions in a separate@DECLpass after it.
Add your grammar passes between kbinit and output. Results appear in input/<file>_log/.
In VS Code, select a file in input/ and run the analyzer from the VisualText panel.
From the command line:
nlp -ANA <this folder> -IN <this folder>/input/text.txt -WORK <engine folder>-WORK is the engine's own folder (the one containing the nlp executable and its data/ folder),
not the analyzer's. With the VS Code extension installed it is
~/.vscode/extensions/dehilster.nlp-<version>/nlp-engine.
.github/workflows/analyze.yml installs the latest NLP engine release on every push and pull request,
runs the analyzer over every input/*.txt, and fails if the engine reports an error. Each file's
output log is kept as a downloadable artifact named output-logs.
- VisualText and the NLP++ textbook
- NLP engine
- More templates (dates, addresses, emails, telephone numbers, URLs, English parsing) ship with the VS Code extension.
MIT.