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
license: gpl-3.0 | |
height: 700 | |
width: 960 | |
scrolling: no | |
border: no |
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
#dictionary to hold pos tags and their explanations | |
pos_dict = { | |
'CC': 'coordinating conjunction', | |
'CD': 'cardinal digit', | |
'DT': 'determiner', | |
'EX': 'existential there (like: \"there is\" ... think of it like \"there exists\")', | |
'FW': 'foreign word', | |
'IN': 'preposition/subordinating conjunction', | |
'JJ': 'adjective \'big\'', | |
'JJR': 'adjective, comparative \'bigger\'', |
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 pandas as pd | |
def extract_lemma(doc): | |
parsed_text = {'word':[], 'lemma':[]} | |
for sent in doc.sentences: | |
for wrd in sent.words: | |
#extract text and lemma | |
parsed_text['word'].append(wrd.text) | |
parsed_text['lemma'].append(wrd.lemma) | |
#return a dataframe |
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 stanfordnlp.server import CoreNLPClient | |
# example text | |
print('---') | |
print('input text') | |
print('') | |
text = "Chris Manning is a nice person. Chris wrote a simple sentence. He also gives oranges to people." | |
print(text) | |
# set up the client | |
print('---') | |
print('starting up Java Stanford CoreNLP Server...') |
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
#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) |
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
# get the named entity tag | |
print('---') | |
print('named entity tag of token') | |
print(token.ner) | |
# get an entity mention from the first sentence | |
print('---') | |
print('first entity mention in sentence') | |
print(sentence.mentions[0]) | |
# access the coref chain | |
print('---') |
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
#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) |
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
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: |
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
<!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> |
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
function draw() { | |
image(video, 0, 0, width, height); | |
// We can call both functions to draw all keypoints and the skeletons | |
drawKeypoints(); | |
drawSkeleton(); | |
} |
OlderNewer