In the world of artificial intelligence and natural language processing, understanding named entities is key to extracting meaningful insights from text. Enter displaCy ENT, a modern named entity visualizer that seamlessly integrates into the spaCy library, making it easier than ever to visualize and interact with entity recognition tasks.
What is displaCy ENT?
displaCy ENT is a powerful tool for visualizing named entities within your text, allowing users to identify and correct common errors in automatic named entity recognition systems. As of version 2.0.0, displaCy’s visualizers are part of the core library, enhancing ease of use and accessibility. This integration makes it incredibly simple to visualize a Doc object directly from spaCy and enhances the workflow when dealing with named entities.
Getting Started
Here’s how you can set up and start using displaCy ENT in your projects.
Run the Demo
To get a taste of displaCy ENT, you can run the demo locally. Follow these steps:
- Open your terminal and execute the following commands:
sudo npm install --global harp
git clone https://github.com/explosion/displacy-ent
cd displacy-ent
harp server
Using displaCy ENT
To integrate displaCy ENT into your project, you can include it either from GitHub or via npm. Here’s how:
npm install displacy-ent
Next, initialize a new instance specifying the required API and settings:
const displacy = new displaCyENT(
'http://localhost:8000',
{
container: '#displacy',
defaultText: 'When Sebastian Thrun started working on self-driving cars at Google in 2007, few people outside of the company took him seriously.',
defaultEnts: ['person', 'org', 'date']
}
);
How It Works: An Analogy
Imagine organizing a huge library of books. Each book is unique with a different author, topic, and year of publication. Now, trying to find specific information or queries can feel overwhelming without a proper cataloging system. displaCy ENT acts like a diligent librarian who takes notes about important names (like authors), places (like cities), and specific dates (like publication years) as readers wander through the rows of literature. With displaCy, the librarian gives you a quick overview of who the important figures are and what notable events occurred, all marked clearly for your understanding.
Visualizing Entities
To visualize entities, you can use the parse(text, model, ents) method:
const text = 'When Sebastian Thrun started working on self-driving cars at Google in 2007, few people outside of the company took him seriously.';
const model = 'en';
const ents = ['person', 'org', 'date'];
displacy.parse(text, model, ents);
Rendering Entities Manually
If you prefer to render entities manually, you can use the render() function:
const text = 'When Sebastian Thrun started working on self-driving cars at Google in 2007, few people outside of the company took him seriously.';
const spans = [
{ end: 20, start: 5, type: 'PERSON' },
{ end: 67, start: 61, type: 'ORG' },
{ end: 75, start: 71, type: 'DATE' }
];
const ents = ['person', 'org', 'gpe', 'loc', 'product'];
displacy.render(text, spans, ents);
Troubleshooting
If you encounter issues while setting up or using displaCy ENT, here are some troubleshooting ideas:
- Ensure Node.js and npm are installed correctly on your machine.
- Verify that you have cloned the correct GitHub repository for displaCy ENT.
- If the local server does not start, please check the command for any typos.
- Make sure your API settings are correctly specified in the instance initialization.
- For persistent errors, check for any updates in the displaCy ENT GitHub repository.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

