Giter VIP home page Giter VIP logo

search-query-named-entity-recognition-with-spacy's Introduction

Search Query Named Entity Recognition with spaCy

This repository contains a project for extracting search filters from natural language queries using custom named entity recognition with spaCy and machine learning. I trained a custom NER model to extract these entities using a dataset saved in CSV format, which is cleaned, converted to the spaCy tuple format in preprocessing and used to train/validate the model.

Dataset

Put your CSV input data into the data/raw directory. Make sure the first column is titled "Text" and contains the full string, while every subsequent column represents an entity name and contains the extracted entity values. Something like the following schema should work:

Screenshot 2023-07-29 at 12 08 18 PM

Usage

  1. Open a terminal or command prompt and navigate to the project directory.
  2. Create a virtual environment by running the following command:
python -m venv venv
  1. Activate the virtual environment: For Windows:
venv\Scripts\activate

For macOS/Linux:

source venv/bin/activate
  1. Install the required dependencies by running the following command:
pip install -r requirements.txt
  1. Clean the data by running the following command:
cd cleaning && python clean_data.py
  1. Prepare the data for training by running the following command:
cd .. && cd preprocessing && python prepare_data.py
  1. Train the NER model by running the following command:
cd .. && python train_ner.py
Screenshot 2023-07-28 at 7 41 32 PM
  1. After the model has been generated, you can test it by running the following command:
cd testing && python test_ner.py
Screenshot 2023-07-28 at 7 44 15 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.