Using Claude with NLP++

If you have never used NLP++, the good news is that Claude can help you.

Here’s how.

Step 1 — Install VS Code

Download and install Visual Studio Code from code.visualstudio.com for your platform (Windows, macOS, or Linux). Open it once to confirm it runs.

Step 2 — Install the NLP++ extension

Open the Extensions view (Ctrl+Shift+X on Windows, Cmd+Shift+X on Mac), type in “nlp” in the search box. NLP++ should be up at the top. Install it (don’t install the second extension – it is not for NLP++).

Next, in the bottom panel find the VisualText tab and click on it. Locate the Analyzers tab and find the cog icon. Click on the cog icon to load the example analyzers. The window will reload. Reopen the bottom panel (use the icons in the top right to do this) and click again on VisualText. There will now be example analyzers you can click on.

Choose an analyzer in the analyzer tab at the bottom and then click on the NLP++ icon on the left. Choose a text in the top right and click on the play icon to run. Locate the Output list in the bottom panel in VisualText and click on the different output.

Click on the analyzer steps in the analyzer sequence panel to the left and start looking around at the current analyzer at the rules and functions. Familiarize yourself with the interface.

Step 3 — Add Claude Code to VS Code

Install Anthropic’s Claude Code extension by typing in “Claude” in the extensions panel search. Click on the Claude icon. Sign in with your Claude subscription. Claude now works as an assistant inside the same editor window, with access to your analyzer files.

Step 4 — Set up a folder and create an analyzer

Pick a folder somewhere on your local computer to hold your analyzers — this is the workspace where every analyzer you build will live. Open that folder in VSCode, then create a new analyzer using the new analyzer icon in the analyzers tab in the bottom panel of VisualText. It will then open up all the templates to choose from at the top middle of VSCode.

The default is the Knowledge Base template, which is a good first start: it comes with the scaffolding (spec/KBFuncs.nlp, spec/kbinit.nlp, spec/output.nlp) for accumulating results into a knowledge base and emitting them as JSON. Most extraction tasks — including the built-in prompts in the next step — build on this template, so unless you have a reason to pick another, start here.

With the folder and a starter analyzer in place, you’re ready to hand Claude one of the built-in prompts along with your own specific instructions to build your first analyzer.

Step 5 — Prime Claude first, then pick a task prompt

The VisualText extension ships ready-made prompts that already fill in the machine-specific paths (the engine, the example analyzers, the templates, the language libraries) so Claude starts on the rails instead of guessing at conventions.

Open the Help list in the very bottom left of VisualText and locate the LLM Prompts sublist. The library now opens with a priming prompt and an overview page, followed by four task prompts:

  1. Prime Claude for NLP++ — paste this into every new Claude session before you ask for anything else. It is everything Claude needs to know to work on your analyzers: the installed engine, example, and template paths, the conventions that keep it on the rails (use the Knowledge Base template as intended, accumulate results into a KB, emit JSON with JsonKB, run with -WORK pointing at the engine directory), a map of the 400+ help pages so Claude looks up the language instead of guessing, and the engine facts that trip up newcomers. There is no blank to fill in — once Claude has read it and studied the examples and templates, it tells you it is ready and you describe whatever task you have.
  2. General pointers: Claude + NLP++ — an overview rather than a prompt. It explains why the pairing works (Claude is good at gathering and cleaning development corpora, it mimics NLP++’s rule and code patterns well, and it can work across an existing analyzer — adding passes, writing KBs, generating test inputs, debugging why a rule fires), and it describes each prompt in the library and when to reach for it.
  3. From scratch: chemical formulas — a complete, self-contained worked example. Claude gathers a Wikipedia chemistry corpus and builds an analyzer that finds chemical formulas and breaks each into its elements and atom counts, emitting JSON via JsonKB. Study this one first to watch an analyzer built end to end, or use it as the model for your own from-scratch build.
  4. Harden analyzer — for an analyzer you already have. It generates additional, varied test inputs including edge cases, places them under the analyzer’s input/ directory, runs them through the engine, and reports where the extraction looks wrong so you can tighten rules and re-bless your regression goldens.
  5. Create Dictionaries & KBs — also for an existing analyzer. It builds NLP++ dictionaries (.dict) and knowledge bases (.kbb), learning the exact format from the shared language and misc libraries, and places the files under the analyzer’s kb/user/ directory.
  6. Add missing words to the English dictionary — for an analyzer that reports unrecognized words. It reads missing_words.txt from the analyzer’s output log and, for each genuine word, adds a properly featured entry (part of speech, root, verb/noun features) to en-full.dict and en-full.kbb — keeping both files alphabetized with identical headword sets, and quarantining noise (typos, fragments, proper nouns) into a separate list for your review.

