Coder Social home page Coder Social logo

entity_extraction's Introduction

Entity_extraction

Standard pretrained based Entity extraction and custom Entity extraction using SpaCy. Entities can be extracted from text using SpaCy are:

                        Type	        Description
                        PERSON          People, including fictional.
                        NORP	        Nationalities or religious or political groups.
                        FAC	            Buildings, airports, highways, bridges, etc.
                        ORG	            Companies, agencies, institutions, etc.
                        GPE	            Countries, cities, states.
                        LOC	            Non-GPE locations, mountain ranges, bodies of water.
                        PRODUCT	        Objects, vehicles, foods, etc. (Not services.)
                        EVENT	        Named hurricanes, battles, wars, sports events, etc.
                        WORK_OF_ART	    Titles of books, songs, etc.
                        LAW          	Named documents made into laws.
                        LANGUAGE	    Any named language.
                        DATE	        Absolute or relative dates or periods.
                        TIME	        Times smaller than a day.
                        PERCENT	        Percentage, including "%".
                        MONEY	        Monetary values, including unit.
                        QUANTITY	    Measurements, as of weight or distance.
                        ORDINAL	        "first", "second", etc.
                        CARDINAL	    Numerals that do not fall under another type.

Requirment: spaCy pathlib

Reference: https://spacy.io/usage/training/#section-ner usage

sample training data

[
    ("Horses are too tall and they pretend to care about your feelings", {
        'entities': [(0, 6, 'ANIMAL')]
    }),

    ("Do they bite?", {
        'entities': []
    }),

    ("horses are too tall and they pretend to care about your feelings", {
        'entities': [(0, 6, 'ANIMAL')]
    }),

    ("horses pretend to care about your feelings", {
        'entities': [(0, 6, 'ANIMAL')]
    }),

    ("they pretend to care about your feelings, those horses", {
        'entities': [(48, 54, 'ANIMAL')]
    }),

    ("horses?", {
        'entities': [(0, 6, 'ANIMAL')]
    })
]

use atleast 100 samples of data for each lable to get accuracy from the model.
from extract import entity
entity = entity()

To get standard entities results
text = "sample text"
ent = entity.default(text)
print(ent)

training model
t_data = "training sample data"
label = "sample label"
ent = entity.trainModel(label= label, data = t_data)

testing model
text = "sample text"
ent =  entity.load_model(test_text = text)
print(ent)

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.