This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Python libraries that we need to import for our bot | |
import random | |
from flask import Flask, request | |
from pymessenger.bot import Bot | |
from core import get_bot_response | |
app = Flask(__name__) | |
ACCESS_TOKEN = #<ACCESS_TOKEN> | |
VERIFY_TOKEN = #<ACCESS_TOKEN> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spacy | |
import random | |
urw_replies = [u'Happy to help you :)', u'You are more than Welcome! :)', u'No problem, Anytime! :)'] | |
nonsense_replies = [u"Sorry, I don't understand what you are saying", u"Sorry, I cannot help you on that!", | |
u"That's not my area of expertise"] | |
break_the_ice_replies = [u"Hello, Anything I can do for you?", u"Hi there! How can I help you today?"] | |
friendly_replies = [u"Sure! ", u"Sure! Let's see what we have here "] | |
nlp = spacy.load('xx_ent_wiki_sm') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"entities": [], | |
"intent": { | |
"confidence": 0.9892104618120521, | |
"name": "laliga_questions" | |
}, | |
"text": "tell me about the foundation of the Barcelona team", | |
"intent_ranking": [ | |
{ | |
"confidence": 0.9892104618120521, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rasa_nlu.model import Interpreter | |
import json | |
interpreter = Interpreter.load("./models/current/nlu") | |
message = ' '.join([x.strip() for x in "tell me about the foundation of the Barcelona team".split()]) | |
result = interpreter.parse(message) | |
print(json.dumps(result, indent=2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: "en" | |
pipeline: | |
- name: "nlp_spacy" | |
- name: "tokenizer_spacy" | |
- name: "intent_entity_featurizer_regex" | |
- name: "intent_featurizer_spacy" | |
- name: "ner_crf" | |
- name: "ner_synonyms" | |
- name: "intent_classifier_sklearn" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = pd.DataFrame({'Team': first_col, | |
'Summary': summary, | |
'History': history, | |
'Team_Page': teams_links, | |
'Location': locations, | |
'Stadium': stadiums, | |
'Stadiums_Capcity': stadiums_capcity | |
}) | |
# crawling the history of those three clubs were somehow tricky so I had to hard code the section names myself |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
first_col = [] | |
teams_links = [] | |
summary = [] | |
history = [] | |
stadiums = [] | |
locations = [] | |
stadiums_capcity = [] | |
table = soup.find("table", style="text-align: left;") | |
table_body = table.find("tbody") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import urllib | |
import requests | |
import wikipedia | |
import numpy as np | |
import pandas as pd | |
from bs4 import BeautifulSoup | |
hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', | |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import json | |
import os | |
import numpy as np | |
from gensim.models import Word2Vec | |
from gensim.utils import simple_preprocess | |
from keras.engine import Input | |
from keras.layers import Embedding, merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Multicollinearity → is the fact that one independent variable is dependent on another independent variable. like the 2 dummy variables New York and California | |
For example, In case of ‘Dummy Variable’ - which is the encoding of the categorical variable into numerical variables - if there is 2 levels in a categorical column called ‘State’: [New York, California] | |
State | |
New York | |
California | |
California | |
New York | |
California | |
then the Dummy variables will be: D2 = 1 - D1 |