Giter Site home page Giter Site logo

nplfoodspacy's Introduction

NPLfoodSpacy

To download the repository on your local computer, write this code in git bash:

git clone https://github.com/JohayraPrithula/NPLfoodSpacy

Installing and Setting up the Libraries

The official page for installation is https://spacy.io/usage. This link provides the necessary commands to execute the installation of the spaCy library.

Preparing and Annotating the Data

This repo uses a kaggle dataset to gather food review data, which is the most common contribution to food dataset. The library used can be found in bellow link: https://www.kaggle.com/datasets/snap/amazon-fine-food-reviews

From the review.csv, the summery colomn was chosen and the data was filtered for sentences at least 15 words long to insure a good sentence structure. Importing the filtered sentences in a text file, an online tool was used to annotate the data for food dataset and then exported as a json file. The online tool used is: https://tecoholic.github.io/ner-annotator/

Run the file

python -m notebook MakingTheDataset.ipynb

to follow the same procedure for any kind of csv data. The final dataset consisted of 324 annotations.

Implementing spaCy

A basic code for spaCy was implemented using the code from this repo: https://github.com/amrrs/custom-ner-with-spacy3.git . This code will overwrite the existing model and create a model on solely the food dataset. This however makes the model catastropically forget the existing labels and leads to only recognising the food labels in a sentence.

Adding the Previous Labels to the Food NER Model

We use add_pipe method which then concats the food dataset ner and the base model ner. This concated file then predicts the other labels apart from food. Details about this method can be found on this video: https://youtu.be/uJ3jWJnADyA

However another problem occured which lead to the model predicting the non-food labels as food labels. To solve this the tok2vec was replaced with the base model's tok2vec. This allows the complete model to accept the new label along with the frozen labels. This repo contains a better look on this method: https://github.com/explosion/projects/tree/v3/tutorials/ner_double

nplfoodspacy's People

Contributors

johayraprithula avatar

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.