The order matters. The four task prompts assume Claude has already been primed, so start every fresh session with Prime Claude for NLP++. Let Claude read the examples and templates and confirm it is ready — then paste the task prompt (or just describe what you want in your own words).

Choose your prompt. The prompt text will appear in an editor window. Select all and copy.

Click on the Claude icon in the activities window on the left and in the left Claude panel, click on “+ New Session”. A Claude dialog box should appear. Paste your prompt into the Claude dialog box in the Claude session window. Send it.

Dialog with Claude as it helps build your analyzer.

Step 6 — Explore the analyzer visually in VisualText

VisualText is what we call the NLP++ language extension for VS Code. It gives you a visual way to look inside an analyzer instead of reading raw folders — use it to understand what Claude built (or any existing analyzer).

Open the Analyzer tab and click through the analyzer’s steps. Each pass is right there to inspect:

  • Rules — click a pass to open its rules and see the grammar logic that fires.
  • Functions — read the NLP++ functions that passes call.
  • Output files — inspect what each pass emits as the text flows through the sequence.
  • The final parse tree — see the fully built tree the analyzer produces for a given input.
  • Dictionaries and knowledge bases — open the KB View to browse the .dict and .kbb entries the analyzer relies on.

Click around. There are lots of ways to visually examine an analyzer in NLP++ using VisualText, and the fastest way to learn one is to run it and watch each step. And when you get stuck, check the Help view in the bottom left — it’s packed with helpful information and tips for understanding and using NLP++.

When you want to change behavior, you have two levers: ask Claude to make the edit, or open the rule, dictionary, or function and change it by hand. Re-run after every change, and lock in the behavior you want with regression tests.

Different Ways to Use Claude with NLP++

There are several ways Claude can help you with your NLP++ analyzers. All of them start the same way: paste Prime Claude for NLP++ into a new Claude session so it knows where the engine, examples, templates, libraries, and help pages live.

  • Building an analyzer from scratch. Prime Claude, then describe your corpus and what you want extracted. Use the chemical formulas prompt as a pattern for how a from-scratch build goes.
  • Hardening an existing analyzer. Claude can create new text to run the analyzer on, run it through the engine, and help fix the problems that arise.
  • Creating dictionaries and knowledge bases. Once primed, Claude knows where everything is and has plenty of examples on how to build and use .dict and .kbb files.
  • Extending the English dictionary. If your analyzer reports missing words, Claude can turn that list into properly featured en-full.dict and en-full.kbb entries and set the questionable ones aside for you to review.
  • Everyday help on an analyzer you already have. Adding or refining grammar passes, generating test inputs, debugging why a rule does or doesn’t fire, and explaining unfamiliar passes or library functions.

Conclusion

Claude can help those unfamiliar with writing deterministic NLP++ analyzers for the first time. It can also help improve your existing NLP++ analyzers. It will help you get started so that you can begin to understand the structure and code for NLP++.

What is somewhat ironic, is that you will be using a statistical, untrustworthy opaque box that can hallucinate in order to create a glass box, rule-based, trustworthy NLP analyzer that never hallucinates and can continuously be improved and trusted.

Loading