Skip to content

Instantly share code, notes, and snippets.

View mohdsanadzakirizvi's full-sized avatar

Mohd Sanad Zaki Rizvi mohdsanadzakirizvi

View GitHub Profile
@mohdsanadzakirizvi
mohdsanadzakirizvi / corenlp_depparse.py
Last active February 13, 2019 08:26
Intro to Stanford NLP
#get the dependency parse of the first sentence
print('---')
print('dependency parse of first sentence')
dependency_parse = sentence.basicDependencies
print(dependency_parse)
# get the first token of the first sentence
print('---')
print('first token of first sentence')
token = sentence.token[0]
print(token)
@mohdsanadzakirizvi
mohdsanadzakirizvi / index.html
Created May 22, 2019 12:49
Ml5.js demo video classification using webcam input.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- title of the page -->
<title>image_classification</title>
<!-- load processing library-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.min.js"></script>
## intent:current_matches
- which cricket match is happening right now
- which ipl match is next
- which teams are playing next in ipl
- tell me some ipl news
- i want ipl updates
- what are the latest match updates
- who won the last ipl match
- how is ipl going
- what was the result of the last match
{
'intent': {
'name': 'current_matches',
'confidence': 0.6657130383645372
},
'entities': [],
'intent_ranking': [{
'name': 'current_matches',
'confidence': 0.6657130383645372
}, {
Me: Hi
Iplbot: Hey! How may I help you?
Me: What was the result of the last match?
Iplbot: Here are some IPL quick info:
1.The match between Rajasthan Royals and Delhi Capitals was recently held and Delhi Capitals won.
2.The next match is Warriors vs Titans on 22 April 2019
## news path 1
* greet
- utter_greet
* current_matches
- action_match_news
- utter_did_that_help
* affirm or thanks
- utter_gratitude
* goodbye
- utter_goodbye
## news path 1
* greet
- utter_greet
* current_matches
- action_match_news
- utter_did_that_help
* affirm or thanks
- utter_gratitude
* goodbye
- utter_goodbye
policies:
- name: KerasPolicy
epochs: 100
max_history: 5
- name: FallbackPolicy
fallback_action_name: 'action_default_fallback'
- name: MemoizationPolicy
max_history: 5
API_URL = "https://cricapi.com/api/"
API_KEY = ""
class ApiAction(Action):
def name(self):
return "action_match_news"
def run(self, dispatcher, tracker, domain):
res = requests.get(API_URL + "matches" + "?apikey=" + API_KEY)
if res.status_code == 200:
actions:
- utter_greet
- utter_did_that_help
- utter_goodbye
- action_match_news
- utter_default
- utter_gratitude
- utter_ask_again
intents: