Skip to content

About

A named entity recogntition machine learning model based on BART and chrome extension for highlighting named entities on the web.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

36 Commits

Folders and files

Repository files navigation

Named Entity Recogntition Extension

About

An implementation of the NER model described in Template-Based Named Entity Recognition Using BART (Cui, Leyang et al., 2021) as well as a NER Chrome browser extension and server to highlight named entities on webpages.

Built With

  • Python
  • PyTorch
  • Node.js
  • Typescript
  • Javascript

Getting Started

Prerequisites

  • Python 3 (Tested with 3.11)
  • Node.js (Tested with Node 18)

Training the Model

In template-ner:

Steps 1-2 are optional but recommended to avoid package conficts

  1. Create a python virtual environment by running:

    python -m venv .venv
  2. Activate the virtual environment.

    For Linux (bash):

    . ./.venv/bin/activate

    For Windows:

    . ./.venv/Scripts/activate
  3. Install dependencies by running:

    pip install -r requirements.txt
  4. Download dataset by running:

    python dl_dataset.py
  5. Train model by running:

    python train.py

    Model will be saved in folder named best_model

  6. Test model and calculate F-1 by running:

    python test.py

Building The Extension

In ner-browser-extension:

  1. Install dependencies by running:

    npm install
  2. Build extension by running:

    npm run build

    Note for development: npm run dev can be used to watch files and continuously rebuild extension on update

  3. The extension is now built in the dist directory. Add the extension to Chrome

Running the Backend Server

In ner-backend:

Steps 1-2 are optional but recommended to avoid package conficts

  1. Create a python virtual environment by running:

    python -m venv .venv
  2. Activate the virtual environment.

    For Linux (bash):

    . ./.venv/bin/activate

    For Windows:

    . ./.venv/Scripts/activate
  3. Install dependencies by running:

    pip install -r requirements.txt
  4. Ensure a bart model is avaliable in a directory named best_model. Copying over the model you just trained is is recommended.

  5. Start the server by running:

    python server.py

    The server will now be listening on localhost:8080

Using the Extension

With the server running and extension installed in Chrome:

  1. Open a webpage

  2. Click Run when NER prompt popup shows up

  3. Wait for labels to be generated. See console for errors if they don't show up.

    • Note: it might take a significant amount of time to label the entire page depending on your computer's capabilities

About

A named entity recogntition machine learning model based on BART and chrome extension for highlighting named entities on the web.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages