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_dm.actions import Action | |
import requests | |
class ActionHTTPRequest(Action): | |
def name(self): | |
return "make_request" | |
def run(self, dispatcher, tracker, domain): | |
url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json' | |
result = requests.get(url).json() |
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 unicode_literals | |
from __future__ import print_function | |
from __future__ import division | |
from __future__ import absolute_import | |
from builtins import str as text | |
import argparse | |
import io | |
import json |
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 sys, os | |
from mitie import * | |
trainer = text_categorizer_trainer("/path/to/total_word_feature_extractor.dat") | |
data = {} # same as before - omitted for brevity | |
for label in training_examples.keys(): | |
for text in training_examples[label]["examples"]: | |
tokens = tokenize(text) |
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
def find_similar_words(embed,text,refs,thresh): | |
C = np.zeros((len(refs),embed.W.shape[1])) | |
for idx, term in enumerate(refs): | |
if term in embed.vocab: | |
C[idx,:] = embed.W[embed.vocab[term], :] | |
tokens = text.split(' ') |
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 rinocloud as rino | |
import shutil, os | |
import subprocess | |
import hashlib | |
""" | |
persist = Persistor(config.rino_token,config.rino_dir) | |
def save_model_new(persist,model_file,score): | |
temp_file="tmp_{0:06d}.txt".format(random.choice(range(10000))) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 sys, os | |
from mitie import * | |
sample = ner_training_instance(["I", "am", "looking", "for", "some", "cheap", "Mexican", "food", "."]) | |
sample.add_entity(xrange(5,6), "pricerange") | |
sample.add_entity(xrange(6,7), "cuisine") | |
# And we add another training example | |
sample2 = ner_training_instance(["show", "me", "indian", "restaurants", "in", "the", "centre", "."]) | |
sample2.add_entity(xrange(2,3), "cuisine") |
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
\emph{hello} |
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 epic.models.{NerSelector, ParserSelector} | |
import epic.parser.ParserAnnotator | |
import epic.preprocess | |
import epic.preprocess.{TreebankTokenizer, MLSentenceSegmenter} | |
import epic.sequences.{SemiCRF, Segmenter} | |
import epic.slab.{EntityMention, Token, Sentence} | |
import epic.trees.{AnnotatedLabel, Tree} | |
import epic.util.SafeLogging | |
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
while ( not formData.is_complete() ): | |
questionKey = formData.first_missing_field() | |
ask(questions[questionKey]) |