Giter VIP home page Giter VIP logo

natural-language-processing-tutorials's Introduction

Natural-Language-Process-Tutorials

Natural Language Processing Tutorials(NLP) with Python,Julia and JavaScripts

Contents

  • NLP with Python

    • Natural Language Processing with SpaCy
    • Natural Language Processing with TextBlob
    • Natural Language Processing with PolyGlot
    • Natural Language Processing with TextaCy
  • NLP with JavaScript

    • Natural Language Processing with Compromise.js
    • Natural Language Processing with Natural.js
    • Natural Language Processing with Sentiment.js
  • NLP with Julia

    • Natural Language Processing with TextAnalysis.jl
    • TextSummarization.jl

natural-language-processing-tutorials's People

Contributors

jcharis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

natural-language-processing-tutorials's Issues

Entities are not being recognised

When i run the code I get following output

docx = nlp(u"I am looking for an Italian Restaurant where I can eat")
for word in docx.ents:
print("value",word.text,"entity",word.label_,"start",word.start_char,"end",word.end_char)
('value', u'Italian', 'entity', u'NORP', 'start', 20, 'end', 27)

print(interpreter.parse(u"I am looking for an Italian Restaurant where I can eat"))
{u'entities': [], u'intent': {u'confidence': '0.7245936400661538', u'name': u'restaurant_search'}, 'text': u'I am looking for an Italian Restaurant where I can eat', u'intent_ranking': [{u'confidence': '0.7245936400661538', u'name': u'restaurant_search'}, {u'confidence': '0.16613318075824324', u'name': u'affirm'}, {u'confidence': '0.061131622985489784', u'name': u'greet'}, {u'confidence': '0.04814155619011318', u'name': u'goodbye'}]}

print(interpreter.parse(u"I want an African Spot to eat"))
{u'entities': [], u'intent': {u'confidence': '0.6742354477482855', u'name': u'restaurant_search'}, 'text': u'I want an African Spot to eat', u'intent_ranking': [{u'confidence': '0.6742354477482855', u'name': u'restaurant_search'}, {u'confidence': '0.12795773626363155', u'name': u'affirm'}, {u'confidence': '0.1248807660919913', u'name': u'goodbye'}, {u'confidence': '0.07292604989609185', u'name': u'greet'}]}

print(interpreter.parse(u"Good morning World"))
{u'entities': [], u'intent': {u'confidence': '0.3928691488396195', u'name': u'greet'}, 'text': u'Good morning World', u'intent_ranking': [{u'confidence': '0.3928691488396195', u'name': u'greet'}, {u'confidence': '0.2737002194915276', u'name': u'goodbye'}, {u'confidence': '0.17752522806694152', u'name': u'affirm'}, {u'confidence': '0.15590540360191174', u'name': u'restaurant_search'}]}

Below is the full code :
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.model import Trainer
from rasa_nlu import config

Loading DataSet

train_data = load_data('./data/data.json')

Config Backend using Sklearn and Spacy

trainer = Trainer(config.load("config.yaml"))

Training Data

trainer.train(train_data)

Returns the directory the model is stored in (Creat a folder to store model in)

model_directory = trainer.persist('./projects/')

import spacy
nlp = spacy.load('en')

docx = nlp(u"I am looking for an Italian Restaurant where I can eat")
for word in docx.ents:
print("value",word.text,"entity",word.label_,"start",word.start_char,"end",word.end_char)

from rasa_nlu.model import Metadata, Interpreter

where `model_directory points to the folder the model is persisted in

interpreter = Interpreter.load(model_directory)

Prediction of Intent

print(interpreter.parse(u"I am looking for an Italian Restaurant where I can eat"))
print(interpreter.parse(u"I want an African Spot to eat"))
print(interpreter.parse(u"Good morning World"))

@plac.annotations - SyntaxError

Hi!
@plac.annotations cell gives me this error:

File "<ipython-input-293-72f554ad94b1>", line 5 n_iter=("Number of training iterations", "option", "n", int)) ^ SyntaxError: unexpected EOF while parsing

Any suggestion why? I'm using Python 3.

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.