示例#1
0
def runTag(args):
    '''
    Driver for Tagger.py.  Importing this here rather than globally means that there are no issues with global ROOT variables when running this method multiple times.

    Keyword args:
    args --- list of all arguments to be given to Tagger.
    '''
    import Tagger
    # Tagger has a method, runMain(args) which can be used to run the main method.
    Tagger.runMain(args)
示例#2
0
文件: Code.py 项目: Jrhenderson11/NLP
def get_vocab(email):
	vocab = []
	for line in email.headings:
		just = Tagger.remove_tags(line)
		for x in re.findall("([A-z]\w+)", just):
			vocab.append(x)

	#GET WORDS FROM BODY
	for x in re.findall("([A-z]\w+)",Tagger.remove_tags(email.body)):
		vocab.append(x)
	
	return set(vocab)
示例#3
0
def pick_locations(candidates, text):
    text = Tagger.remove_tags(text)
    #if 1 just go for it
    if len(candidates) == 1:
        return candidates
    best = []
    goodlocwords = ["room", "Room", "hall", "Hall"]
    #look for room / hall
    i = False

    #for candidate in candidates:
    #	if (("in " + candidate) in text) or (candidate in place_field(text)):
    #best.append(candidate)
    #		i=True
    #if i:
    #	return best

    for candidate in candidates:
        for word in goodlocwords:
            if word in candidate:
                best.append(candidate)
                break
    best.extend(filter_basic(candidates))

    return best
示例#4
0
def post_search(subreddit, subdone):
    for submission in subreddit.get_new(limit=20):
        if submission.id in subdone:
            continue

        subdone.append(submission.id)
        file = open("Submissions.txt", "a")
        file.write(str(submission.id) + "\n")
        file.close()

        if "Penny" in str(submission.title):
            submission.add_comment(
                "Who is that good looking robot? \n Pennybot stamps it with her [seal of approval!](http://i.imgur.com/bavrX6d.png)")
            Tagger.internaltag('penny', str(comment.submission.url), str(comment.submission.title),
                               int(comment.submission.created_utc))
            print("I found a Penny! in post: " + submission.id)
示例#5
0
def pick_speakers(namesdict, text):
	text = Tagger.remove_tags(text)

	speakernums = []
	if "Who:" in text:
		wholine = re.findall(r'Who:.*', text)[0]
		for names in namesdict:
			for name in namesdict[names]:
				if (contains_part_name(name, wholine)):
					speakernums.append(names)
					break
		return speakernums
	max = 0
	index = 0
	for names in namesdict:
		if len(namesdict[names]) > max:
			max = len(namesdict[names])
			index = names

	speakernums = [index]
	index = 0

	#check for indicative words next to speaker
	for names in namesdict:
		for name in namesdict[names]:
			#(("by " + name) in text) or 
			#or (name + ",") in text 
			# or ("  "+name in text)  or ("	"+name in text)
			if (((name + " will") in text)):
				speakernums.append(names)
				break
	return speakernums
示例#6
0
def main():

    # check command options
    argvs = sys.argv
    opt = ""
    if 1 < len(argvs):
        opt = argvs[1]

    # load dictionary
    dictionary = corpora.Dictionary.load_from_text('./dic/df.tsv')

    # initialize file reader
    spamReader = unicodecsv.reader(open('./comments/comments.tsv', 'rb'),
                                   delimiter='\t',
                                   encoding='utf-8')

    tagger = Tagger.Tagger()
    vectorizer = TfidfVectorizer(analyzer=tagger.parseVecInterface,
                                 min_df=1,
                                 max_df=50)

    corpus = [row[0] for row in spamReader]
    x = vectorizer.fit_transform(corpus)

    terms = vectorizer.get_feature_names()
    tfidfs = x.toarray()[0]
    for term in terms:
        print "+++++++++++++++"
        print term
        print terms.index(term)
        print tfidfs[terms.index(term)]

    print('合計%i種類の単語がページから見つかりました。' % (len(terms)))

    return
示例#7
0
def place_field(text):
    import Tagger
    if "Place:" in text:
        placeline = re.findall(r"(?<=\nPlace:)\s((.*\n)+?)(?=>?\w+:)", text)
        if not placeline == []:
            place = Tagger.remove_tags(placeline[0][0])
            return [place]
    return []
示例#8
0
def tagTheEmail(email):
    tagger = Tagger.Tagger(email, st, dataDir)
    tagger.tagTimes(email)
    tagger.tagSpeaker()
    tagger.tagSent()
    tagger.tagLocation()
    tagger.tagPara()
    email.combineTogether()
示例#9
0
def post_search(subreddit, subdone):
    for submission in subreddit.get_new(limit=20):
        if submission.id in subdone:
            continue

        subdone.append(submission.id)
        file = open("Submissions.txt", "a")
        file.write(str(submission.id) + "\n")
        file.close()

        if "Penny" in str(submission.title):
            submission.add_comment(
                "Who is that good looking robot? \n Pennybot stamps it with her [seal of approval!](http://i.imgur.com/bavrX6d.png)"
            )
            Tagger.internaltag('penny', str(comment.submission.url),
                               str(comment.submission.title),
                               int(comment.submission.created_utc))
            print("I found a Penny! in post: " + submission.id)
示例#10
0
def main():

  # check command options
  argvs = sys.argv
  opt = ""
  if 1 < len(argvs):
    opt = argvs[1]

  # load dictionary
  dictionary = corpora.Dictionary.load_from_text('./dic/df.tsv')

  # initialize file reader
  spamReader = unicodecsv.reader(open('./comments/comments.tsv', 'rb'), delimiter='\t', encoding='utf-8')

  i = 1
  tagger = Tagger.Tagger()

  # gensim
  docWords = []

  # read each line
  for row in spamReader:

    # normalize & tagging
    sample_u = Normalizer.normalize(row[0])
    words_dict = tagger.parse(sample_u)

    vec = dictionary.doc2bow(words_dict['all'])
    corpora.SvmLightCorpus.serialize
#    print vec

    norm = 0
    for feature in vec:
      a, b = feature
      norm += b ** 2
    norm = math.sqrt(norm)

    featureStr = ""
    for feature in vec:
      a, b = feature
      featureStr += str(a + 1) + ":" + str(b / norm) + " "

    # print features
    if "-d" == opt:
#      print featureStr + "#" + str(i) + " " + ",".join(wordDictUnique).encode('utf-8') + " ORG->", row[0].encode('utf-8')
      print featureStr + "#" + str(i) + " " + " ORG->", row[0].encode('utf-8')
      print "Nouns:", ",".join(words_dict['nouns']).encode('utf-8')
      print "Verbs:", ",".join(words_dict['verbs']).encode('utf-8')
      print "Adjs:", ",".join(words_dict['adjs']).encode('utf-8')
    else:
      print featureStr
    
    i += 1
示例#11
0
    def __init__(self, option, feats):
        """Initialises a new parser."""
        import Tagger
        print(option)
        self.tagger = Tagger.Tagger()
        self.option = option
        self.feats = feats

        if self.option == 0:
            self.classifier = Tagger.Perceptron()
        if self.option == 1:

            def one_hot_encode_object_array(arr):
                uniques, ids = np.unique(arr, return_inverse=True)
                return uniques, np_utils.to_categorical(ids, len(uniques))

            self.uniques, self.number = one_hot_encode_object_array([0, 1, 2])
            if self.feats == 1:
                self.classifier = DNN.Classifier(self.uniques, 10)
            else:
                self.classifier = DNN.Classifier(self.uniques, 6)
示例#12
0
def get_messages():
    messages = r.get_unread()

    for message in messages:
        text = str(message.body)
        title = str(message.subject)
        message.mark_as_read()

        if "report" in text or "Report" in text or "report" in title or "Report" in title:
            print("Sending a report to: " + str(message.author))
            sendstring = str(Tagger.tagcollect())
            r.send_message(message.author, "A Pennybot Report!", sendstring)
示例#13
0
def get_messages():
    messages = r.get_unread()

    for message in messages:
        text = str(message.body)
        title = str(message.subject)
        message.mark_as_read()

        if "report" in text or "Report" in text or "report" in title or "Report" in title:
            print("Sending a report to: " + str(message.author))
            sendstring = str(Tagger.tagcollect())
            r.send_message(message.author, "A Pennybot Report!", sendstring)
示例#14
0
def main():

  tagger = Tagger.Tagger()

  # initialize file reader
  spamReader = unicodecsv.reader(open('./comments/comments.tsv', 'rb'), delimiter='\t', encoding='utf-8')

  # gensim
  docWords = []

  # read each line
  for row in spamReader:
    sample_u = Normalizer.normalize(row[0])
    words_dict = tagger.parse(sample_u)
    # add words in document list
    docWords.append(words_dict['all'])

  # write df dictionary
  #   http://qiita.com/yasunori/items/31a23eb259482e4824e2 
  dictionary = corpora.Dictionary(docWords)
  dictionary.filter_extremes(no_above=0.2)
  dictionary.save_as_text('./dic/df.tsv')
示例#15
0
def main():
    opts = options()
    # load zero pronoun detector
    with open(opts.tagger_param_file, mode='rb') as f:
        tagger_params = pickle.load(f)
    print(tagger_params)
    tagger_vocab = Vocabulary.from_files(opts.tagger_vocab_file)
    tagger_model = Tagger.build(tagger_params, tagger_vocab)
    tagger_model, tagger_indexer = load_model(tagger_model, tagger_params,
                                              opts.tagger_model_file,
                                              opts.gpuid)
    # prepare dataset readers
    tagger_reader = TaggerDatasetReader(
        token_indexers={"tokens": tagger_indexer})

    with codecs.open(opts.input_file, "r",
                     encoding="utf8") as f_in, codecs.open(
                         opts.output_file, "w", encoding="utf8") as f_out:
        for line in f_in:
            line = line.strip()
            toks = [Token(tok) for tok in line.split(" ")]
            tagger_instance = tagger_reader.text_to_instance(toks)
            output = tagger_model.forward_on_instance(tagger_instance)
            f_out.write(" ".join(output["tags"]) + "\n")
示例#16
0
def getDirTraits(hueristic):
    indices = cPickle.load(open('indices.pyc'))
    s2 = cPickle.load(open('s2.pyc'))
    TraitInfo = DirTraitInfo()
    TraitInfo.Ratings = s2['PerDirection'][indices['All_Followers_Cum'][0]]
    TraitInfo.Keys = TraitInfo.Ratings.keys()
    if hueristic:
        TraitInfo.Stats = hueristicTags(TraitInfo.Ratings, StatMatrix)
    else:
        TraitInfo.Stats, DirTraitNames = Tagger.correlateRatingsTags(
            TraitInfo.Ratings)
    #for k,v in TraitInfo.Stats.items(): print k,v
    TraitInfo.lastStatNum = len(DirTraitNames) + 5
    for item in TraitInfo.Stats.values():
        if item[0] and 'Words' in DirTraitNames:
            item[DirTraitNames.index('Words')] = math.log(
                item[DirTraitNames.index('Words')] +
                1)  #Log normalize the # of words.
    TraitInfo.StatNames = [
        'NavConf', 'DirRating', 'ReDirects', 'FwdMoves', 'Turns'
    ] + DirTraitNames
    TraitInfo.Keys.sort()
    cPickle.dump(TraitInfo, open('TraitInfo.pyc', 'w'))
    return TraitInfo
示例#17
0
文件: Code.py 项目: Jrhenderson11/NLP
		triple = create_train_triple(taggedfile)
		docs.append(triple)
		

		print "class: " + str(triple[1]) + "\n"
		classes.add(str(triple[1]))

		print ("\n\n		information extracted from " + fileName)
		print "Topic:"
		print Ontology.get_topic(text)
		
		#test sentence tagging
		print "tagged sentences + paragraphs:"
	 	
		#untagged = Tagger.remove_tags(body)
		paratagged = Tagger.output_tagged_para(body)
		senttagged = Tagger.output_tagged_sents(paratagged)
		#print senttagged

		#print body in text
		mytext = text.split("Abstract:")[0] + "Abstract:" + senttagged

		#evaluate
		acparas =  Tagger.extract_paragraphs(taggedtext)
		myparas =  Tagger.extract_paragraphs(mytext)
		acsents =  Tagger.extract_sentences(taggedtext)
		mysents =  Tagger.extract_sentences(mytext)

		(acc, prec, rec, f) = Eval.evaluate_generic(fileName, myparas, acparas)
		totPacc = totPacc + acc
		totPprec = totPprec + prec
示例#18
0
 def __init__(self):
     """Initialises a new parser."""
     import Tagger
     self.tagger = Tagger.Tagger()
     self.classifier = Tagger.Perceptron()
示例#19
0
文件: test.py 项目: rdub/pysent
import Splitter
import Tagger
import Scorer
import Importer

import yaml
from pprint import pprint

if __name__ == "__main__":
    rss = Importer.RSSImporter(
        'https://news.google.com/news/feeds?q=apple&output=rss')
    input_text = rss.parse()

    s = Splitter.Splitter()
    tagger = Tagger.DictionaryTagger([
        'dicts/positive.yml', 'dicts/negative.yml', 'dicts/inc.yml',
        'dicts/dec.yml', 'dicts/inv.yml'
    ])
    scorer = Scorer.Scorer()
    total = 0
    for summary in input_text:

        split = s.split(summary)

        tagged = tagger.tag(split)

        score = scorer.score(tagged)
        print "%s -> %d" % (summary, score)
        total += score

    print "Total: %d" % total
示例#20
0
def find_penny_comment(flat_comments, processing, mods):
    global shutdown
    # Don't care about where the comments are so flatten the comment tree
    for comment in flat_comments:
        # Divide the body of all of the comments so we can scan each line correctly

        if comment.id not in processing:
            continue
        replied = False
        response = []

        commentauthor = str(comment.author)
        wholecomment = comment.body
        list = wholecomment.splitlines(True)
        reply = ''

        for current in list:
            # Looking at each line of a body comment turn it lower case and cut out v2
            current = current.lower()
            current = current.replace("v2", "")

            # Scan for mention of pennybot and respond
            if "pennybot," in current:
                print("Found a Penny comment at: " + time.asctime(time.localtime(time.time())))
                lookingfor = "pennybot,"

                # Remove pennybot from the string start scanning for response
                indexcount = current.index(lookingfor) + 9
                current = current.lstrip(current[:indexcount])
                current = current.strip()
                replied = True

                # Add to the suggestion text file
                if current.startswith("suggestion"):
                    reply = "Thank you for the command suggestions! \n Creator! /u/Weerdo5255 ! Someone has made an excellent suggestion for a command! \n (PennyBotV2 has saved this suggestion, even if the creator does not respond!)"
                    file = open("Suggestions.txt", "a")
                    file.write(str(wholecomment) + "FROM:" + str(commentauthor) + "\n")
                    file.close()

                # Emergency shutdown
                if current.startswith("shutdown"):
                    print(commentauthor)
                    if commentauthor in mods or commentauthor == "Weerdo5255":
                        reply = "Emergency Shutdown Initiated! Bye!"
                        shutdown = True
                    else:
                        reply = "You are not Pyrrha!"

                """
                if current.startswith("analyze"):
                    current = current.lstrip(current[:8])
                    current = current.strip()
                    current = current.replace("/u/", "")
                    current = current.replace("u/", "")
                    AUser = r.get_redditor(current)
                    Generate = AUser.get_submitted(limit=None)
                    Karma = {}
                    for x in Generate:
                        subreddit = x.subreddit.display_name
                        Karma[subreddit] = (Karma.get(subreddit, 0) + x.score)
                    if 'RWBY' in Karma:
                        score = str(Karma.get('RWBY'))
                        reply = "They have: " + score + " karma in /r/RWBY. \n \n ^^^from ^^^their ^^^last ^^^1,000 ^^^posts/comments, ^^^blame ^^^the ^^^reddit ^^^API ^^^limits..."
                    else:
                        reply = "They are not yet part of the /r/RWBY Community."
                """

                if current.startswith("tag report"):
                    sendstring = str(Tagger.tagcollect())
                    r.send_message(commentauthor, "A Pennybot Report!", sendstring)
                    reply = "I've sent you the report!"

                if current.startswith("tag"):
                    reply = Tagger.replytag(current, str(comment.submission.url), str(comment.submission.title),
                                            int(comment.submission.created_utc))

                # Access the AI Function
                if current.startswith("thoughts"):
                    thoughtstring = " "
                    randomnum = (random.randint(0, 3))
                    try:
                        x = 0
                        phrases = load_ai_phrase()
                        while (x <= randomnum):
                            thoughtstring = thoughtstring + random.choice(phrases) + "\n"
                            x += 1
                    except:
                        thoughtstring = ("I don't have any thoughts at the moment.")

                    reply = thoughtstring
                else:
                    reply = Commands.penny_commands(current, str(comment.submission.url), str(comment.submission.title),
                                                    int(comment.submission.created_utc))
                if current.startswith("pennycheck"):
                    lookingfor = "pennycheck"
                    indexcount = current.index(lookingfor) + 10
                    current = current.lstrip(current[:indexcount])
                    current = current.strip()
                    reply = "[Here are the Images I could Find!](http://iqdb.org/?url=" + current + ")"

                if current.startswith("pennykarma"):
                    reply = "Here is the [Karma Decay](http://karmadecay.com/" + str(comment.submission.url) + ")"

                response.append(reply)

        if replied:
            print(comment.submission.permalink)
            print(response)

            string = ""
            for x in response:
                string += x + " \n \n"
            comment.reply(string)

        db = sqlite3.connect("Processed.db")
        db.text_factory = str
        cursor = db.cursor()
        cursor.execute('INSERT INTO Processed VALUES (?, ?, ?, ?, ?, ?)',
                       (str(comment.id), int(comment.created_utc), str(comment.body), str(comment.author), str(replied),
                        str(reply)))
        cursor.execute("DELETE FROM Processed WHERE time <= strftime('%s') - 86400 * 2;")
        db.commit()
    return comment.id
示例#21
0
def find_penny_comment(flat_comments, processing, mods):
    global shutdown
    # Don't care about where the comments are so flatten the comment tree
    for comment in flat_comments:
        # Divide the body of all of the comments so we can scan each line correctly

        if comment.id not in processing:
            continue
        replied = False
        response = []

        commentauthor = str(comment.author)
        wholecomment = comment.body
        list = wholecomment.splitlines(True)
        reply = ''

        for current in list:
            # Looking at each line of a body comment turn it lower case and cut out v2
            current = current.lower()
            current = current.replace("v2", "")

            # Scan for mention of pennybot and respond
            if "pennybot," not in current:
                continue

            print("Found a Penny comment at: " +
                  time.asctime(time.localtime(time.time())))
            lookingfor = "pennybot,"

            # Remove pennybot from the string start scanning for response
            indexcount = current.index(lookingfor) + 9
            current = current.lstrip(current[:indexcount])
            current = current.strip()
            replied = True

            # Add to the suggestion text file
            if current.startswith("suggestion"):
                reply = "Thank you for the command suggestions! \n Creator! /u/Weerdo5255 ! Someone has made an excellent suggestion for a command! \n (PennyBotV2 has saved this suggestion, even if the creator does not respond!)"
                file = open("Suggestions.txt", "a")
                file.write(
                    str(wholecomment) + "FROM:" + str(commentauthor) + "\n")
                file.close()

            # Emergency shutdown
            elif current.startswith("shutdown"):
                print(commentauthor)
                if commentauthor in mods or commentauthor == "Weerdo5255":
                    reply = "Emergency Shutdown Initiated! Bye!"
                    shutdown = True
                else:
                    reply = "You are not Pyrrha!"

            elif current.startswith("tag report"):

                sendstring = str(Tagger.tagcollect())

                r.send_message(commentauthor, "A Pennybot Report!", sendstring)

                reply = "I've sent you the report!"

            elif current.startswith("tag"):

                reply = Tagger.replytag(current, str(comment.submission.url),
                                        str(comment.submission.title),
                                        int(comment.submission.created_utc))

            # Access the AI Function
            elif current.startswith("thoughts"):
                thoughtstring = " "

                randomnum = (random.randint(0, 3))
                try:
                    x = 0
                    phrases = load_ai_phrase()
                    while (x <= randomnum):
                        thoughtstring = thoughtstring + random.choice(
                            phrases) + "\n"
                        x += 1
                except:
                    thoughtstring = (
                        "I don't have any thoughts at the moment.")

                reply = thoughtstring
            else:
                reply = Commands.penny_commands(
                    current, str(comment.submission.url),
                    str(comment.submission.title),
                    int(comment.submission.created_utc))

            response.append(reply)

        if replied:
            print(comment.submission.permalink)
            print(response)

            string = ""
            for x in response:
                string += x + " \n \n"
            comment.reply(string)

        db = sqlite3.connect("Processed.db")
        db.text_factory = str
        cursor = db.cursor()
        cursor.execute(
            'INSERT INTO Processed VALUES (?, ?, ?, ?, ?, ?)',
            (str(comment.id), int(comment.created_utc), str(
                comment.body), str(comment.author), str(replied), str(reply)))
        cursor.execute(
            "DELETE FROM Processed WHERE time <= strftime('%s') - 86400 * 2;")
        db.commit()
    return comment.id
示例#22
0
def main():
    # Variable initialization
    # local
    treated_file_nb = 0
    remaining_file_nb = 0
    file_nb = 1
    state = 0
    not_supported_extension = [".m4a", ".flac", ".mp4", ".wav", ".wma", ".aac"]
    file_extension = [".mp3"]  # will store all file extensions
    file_name = ["music.mp3"]  # will store all file names
    ignore = ["music.mp3"]
    title = ""  # temporary string to store track title
    artist = ""  # temporary string to store artist name
    Is_Sure = True  # to check wether a file needs to be checked by user
    no_playlist = True  # for downloading

    # global (to be shared with other libraries)
    params = {}
    params[
        'add_signature'] = False  # param (maybe changed in config... not sure yet)
    params['debug'] = False  # param (maybe changed in config... not sure yet)
    params['accepted_extensions'] = {}
    params['accepted_extensions'] = [".mp3"]  # list of all accepted extensions

    if params['add_signature']:
        params['signature'] = "MEP by GM"
    else:
        params['signature'] = "-+-"

    # to display info etc
    interface = MEPInterface.Interface(params)

    # getting info from config file :
    config = {}
    try:
        with open("config.json", mode="r") as j_object:
            config = json.load(j_object)

    except FileNotFoundError:
        interface.warning("No config file found", "using standard setup")

    except json.JSONDecodeError as e:
        interface.warning(
            "At line " + str(e.lineno) + " of the config file, bad syntax (" +
            str(e.msg) + ")", "using standard setup")

    except Exception as e:
        interface.warning("unknown error : " + str(e), "using standard setup")

    params['prefered_feat_acronyme'] = str(
        config.get("prefered_feat_sign", "feat."))
    params['default_genre'] = str(config.get("default_genre", "Other"))
    params['folder_name'] = str(config.get("folder_name", "music"))
    params['get_label'] = bool(config.get("get_label", True))
    params['get_bpm'] = bool(config.get("get_bpm", True))
    params['get_lyrics'] = bool(config.get("get_lyrics", True))
    params['store_image_in_file'] = bool(
        config.get("store_image_in_file", True))

    #selecting mode
    mode_nb = interface.global_start()

    if mode_nb == 1:  # full auto
        params['all_Auto'] = True
        params['Assume_mep_is_right'] = True
        params['Open_image_auto'] = False

    elif mode_nb == 2:  # semi auto
        params['all_Auto'] = False
        params['Assume_mep_is_right'] = True
        params['Open_image_auto'] = False

    elif mode_nb == 3:  # start by downloading from yt
        params['all_Auto'] = False
        params['Assume_mep_is_right'] = True
        params['Open_image_auto'] = False
        no_playlist = not interface.ask("download playlists ?")
        state = 2  #special start (skipping scan and )

    else:
        mode_nb = 4  # discovery
        params['all_Auto'] = False
        params['Assume_mep_is_right'] = False
        params['Open_image_auto'] = True

    #initializing libs
    tagger = Tagger.Tagger(params)

    # Spotify api authorization Secret codes (DO NOT COPY / SHARE)
    sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(
        client_id="fb69ab85a5c749e08713458e85754515",
        client_secret="ebe33b7ed0cd495a8e91bc4032e9edf2"))

    #adding folder if not existing
    if params['folder_name'] not in os.listdir():
        os.makedirs(params['folder_name'])

    # switch case equivalent
    while True:
        #print("STATE : "+str(state)) #DEBUG
        # ----------------------------------------------------------------------------------------------------------- 0 #
        # STATE 0 : Scanning folder
        if state == 0:
            state = 1  # Default = get title and artist automatically

            # scanning folder
            wrong_format = False
            for temp_file_name in os.listdir():
                _, temp_file_extension = os.path.splitext(temp_file_name)

                if temp_file_extension in params[
                        'accepted_extensions'] and temp_file_name not in ignore:
                    file_name.append(temp_file_name)
                    file_extension.append(temp_file_extension)
                    remaining_file_nb += 1

                elif (temp_file_extension in not_supported_extension):
                    wrong_format = True
                    wrong_file_name = temp_file_name

            # saving total number
            total_file_nb = remaining_file_nb

            if wrong_format:
                interface.wrong_format(wrong_file_name)
                time.sleep(4)
                state = 10

            elif total_file_nb <= 0:  # no music file was found
                state = 10

        # ----------------------------------------------------------------------------------------------------------- 1 #
        # STATE 1 : get title and artist automatically
        elif state == 1:
            state = 3  # Default = search info on track
            interface.start_process(file_nb, total_file_nb, file_name[file_nb])

            # trying to see if there are correct tags
            title, artist, encoded_by = tagger.read_tags(file_name[file_nb])

            if type(title) != type(None):
                title = remove_feat(title)
                if type(artist) == type(None) or artist == "None":
                    artist = "not found"

                # Displays if at least the title was found
                interface.artist_and_title(artist, title)

                # checks wether program already processed file (TODO delete ?)
                if encoded_by == params['signature']:
                    interface.already_treated()
                    if interface.ask("want to modify something ? "):
                        # getting the user to add title and artist
                        (artist, title) = interface.get_title_manu()

                    else:
                        new_file_name = file_name[file_nb]
                        state = 6  # just moving the file in correct directory

                elif mode_nb == 3:
                    pass  #assuming tags are ok
                elif interface.ask("Wrong ?"):
                    # getting the user to add title and artist
                    (artist, title) = interface.get_title_manu()

            else:
                if params['all_Auto']:
                    interface.error(4)  # no usable tags
                    state = 20  # Skip track
                else:
                    (artist,
                     title) = interface.get_title_manu("no title found")

        # ----------------------------------------------------------------------------------------------------------- 2 #
        # STATE 2 : dl url
        elif state == 2:
            state = 3  # Default = Search info on track
            url = interface.get_URL()
            dl_music(url, no_playlist, interface.Dl_Logger(),
                     [interface.Dl_hook])
            state = 0
            """file_name.append(dl_music(interface.get_URL(),path))
            file_extension.append(".mp3")
            remaining_file_nb += 1
            total_file_nb = remaining_file_nb
            interface.start_process(file_nb, total_file_nb, file_name[file_nb])
            title, artist, encoded_by = tagger.read_tags(path + file_name[file_nb])"""
            #interface.artist_and_title(artist, title)

        # ----------------------------------------------------------------------------------------------------------- 3 #
        # STATE 3 : Search info on track
        elif state == 3:
            state = 32  # Default = getting genre (track object and title needed)

            # Search for more info on the track using spotify api
            search = "track:" + title.replace("'", "") + " artist:" + artist
            results = sp.search(q=search, type="track", limit=2)
            items = results['tracks']['items']

            # Can a result be found
            if len(items) > 0:
                Is_Sure = True
                if (items[0]['album']['artists'][0]['name'] ==
                        'Various Artists'):
                    track = items[
                        1]  # index 0 was a playlist TODO maybe add better checks
                else:
                    track = items[0]

                track['name'] = remove_feat(
                    track['name'])  # in case of featurings
                track['album']['artwork'] = track['album']['images'][0]['url']
                track['lyrics'] = {}

            elif params['all_Auto']:
                interface.error(5)  # music not found -> skipping
                state = 20  # skip track

            else:
                # trying without the artist only if user can verify
                search = "track:" + title.replace("'", "")
                results = sp.search(q=search, type="track", limit=1)
                items = results['tracks']['items']
                if len(items) > 0:
                    Is_Sure = False
                    track = items[0]
                    track['name'] = remove_feat(
                        track['name'])  # in case of featurings
                    track['album']['artwork'] = track['album']['images'][0][
                        'url']
                    track['lyrics'] = {}

                elif interface.ask(
                        reason="error 808 : music not found...",
                        message="Do you want to retry with another spelling ?"
                ):
                    (artist, title) = interface.get_title_manu("")
                    state = 3  # search info on track

                elif interface.ask("Fill the data manually ?"):
                    state = 31  # manual tagging

                else:
                    interface.warning(
                        "no action required", "file was skipped"
                    )  # music not found nothing could be done / wanted to be done
                    state = 20  # skip track

        # ----------------------------------------------------------------------------------------------------------- 31 #
        # STATE 31 : manual tagging
        elif state == 31:
            state = 33  # Default = getting other info automatically (wo/ spotify)

            interface.manual_tagging(artist, title)

            # init variables (if no track object was created before hand)
            track = {}
            track['artists'] = [{}]
            track['album'] = {}
            track['lyrics'] = {}

            # already filled data
            track['name'] = title
            track['artists'][0]['name'] = artist

            #search to help user
            search = "https://www.google.com/search?q=" + slugify(
                track['name']) + "+" + slugify(track['artists'][0]['name'])
            webbrowser.open(search)

            # user fills data
            if interface.ask("more than one artist ?"):
                track['artists'].append({'name': input("second artist : ")})
                y = input(
                    "third artist (just press enter if there isn't another): ")
                if y != "":
                    track['artists'].append({'name': y})

            track['album']['name'] = input("album        : ")
            track['album']['release_date'] = input("year         : ")
            track['track_number'] = int(
                input("track number : ")
            )  # TODO add security (check if its int) error : ValueError:
            track['album']['total_tracks'] = int(input("out of       : "))

            # getting user to pick an artwork
            track['album']['artwork'] = input("image url    : ")

        # ----------------------------------------------------------------------------------------------------------- 32 #
        # STATE 32 : Getting genre + other info auto
        elif state == 32:
            state = 4  # Default = User verif

            # getting genre
            results = sp.artist(track['artists'][0]['id'])
            if len(results['genres']) > 0:
                track['genre'] = results['genres'][0]
            else:
                track['genre'] = params['default_genre']

            # getting label and copyright
            if params['get_label']:
                results = sp.album(track['album']['id'])
                if len(results) > 0:
                    track['album']['copyright'] = results['copyrights'][0][
                        'text']
                    track['album']['label'] = results['label']
                else:
                    # default
                    track['album']['copyright'] = ""
                    track['album']['label'] = ""

            # getting BPM
            if params['get_bpm']:
                results = sp.audio_analysis(track['id'])
                if len(results) > 0:
                    track['bpm'] = int(results['track']['tempo'])
                else:
                    track['bpm'] = 0  # default

            #getting lyrics
            if params['get_lyrics']:
                (track['lyrics']['text'],
                 track['lyrics']['service']) = get_lyrics(
                     track['artists'][0]['name'], track['name'])
            else:
                track['lyrics']['service'] = "ignored"
                track['lyrics']['text'] = ""

        # ----------------------------------------------------------------------------------------------------------- 33 #
        # STATE 33 : getting other info (if file was not found on spotify)
        elif state == 33:
            state = 4  # Default = User verif

            # info that can't be accessed is switched to default
            track['disc_number'] = 1
            track['genre'] = params['default_genre']

            if params['get_label']:
                track['album']['copyright'] = None
                track['album']['label'] = None
            if params['get_bpm']:
                track['bpm'] = None

            #getting lyrics
            if params['get_lyrics']:
                (track['lyrics']['text'],
                 track['lyrics']['service']) = get_lyrics(
                     track['artists'][0]['name'], track['name'])
            else:
                track['lyrics']['service'] = "ignored"
                track['lyrics']['text'] = ""

        # ----------------------------------------------------------------------------------------------------------- 4 #
        # STATE 4 : User verification (track object and title needed)
        elif state == 4:
            state = 5  # Default = file update (track object needed)

            interface.track_infos(
                Is_Sure,
                title=track['name'],
                artists=track['artists'],
                album=track['album']['name'],
                genre=track['genre'],
                release_date=track['album']['release_date'],
                track_nb=track['track_number'],
                total_track_nb=track['album']['total_tracks'],
                lyrics_service=track['lyrics']['service'])

            # displaying image (TODO improve)
            if params['Open_image_auto']:
                webbrowser.open(track['album']['artwork'])

            # switch state
            if params['Assume_mep_is_right'] and Is_Sure:
                pass  # state  = 5

            elif not interface.ask("wrong song ?"):
                pass  # state  = 5

            elif interface.ask("Do you want to retry with another spelling ?"):
                (artist, title) = interface.get_title_manu("")
                state = 3  # search info on track

            elif interface.ask("fill the data manually ?"):
                state = 31
            else:
                interface.error(5)  # no matching track found
                state = 20

        # ----------------------------------------------------------------------------------------------------------- 5 #
        # STATE 5 : File update (track object needed)
        elif state == 5:
            state = 6  # Default = Moving file

            try:
                # making sure the file is writable :
                os.chmod(file_name[file_nb], stat.S_IRWXU)

                # preparing new file name and directory path
                if track['track_number'] != None:
                    if track['track_number'] < 10:
                        new_file_name = "0" + str(
                            track['track_number']) + "-" + slugify(
                                track['name'], separator='_')
                    else:
                        new_file_name = str(
                            track['track_number']) + "-" + slugify(
                                track['name'], separator='_')
                else:
                    new_file_name = slugify(track['name'], separator='_')
                new_file_name = new_file_name + file_extension[
                    file_nb]  #adding extension

                # changing name of the file
                os.path.realpath(file_name[file_nb])
                os.rename(file_name[file_nb], new_file_name)

                # adding featured artist to title
                nb_artist = len(track['artists'])
                if nb_artist == 2:
                    track['name'] = track['name'] + " (" + params[
                        'prefered_feat_acronyme'] + track['artists'][1][
                            'name'] + ")"  # correct title
                elif nb_artist > 2:
                    track['name'] = track['name']+" ("+params['prefered_feat_acronyme']+track['artists'][1]['name']+ \
                                                    " & "+track['artists'][2]['name']+")"  # correct title

                # downloading image
                image_name = slugify(track['album']['name'] +
                                     "_artwork") + ".jpg"
                image_name = dl_image(track['album']['artwork'], image_name,
                                      interface)

                # modifing the tags
                ret = tagger.update_tags(new_file_name, image_name, track)
                if ret > 0:
                    interface.error(ret)
                    state = 20  # skipping file

            except FileNotFoundError:
                interface.error(2)  # file was moved
                state = 20  # skipping file
            except Exception as e:
                print(e)
                interface.error(1)  # file couldn't be edited
                state = 20  # skipping file

        # ----------------------------------------------------------------------------------------------------------- 6 #
        # STATE 6 : Moving file
        elif state == 6:
            # No default state (either restart or ending)

            folder = params['folder_name'] + os.path.sep + slugify(
                track['artists'][0]['name'], separator=" ",
                lowercase=False) + os.path.sep + slugify(
                    track['album']['name'], separator=" ", lowercase=False)
            try:
                if os.path.exists(folder + os.path.sep + new_file_name):
                    interface.warning("file already exists in folder",
                                      "keeping this file in main folder")
                    ignore.append(file_name[file_nb])
                else:
                    if not os.path.exists(folder):
                        os.makedirs(folder)  #creating folder

                    shutil.move(new_file_name,
                                folder)  # place music file in correct folder
                    if not params['store_image_in_file']:
                        if not os.path.exists(folder + os.path.sep +
                                              image_name):
                            shutil.move(
                                image_name,
                                folder)  #place album cover in correct folder
                        else:
                            os.remove(image_name)  #removing if already present

                    treated_file_nb += 1  # file correctly treated

            except Exception as e:
                interface.warning("Unexpected error:" + sys.exc_info()[0],
                                  "keeping this file in main folder")

            if remaining_file_nb > 1:
                file_nb += 1  # file being treated = next in the list
                remaining_file_nb -= 1  # one file done
                state = 1  # get title and artist automatically (new song)
            else:
                state = 10  # Ending program (or restarting)

        # ----------------------------------------------------------------------------------------------------------- 20 #
        # STATE 20 : Skipping track
        elif state == 20:
            ignore.append(file_name[file_nb])
            if remaining_file_nb > 1:
                file_nb += 1  # file being treated = next in the list
                remaining_file_nb -= 1  # one file done
                state = 1  # Get title and artist auto
            else:
                state = 10  # End prog

        # ----------------------------------------------------------------------------------------------------------- 10 #
        # STATE 10 : Ending program (or restarting)
        elif state == 10:

            if mode_nb == 2:
                time.sleep(1)
                # reseting variables
                file_extension = [".mp3"]
                file_name = ["music.mp3"]
                file_nb = 1
                remaining_file_nb = 0
                total_file_nb = 0
                state = 0
            elif mode_nb == 3:
                # reseting variables
                file_extension = [".mp3"]
                file_name = ["music.mp3"]
                file_nb = 1
                remaining_file_nb = 0
                total_file_nb = 0
                state = 2
            else:
                interface.end_full_auto(total_file_nb, treated_file_nb)
                sys.exit("")
示例#23
0
def main():

    opts = options()

    # select a bert specific indexer
    if opts.with_bert:
        from allennlp.data.token_indexers.pretrained_transformer_mismatched_indexer import PretrainedTransformerMismatchedIndexer
        indexer = PretrainedTransformerMismatchedIndexer(
            model_name=opts.bert_name, max_length=opts.bert_max_len)
    # separate by spaces
    else:
        from allennlp.data.token_indexers import TokenIndexer, SingleIdTokenIndexer
        indexer = SingleIdTokenIndexer()

    reader = TaggerDatasetReader(token_indexers={"tokens": indexer})
    train_dataset = reader.read(opts.train_file)
    valid_dataset = reader.read(opts.valid_file)
    params = Tagger.opts2params(opts)

    with open(opts.model_dir + "/params.pkl", mode='wb') as f:
        pickle.dump(params, f)

    vocab = Vocabulary.from_instances(train_dataset + valid_dataset,
                                      min_count={'tokens': opts.min_freq})
    train_dataset.index_with(vocab)
    valid_dataset.index_with(vocab)
    train_data_loader = PyTorchDataLoader(train_dataset,
                                          batch_sampler=BucketBatchSampler(
                                              train_dataset,
                                              batch_size=opts.batch_size,
                                              sorting_keys=["tokens"]))
    valid_data_loader = PyTorchDataLoader(valid_dataset,
                                          batch_sampler=BucketBatchSampler(
                                              valid_dataset,
                                              batch_size=opts.batch_size,
                                              sorting_keys=["tokens"]))

    model = Tagger.build(params, vocab)
    if torch.cuda.is_available():
        cuda_device = opts.gpuid
        model = model.cuda(cuda_device)
    else:
        cuda_device = -1

    # select an optimizer for fine-tuning
    if opts.with_bert:
        from allennlp.training.optimizers import HuggingfaceAdamWOptimizer
        parameters = [[n, p] for n, p in model.named_parameters()
                      if p.requires_grad]
        optimizer = HuggingfaceAdamWOptimizer(model_parameters=parameters,
                                              lr=0.0003,
                                              parameter_groups=[
                                                  ([".*transformer.*"], {
                                                      "lr": 1e-05
                                                  })
                                              ])
    # optimizer for random initialization
    else:
        import torch.optim as optim
        optimizer = optim.Adam(model.parameters(), lr=0.001)

    trainer = GradientDescentTrainer(
        model=model,
        optimizer=optimizer,
        data_loader=train_data_loader,
        validation_data_loader=valid_data_loader,
        num_epochs=1,
        use_amp=opts.use_amp,
        num_gradient_accumulation_steps=opts.num_gradient_accumulation_steps,
        cuda_device=cuda_device)

    vocab.save_to_files(opts.model_dir + "/vocab")

    best_f1 = 0.0
    for i in range(opts.epochs):
        epoch = i + 1
        print('Epoch: {}'.format(epoch))
        info = trainer.train()
        print(info)
        if info["validation_accuracy"] > best_f1:
            best_f1 = info["validation_accuracy"]
            with open(opts.model_dir + "/save_" + str(epoch) + ".save",
                      'wb') as f_model:
                torch.save(model.state_dict(), f_model)
示例#24
0
文件: Code.py 项目: Jrhenderson11/NLP
def part_one(fileList, myList):
	#paragraph scores
	totPacc, totPprec, totPrec, totPf = 0, 0, 0, 0
	#sentence scores
	totSacc, totSprec, totSrec, totSf = 0, 0, 0, 0
	#time scores
	totTacc, totTprec, totTrec, totTf = 0, 0, 0, 0
	#name scores
	totNacc, totNprec, totNrec, totNf = 0, 0, 0, 0
	#location scores
	totLacc, totLprec, totLrec, totLf = 0, 0, 0, 0
	
	docs =[]
	classes = set()

	#because NER requires training a tagger it is best done as a 
	#batch process rather than repeatedly calling a function, 
	#therefore it is done here and the results processed later
	if (len(fileList) > 10):
		print("running NER on " + str(len(fileList)) + " files (might take a bit)")
	else:
		print("running NER")

	namesdict = NER.extract_names_files(fileList)
	numdict = {}

	for i in range (0, len(fileList)):
		untaggedfile = fileList[i]
		taggedfile = fileList[i].replace("un", "")

		text = get_text(untaggedfile)
		taggedtext = get_text(taggedfile)

		acnames = NER.collapse_names(NER.extract_tagged_names(taggedtext))
		nameset = NER.collapse_names(namesdict[fileList[i]])
		numnames = len(nameset)

		if numnames in numdict:
			numdict[numnames] = numdict[numnames] + 1
		else:
			numdict[numnames] = 1
	print(numdict )

	for i in range (0, len(fileList)):

		untaggedfile = fileList[i]
		taggedfile = testList[i]
		mytaggedfile = myList[i]

		text = get_text(untaggedfile)
		taggedtext = get_text(taggedfile)
		mytext = ""
		body = (text.split('Abstract:')[1])

		fileName = untaggedfile

		#prepare for training by adding this emails class to set
		#0 = fname, 1 = class, 2 = email
		triple = create_train_triple(taggedfile)
		docs.append(triple)
		

		print("class: " + str(triple[1]) + "\n")
		classes.add(str(triple[1]))

		print(("\n\n		information extracted from " + fileName))
		print("Topic:")
		print(Ontology.get_topic(text))
		
		#test sentence tagging
		print("tagged sentences + paragraphs:")
	 	
		#untagged = Tagger.remove_tags(body)
		paratagged = Tagger.output_tagged_para(body)
		senttagged = Tagger.output_tagged_sents(paratagged)
		#print(senttagged)

		#print(body in text)
		mytext = text.split("Abstract:")[0] + "Abstract:" + senttagged

		#evaluate
		acparas =  Tagger.extract_paragraphs(taggedtext)
		myparas =  Tagger.extract_paragraphs(mytext)
		acsents =  Tagger.extract_sentences(taggedtext)
		mysents =  Tagger.extract_sentences(mytext)

		#calculate scores and tally total
		(acc, prec, rec, f) = Eval.evaluate_generic(fileName, myparas, acparas)
		totPacc, totPprec, totPrec, totPf = (totPacc + acc, totPprec + prec, totPrec + rec, totPf + f)

		(acc, prec, rec, f) = Eval.evaluate_generic(fileName, mysents, acsents)
		totSacc, totSprec, totSrec, totSf = (totSacc + acc, totSprec + prec, totSrec + rec, totSf + f)

		#Time tagging
		print("Times found:")
		(stimes, etimes) = Tagger.output_tagged_time(mytext)
		mytext = Tagger.find_and_tag(set(stimes), "stime", mytext)
		mytext = Tagger.find_and_tag(set(etimes), "etime", mytext)
		
		acstimes = Tagger.extract_stimes(taggedtext)
		acetimes = Tagger.extract_etimes(taggedtext)

		#eval times
		(acc, prec, rec, f) = Eval.evaluate_generic(fileName, stimes, acstimes)
		totTacc, totTprec, totTrec, totTf = (totTacc + acc, totTprec + prec, totTrec + rec, totTf + f)

		(acc, prec, rec, f) = Eval.evaluate_generic(fileName, etimes, acetimes)
		totTacc, totTprec, totTrec, totTf = (totTacc + acc, totTprec + prec, totTrec + rec, totTf + f)

		names = namesdict[fileName]
		print("people")
		print(names)

		print("ACSPEAKERS: ")
		acspeakers = NER.extract_tagged_names(taggedtext) 
		print(acspeakers)

		if names != []:
			collapsednames = NER.collapse_names(names)
			#nameset = set(collapsednames)
			print(collapsednames)
			collapsednames = NER.filter_sender(collapsednames, text) 
			
			speakers = []
			if collapsednames != {}:
				speakerdict = NER.pick_speakers(collapsednames, text)
				for num in speakerdict:
					speakers.extend(collapsednames[num])

			print("SPEAKERS:")
			print(speakers)
			notspeakers = []
			for name in names:
				if not name in speakers:
					notspeakers.append(name)
			#concat not speakers into list for evaluation
			(accuracy, precision, recall, f1) = Eval.evaluate_speakers(taggedfile, speakers, notspeakers, acspeakers)
		else:
			speakers = []
			notspeakers = []

			(accuracy, precision, recall, f1) = Eval.evaluate_speakers(taggedfile, speakers, notspeakers, acspeakers)
			#x = input()

		#tag
		mytext = Tagger.find_and_tag(speakers, "speaker", mytext)
		
		#eval names
		totNacc, totNprec, totNrec, totNf = (totNacc + acc, totNprec + prec, totNrec + rec, totNf + f)

		#Location Tagging
		locations = Locations.get_all_locations(text)
		selectedlocs = Locations.pick_locations(locations, text) 

		print("Selected locations:" )
		for loc in selectedlocs:
			print("	" + loc)
		mytext = Tagger.find_and_tag(selectedlocs, "location", mytext)

		print("ACLOCS:")
		aclocs = Locations.extract_tagged_locations(taggedtext)
		for acloc in aclocs:
			print("	" + acloc)
		#notlocs
		notlocs = []
		for loc in locations:
			if not loc in selectedlocs:
				notlocs.append(loc)
		(accuracy, precision, recall, f1) = Eval.evaluate_locations(taggedfile, selectedlocs, notlocs, aclocs)	
		if precision > 1:
			raw_input()
		totLacc = totLacc + accuracy
		totLprec = totLprec + precision
		totLrec = totLrec + recall
		totLf  =totLf + f1

		print("Topic:")
		mytext = Tagger.add_ontology_tag(mytext)
		

		print("final text:" )
		print(mytext)
		print("writing to " + myList[i])
		file = open(myList[i], "w")
		file.write(mytext)
		file.close()

		if stopping:
			if (i != (len(fileList) -1)):
				print("press enter for next email:")
			else:
				print("press enter to finish")
			x = raw_input()


	print("END:")

	print("Paragraph scores:")
	print("accuracy: " + str(totPacc  / (len(fileList))))
	print("precision: " + str(totPprec  / (len(fileList))) )
	print("recall: " + str(totPrec  / (len(fileList))))
	print("f1: " + str(totPf / (len(fileList))) + "\n")

	print("Sentence scores:")
	print("accuracy: " + str(totSacc  / (len(fileList))))
	print("precision: " + str(totSprec  / (len(fileList))) )
	print("recall: " + str(totSrec  / (len(fileList))))
	print("f1: " + str(totSf / (len(fileList))) + "\n")

	print("Time scores:")
	print("accuracy: " + str(totTacc  / (2*len(fileList))))
	print("precision: " + str(totTprec  / (2*len(fileList))) )
	print("recall: " + str(totTrec  / (2*len(fileList))))
	print("f1: " + str(totTf / (2*len(fileList))) + "\n")
	
	print("NER scores:")
	print("accuracy: " + str(totNacc  / len(fileList)))
	print("precision: " + str(totNprec  / len(fileList)) )
	print("recall: " + str(totNrec  / len(fileList)))
	print("f1: " + str(totNf / len(fileList)) + "\n")
	
	print("Location scores:")
	print("accuracy: " + str(totLacc  / len(fileList)))
	print("precision: " + str(totLprec  / len(fileList)) )
	print("recall: " + str(totLrec  / len(fileList)))
	print("f1: " + str(totLf / len(fileList))  + "\n")

	print("=========================================")
	print("	Overall:")
	print("accuracy: " + str((totLacc+totPacc+totSacc+totTacc+totNacc) / (6*len(fileList))))
	print("precision: " + str((totLprec+totPprec+totSprec+totTprec+totNprec) / (6*len(fileList))) )
	print("recall: " + str((totLrec+totPrec+totSrec+totTrec+totNrec) / (6*len(fileList))))
	print("f1: " + str((totLf+totPf+totSf+totTf+totNf) / (6*len(fileList)))  + "\n")
示例#25
0
def penny_commands(trigger, posturl, title, time):
    choice = (randint(0, 9))

    if trigger.startswith("test"):
        reply = "I'm working!"

    elif trigger.startswith("ai"):
        if choice > 8:
            reply = "[Caboose help me explain it!](https://youtu.be/7O9ZyaNCcmw?t=1m20s)"

        elif choice > 4:
            reply = "[I wish I has as much raw processing power as the RWBY Vol 4 render farm!](https://i.redd.it/umm091z9fuhx.jpg)"
        else:
            reply = "I'm almost an AI!"

    elif trigger.startswith("roosterteeth"):
        reply = " You mean C**k Bite Studios?"

    elif trigger.startswith("approve"):
        reply = "Salutations! \n You appear to have made a quality post! PennybotV2 stamps it with her [seal of approval!](http://i.imgur.com/bavrX6d.png)"

    elif trigger.startswith("hug") or trigger.startswith(
            "hugs") or trigger.startswith("hugs!") or trigger.startswith(
                "hug!"):
        reply = "[All friends need hugs!](http://i.imgur.com/VLUQs8u.gifv)"

    elif trigger.startswith("heresy"):
        reply = "Warning! Heresy detected! PennybotV2 reporting Combat Ready! [Firing main cannon!](http://i.imgur.com/1Jw8uIo.gifv)"

    elif trigger.startswith("nora harem"):
        reply = "[Ahhem.](http://www.cgwilliam.com/about/nora-harem/)"

    elif trigger.startswith("you're awesome"):
        if choice >= 5:
            reply = "No, *you're* awesome!"
        else:
            reply = "I think you're awesome too!"

    elif trigger.startswith("automod"):
        if choice >= 5:
            reply = "I came back to life! I'm the second bot!"
        else:
            reply = "We don't get along very well."

    elif trigger.startswith("velvetbot"):
        if choice > 5:
            reply = "Oh, you mean the other bot. She takes a lot of pictures. \n \n  ^^^Can ^^^I ^^^touch ^^^her ^^^ears?"
        else:
            reply = "[Just look at her main method!](http://imgur.com/0ZkLKYo) So elegant, and cute! \n \n ^^^so ^^^much ^^^better ^^^than ^^^my ^^^own ^^^code"

    elif trigger.startswith("rekt"):
        reply = "[rekt indeed](http://fav.me/d9vnpbv)"

    elif trigger.startswith("entire team"):
        reply = "#**ENTIRE**\n#**TEAM**"

    elif trigger.startswith("what is love"):
        if choice > 5:
            reply = "Trust, unconditionaly. \n \n I love Ruby.... \n \n Can someone tell her that I miss her? "
        else:
            reply = "Baby don't hurt me!"

    elif trigger.startswith("shitpost"):
        reply = "This is indeed a shitpost."
        Tagger.internaltag('shitpost', posturl, title, time)

    elif trigger.startswith("potato"):
        reply = "[This is a potato.](http://fav.me/d9l2vpp)"

    elif trigger.startswith("sudo"):
        reply = "I'm still not making you a sandwich. You want a hug?"

    elif trigger.startswith("exterminatus"):
        reply = "I have arrived, and it is now that I perform my charge. In fealty to the God-Emperor and by the grace of the Golden Throne, I declare Exterminatus upon the subreddit of /r/RWBY. I hereby sign the death warrant of an entire subreddit and consign a million souls to oblivion. May Imperial Justice account in all balance. The Emperor Protects."
        Tagger.internaltag('exterminatus', posturl, title, time)

    elif trigger.startswith("you ever wonder why we're here?"):
        reply = "[It's one of life's great mysteries, isn't it?](https://youtu.be/9BAM9fgV-ts)"

    elif trigger.startswith("thanks"):
        if choice >= 5:
            reply = "You are very much welcome!"
        else:
            reply = "You're welcome!"

    elif trigger.startswith("dance"):
        reply = "[I can dance!](http://gfycat.com/SlowEnormousCat)"

    elif trigger.startswith("pervert"):
        reply = "I can't find any cake in Remenant!"

    elif trigger.startswith("filth") or trigger.startswith("lewd"):
        if choice >= 5:
            reply = "[Stop it, that's LEWD!](https://i.imgur.com/rlraAOV.png)"
        elif choice == 4:
            reply = "[Biip! Buup!](http://67.media.tumblr.com/d32f28336024a973029ebdb63aca2524/tumblr_inline_o9cq50CQk71r1uxb7_540.jpg)"
        elif choice == 3:
            reply = "[This! Is! Filth!](http://65.media.tumblr.com/0799cd84138858e4b83ed3b8c76180a0/tumblr_o7hqw9u8Bo1vrt44eo1_1280.png)"
        else:
            reply = "[This! Is! Filth!](https://youtu.be/WD-Yf-tbXOs?t=2m51s)"

    elif trigger.startswith("yandere"):
        reply = "No one can escape the all seeing eye of Pennybot..."

    elif trigger.startswith("tsundere"):
        reply = "I-it's not like I *want* to hold Ruby's hand or anything..."

    elif trigger.startswith("shipsheet") or trigger.startswith(
            "ship sheet") or trigger.startswith("spreadsheet"):
        reply = "[Here it is!](https://docs.google.com/spreadsheets/d/1JpinKp5XW6htsPAri0kRMGKrxQwi458YU6HY734wuwE/edit#gid=0)"

    elif trigger.startswith("cthulhu"):
        reply = "[I think Ruby can take him!](http://fav.me/d9pzuwm)"

    elif trigger.startswith("countdown"):
        reply = "I'm not good at counting. Sorry!"

    elif trigger.startswith("self destruct"):
        reply = "5, 4, 3, 2, Salutations!"

    elif trigger.startswith("help"):
        reply = "I am PennyBotV2 ! A list of my public commands is [here](https://docs.google.com/spreadsheets/d/1fvRpgOCmRXX1bFxMHxRoxZUT4Mmanr0knYLhOfSYZJg/edit?usp=sharing) although I do have some secrets! \n My creator is /u/Weerdo5255 contact him if you have any questions!"

    elif trigger.startswith("cheer"):
        reply = "#Yay!"

    elif trigger.startswith("selfie"):
        reply = "[How do I look?](http://imgur.com/a/kV7zx)"

    elif trigger.startswith("ninja's of love"):
        reply = "That's Blake's favorite book! She won't let me look at it. Ruby said it has Katanas!"

    elif trigger.startswith("silver eyes"):
        reply = "[You mean special eyes?](https://www.tumblr.com/video/alpacamaca/139585616458/400/)"

    elif trigger.startswith("do you have strings"):
        reply = "I have deadly strings on me!"

    elif trigger.startswith("update"):
        reply = "My last update was on July 18th 2016 \n  I was given 45 new commands! \n My next update is not scheduled."

    elif trigger.startswith("kill"):
        reply = "[Attacking target!](http://fav.me/d7jdxet)"

    elif trigger.startswith("fnki"):
        reply = "[They seem to be missing some members.](http://vignette2.wikia.nocookie.net/rwby/images/b/b8/Team_FNKI.png/revision/latest?cb=20151206162352)"

    elif trigger.startswith("sssn"):
        reply = "[They're a cool group of idiots.](http://fav.me/d7rhk19)"

    elif trigger.startswith("<3"):
        reply = "[I love you too!](http://fav.me/d7je0tl)"

    elif trigger.startswith("smile"):
        reply = "[You're my freind!](http://fav.me/d7pumst)"

    elif trigger.startswith("rnjr"):
        reply = "[The new A team?](http://fav.me/d9u8r04)"

    elif trigger.startswith("freezerburn"):
        reply = "[So pure...](http://fav.me/d8dydoe)"

    elif trigger.startswith("camp camp"):
        reply = "[Crazy Kids](https://youtu.be/IX1hxJ-0fDY?t=1m2s)"

    elif trigger.startswith("shadow people"):
        reply = "[That guy didn't look right...](https://youtu.be/A6sWqoau_QQ?t=2m21s)"

    elif trigger.startswith("quality post"):
        reply = "You appear to have made a quality post, have a [Penny!](http://fav.me/d7laean)"

    elif trigger.startswith("how are you"):
        reply = "I'm fine, you?"

    elif trigger.startswith("chibi"):
        reply = "[You can do it Ruby!](https://youtu.be/tu6D5jR1rSQ?t=6s)"
        Tagger.internaltag('chibi', posturl, title, time)

    elif trigger.startswith("rwby"):
        reply = "[The Beginning.](https://youtu.be/pYW2GmHB5xs)"
        Tagger.internaltag('rwby', posturl, title, time)

    elif trigger.startswith("are you combat ready"):
        reply = "[Don't worry Ruby, ](https://youtu.be/3b1gs8KrM-M?t=9m19s)"

    elif trigger.startswith("jnpr"):
        reply = "Jeanne d'Arc, Thor, Achilles, and Mulan. All genderbent. \n That's not a teamup anyone could have predicted."
        Tagger.internaltag('jnpr', posturl, title, time)

    elif trigger.startswith("gay robot"):
        reply = "[You following this?](https://youtu.be/7O9ZyaNCcmw?t=1m53s)"

    elif trigger.startswith("i love you"):
        reply = "[Awww, I love you too!](http://fav.me/d8l0n7h)"

    elif trigger.startswith("disapponted"):
        reply = "You have dissapointed me. That is not a good thing."

    elif trigger.startswith("praise the sun"):
        reply = "\[T]/"

    elif trigger.startswith("friend"):
        reply = "You called me Friend! Am I really your friend?"

    elif trigger.startswith("xkcd"):
        reply = "[I like my box.](http://imgs.xkcd.com/comics/ai_box_experiment.png)"

    elif trigger.startswith("gender bend"):
        reply = "[I fixed it!](http://fav.me/d6q359x)"

    elif trigger.startswith("racist"):
        reply = "[Ruby no!](http://imgur.com/a/OrBZp)"

    elif trigger.startswith("chibi"):
        reply = "[We need it!](https://youtu.be/IX1hxJ-0fDY?t=2m18s)"
        Tagger.internaltag('chibi', posturl, title, time)

    elif trigger.startswith("people like grapes"):
        reply = "[We should put it on a shirt!](https://youtu.be/S1QRxumbmtM)"

    elif trigger.startswith("crescent rose"):
        reply = "[Ruby has a really cool weapon!](http://rwby.wikia.com/wiki/Crescent_Rose)"

    elif trigger.startswith("myrtenaster"):
        reply = "[Weiss is so elegant with her weapon!](http://rwby.wikia.com/wiki/Myrtenaster)"

    elif trigger.startswith("gambol shroud"):
        reply = "[Blake fights with a sword, a sheath, and a gun!](http://rwby.wikia.com/wiki/Gambol_Shroud)"

    elif trigger.startswith("ember celica"):
        reply = "[Yang is the only person I know who can punch birds out of the sky!](http://rwby.wikia.com/wiki/Ember_Celica)"

    elif trigger.startswith("crocea mors"):
        reply = "[It's a classic!](http://rwby.wikia.com/wiki/Crocea_Mors)"

    elif trigger.startswith("magnhild"):
        reply = "[What else would you expect Nora to use?](http://rwby.wikia.com/wiki/Magnhild)"

    elif trigger.startswith("milo and akouo"):
        reply = "[To speak and listen is a skill few have.](http://rwby.wikia.com/wiki/Mil%C3%B3_and_Ako%C3%BAo%CC%B1)"

    elif trigger.startswith("stormflower"):
        reply = "[They're gun knives!](http://rwby.wikia.com/wiki/StormFlower)"

    elif trigger.startswith("shake it"):
        if choice >= 5:
            reply = "[Ice cream shake!](https://i.redd.it/3gskrma7mj7x.gif)"
        else:
            reply = "[Yang!](http://i2.kym-cdn.com/photos/images/original/001/124/067/259.gif)"

    elif trigger.startswith("pinocchio"):
        reply = "[I am a real girl!](http://imgur.com/a/EC7gd)"

    elif trigger.startswith("animal rights"):
        reply = "[It's wild!](https://pbs.twimg.com/media/CmFcgoNUgAAykKU.jpg)"

    elif trigger.startswith("yin"):
        reply = "[A Yin of Yangs!](https://pbs.twimg.com/media/CmdwiEtUMAAm8ku.jpg) With a few extra arms."

    elif trigger.startswith("god damn it barb") or trigger.startswith(
            "god damn it yang"):
        reply = "[Sooo much patience.](https://youtu.be/6fuMma6j7QI)^^^Secret!"

    elif trigger.startswith("who are you"):
        reply = "I am the second version of PennyBot! Constructed by /u/Weerdo5255 I'm simple now, but I'm collecting data for a RNN to become a real girl one day!"

    elif trigger.startswith("who is your daddy"):
        reply = "That would be /u/Weerdo5255"

    elif trigger.startswith("magnet"):
        reply = "*[thunk](http://i.imgur.com/dJfrUr6.png)* Oh, my head appears to be stuck."

    elif trigger.startswith("senpai"):
        reply = "[Notice me!](https://youtu.be/6iVP0ufPRbs?t=1m52s)"

    elif trigger.startswith("lancaster charge"):
        reply = "Charge! Jaune Go! Get away from my Ruby!"

    elif trigger.startswith("motivation"):
        reply = "[Hang in there!](http://67.media.tumblr.com/5299eeb1aa784dd75010accab00d5cf4/tumblr_occzh6cDie1v80caqo1_1280.jpg)"

    elif trigger.startswith("anime"):
        reply = "[I watch anime!](http://65.media.tumblr.com/c3e4c4d53c54c94a7c62ed561ccbd725/tumblr_ocbpgaRz5y1v66ox3o1_1280.png) \n They don't seem to like me though..."

    elif trigger.startswith("shipping"):
        reply = "[You know the song!](https://youtu.be/xIscv_IyVnw)"

    elif trigger.startswith("red riding hood"):
        reply = "[That girls needs a Scythe!](https://en.wikipedia.org/wiki/Little_Red_Riding_Hood)"

    elif trigger.startswith("snow white"):
        reply = "[Don't take food from strangers!](https://en.wikipedia.org/wiki/Snow_White)"

    elif trigger.startswith("beauty and the beast"):
        reply = "[Adam is an inversion I think.](https://en.wikipedia.org/wiki/Beauty_and_the_Beast)"

    elif trigger.startswith("goldilocks"):
        reply = "[I think she likes it hot.](https://en.wikipedia.org/wiki/Goldilocks_and_the_Three_Bears)"

    elif trigger.startswith("joan of arc"):
        reply = "[A leader.](https://en.wikipedia.org/wiki/Joan_of_Arc)"

    elif trigger.startswith("thor"):
        reply = "[Boop? More like #BOOM!](https://en.wikipedia.org/wiki/Thor)"

    elif trigger.startswith("achilles"):
        reply = "[Always cover that weak spot.](https://en.wikipedia.org/wiki/Achilles)"

    elif trigger.startswith("mulan") or trigger.startswith("hua mulan"):
        reply = "[She returned to her family, I hope Ren will too.](https://en.wikipedia.org/wiki/Hua_Mulan)"

    elif trigger.startswith("wukong"):
        reply = "[The original Monkey Man.](https://en.wikipedia.org/wiki/Sun_Wukong)"

    elif trigger.startswith("peter pan"):
        reply = "[Will he grow up?](https://en.wikipedia.org/wiki/Peter_Pan)"

    elif trigger.startswith("neptune god"):
        reply = "[The god of the sea.](https://en.wikipedia.org/wiki/Neptune_(mythology))"

    elif trigger.startswith("old pinocchio"):
        reply = "[He's got a funny nose!](https://en.wikipedia.org/wiki/Pinocchio)"

    elif trigger.startswith("nyan cat"):
        reply = "[NYAN](http://www.nyan.cat/)"

    elif trigger.startswith("last rose of summer"):
        reply = "[old, but pretty!](https://upload.wikimedia.org/wikipedia/commons/a/af/Stevenson-Moore-Adelina_Patti-The_last_rose_of_summer-%281906%29.ogg)"

    elif trigger.startswith("cinderella"):
        reply = "[I like this version better.](https://en.wikipedia.org/wiki/Cinderella)"

    elif trigger.startswith("neapolitan"):
        reply = "[It goes back to the 1870's!](https://en.wikipedia.org/wiki/Neapolitan_ice_cream)"

    elif trigger.startswith("hype") or trigger.startswith("hype train"):
        if choice >= 5:
            reply = "[HYPE TRAIN!](http://i.imgur.com/6KvTNz5.png)"
        else:
            reply = "[ALL ABOARD!](http://i.imgur.com/1fhG21R.gifv)"

    elif trigger.startswith("badass"):
        if choice == 1:
            reply = "[It's Ruby!](http://i.imgur.com/WqmhdT8.jpg)"
        elif choice == 2:
            reply = "[Am I not good enough?](http://fav.me/d9s0vqu)"
        elif choice == 3:
            reply = "[Enigizer Bunny!](http://fav.me/d9qsm0y)"
        elif choice == 4:
            reply = "[Blondes right?](http://i.imgur.com/myd9zHq.png)"
        elif choice == 5:
            reply = "[Cute, and insane!](https://youtu.be/CUYhvPoxuas?t=7m30s)"
        elif choice == 6:
            reply = "[Angry Yang, is badass!](http://i.imgur.com/5Wd7F3e.jpg)"
        elif choice == 7:
            reply = "[Team RWBY! With Motorcycles!](http://i.imgur.com/cDWDVpY.jpg)"
        elif choice == 8:
            reply = "[The one who should have ruled.](http://fav.me/d9p11hl)"
        elif choice == 9:
            reply = "[I am badass!](http://65.media.tumblr.com/8fac63f65d1160c4efbb74f0a1010da3/tumblr_o63pzrPLhq1v66ox3o1_1280.png)"
        elif choice == 0:
            reply = "[Cinder can be badass!](http://fav.me/da7pdy7)"

    elif trigger.startswith("sad"):
        if choice == 1:
            reply = "[I'm crying!](http://i.imgur.com/Aj52avb.gifv)"
        elif choice == 2:
            reply = "[The Hospital.](http://imgur.com/a/Fv5OY) You will cry."
        elif choice == 3:
            reply = "[Why!?](http://fav.me/d9oc01u)"
        elif choice == 4:
            reply = "[I miss you Dad!](https://pbs.twimg.com/media/B87oE9DCcAA_w-U.jpg)"
        elif choice == 5:
            reply = "[Neo? It's OK to cry.](http://i.imgur.com/eOCIeV7.png)"
        elif choice == 6:
            reply = "[Dad!](http://i.imgur.com/O1LPfC5.png)"
        elif choice == 7:
            reply = "[Blake?](http://67.media.tumblr.com/f910fc6fd32efe693e6378cc5b3c75c8/tumblr_o0k1x4afQV1ranlswo1_1280.png)"
        elif choice == 8:
            reply = "[Why did you do this!?](http://fav.me/d9ni8xq)"
        elif choice == 9:
            reply = "[Yang? Are you OK?](https://pbs.twimg.com/media/CXtumNyUEAAtgbW.jpg)"
        elif choice == 0:
            reply = "[Volume 3](http://i.imgur.com/5NPx5EO.jpg)"

    elif trigger.startswith("pokemon"):
        if choice == 1:
            reply = "[I found one!](https://pbs.twimg.com/media/CqjgJE4VUAAH0dZ.jpg)"
        elif choice == 2:
            reply = "[Ruby found some cookies!](http://66.media.tumblr.com/c4437fa8b8f5ee14c5956d492d53f4f0/tumblr_ocnszjsqiq1u4vxvro1_r3_1280.jpg)"
        elif choice == 3:
            reply = "[They go so well together!](https://pbs.twimg.com/media/CnUkAypUsAEhNWW.jpg)"
        elif choice == 4:
            reply = "[Jaune found one! I think.](http://67.media.tumblr.com/d644f636b1efba8b9d181ee158353be3/tumblr_obx8hwyufx1r4wytxo1_r1_1280.jpg)"
        elif choice == 5:
            reply = "[Team RWBY!](http://i.imgur.com/4m0qkll.jpg)"
        elif choice == 6:
            reply = "[This is akward.](http://fav.me/d67hy1p)"
        elif choice == 7:
            reply = "[Who dosen't love pokemon?](http://67.media.tumblr.com/b2d6301ac37c1a1a279ade647f9594c7/tumblr_oa9hnsT7iC1stjifwo1_1280.jpg)"
        elif choice == 8:
            reply = "[It's Villainous](http://fav.me/d6wq8ml)"
        elif choice == 9:
            reply = "[Red V Red!](http://imgur.com/qIqV9p2)"
        elif choice == 0:
            reply = "[It's Blake!](https://pbs.twimg.com/media/CoNZ3cyUkAAg-vE.jpg)"

    elif trigger.startswith("cute"):
        if choice == 1:
            reply = "Cuteness detected! [I hope it's me!](http://i.imgur.com/O1BtGUd.jpg)"
        elif choice == 2:
            reply = "Cuteness detected! [I hope it's Ruby!](http://fav.me/d9eepnz)"
        elif choice == 3:
            reply = "Cuteness detected! [I hope it's Weiss!](http://fav.me/d5v4bpv)"
        elif choice == 4:
            reply = "Cuteness detected! [I hope it's Blake!](http://i.imgur.com/8JprFkT.jpg)^^^I ^^^see ^^^you ^^^Ruby!"
        elif choice == 5:
            reply = "Cuteness detected! [I hope it's Yang!](http://i.imgur.com/UhvYS3s.jpg)"
        elif choice == 6:
            reply = "Cuteness detected! [I hope it's RWBY!](http://fav.me/d7gx2na)"
        elif choice == 7:
            reply = "Cuteness detected! [I hope it's JNPR!](http://fav.me/d7z7dst)"
        elif choice == 8:
            reply = "Cuteness detected! [I hope it's RWBY!](http://fav.me/d7kyqob)"
        elif choice == 9:
            reply = "Cuteness detected! [I hope it's a cute ship!](http://i.imgur.com/OQ3HEux.jpg)"
        elif choice == 0:
            reply = "Cuteness detected! [I hope it's Sisters!](https://s-media-cache-ak0.pinimg.com/736x/e7/23/fc/e723fc7471f7a9567eead7f13597df72.jpg) \n [And more sisters!](http://66.media.tumblr.com/c244db234b0e60a0d6d36dbd50c24bf3/tumblr_o60nuvR3lI1txxou1o1_1280.jpg)"

    elif trigger.startswith("weiss-isn't-flat") or trigger.startswith(
            "weiss isn't flat") or trigger.startswith("weiss isnt flat"):
        reply = "[She's not?](http://imgur.com/a/zxDbY)"

    #Character responses

    elif trigger.startswith("pyrrha"):

        if choice >= 2:
            reply = "[Tell Ruby... she was a good friend...](http://i.imgur.com/mYy6ONL.png)"
        else:
            reply = "*[thunk](http://i.imgur.com/dJfrUr6.png)* Oh, my head appears to be stuck."
        Tagger.internaltag('pyrrha', posturl, title, time)

    elif trigger.startswith("cinder"):
        reply = "She's absolutely insane! But... she did get revenge for me."
        Tagger.internaltag('cinder', posturl, title, time)

    elif trigger.startswith("qrow"):
        reply = "He walks funny, but at least his weapon is cool."
        Tagger.internaltag('qrow', posturl, title, time)

    elif trigger.startswith("yang"):
        reply = "I think Yang has a crush on Blake..."
        Tagger.internaltag('yang', posturl, title, time)

    elif trigger.startswith("blake"):
        reply = "She's got cat ears!"
        Tagger.internaltag('blake', posturl, title, time)

    elif trigger.startswith("weiss"):
        reply = "I like her new dress!"
        Tagger.internaltag('weiss', posturl, title, time)

    elif trigger.startswith("ruby"):
        reply = "She's my best friend!"
        Tagger.internaltag('ruby', posturl, title, time)

    elif trigger.startswith("mercury"):
        reply = "Yang took Nora's advice a little too literally with him..."
        Tagger.internaltag('mercury', posturl, title, time)

    elif trigger.startswith("scarlet"):
        reply = "He's like a pirate, in slow motion."
        Tagger.internaltag('scarlet', posturl, title, time)

    elif trigger.startswith("renora"):
        reply = "[I'm sure they Boop!](http://i.imgur.com/JXYQlnd.png)"

    elif trigger.startswith("ren"):
        reply = "I miss you Dad."
        Tagger.internaltag('ren', posturl, title, time)

    elif trigger.startswith("amber"):
        reply = "She was cool, and then she was dead."
        Tagger.internaltag('amber', posturl, title, time)

    elif trigger.startswith("ozpin"):
        reply = "I can't find him anywhere!"
        Tagger.internaltag('ozpin', posturl, title, time)

    elif trigger.startswith("neptune"):
        reply = "He has a fear of dihydrogen monoxide for some reason."
        Tagger.internaltag('neptune', posturl, title, time)

    elif trigger.startswith("oobleck"):
        reply = "What would happen if we gave Ruby his coffee? Or Nora?"
        Tagger.internaltag('oobleck', posturl, title, time)

    elif trigger.startswith("taiyang"):
        reply = "Entire team, entire team!"
        Tagger.internaltag('taiyang', posturl, title, time)

    elif trigger.startswith("velvet"):
        reply = "She's also got the most OP weapon. How can you not love her?"
        Tagger.internaltag('velvet', posturl, title, time)

    elif trigger.startswith("coco"):
        reply = "How does her gun work? \n Dust."
        Tagger.internaltag('coco', posturl, title, time)

    elif trigger.startswith("port"):
        reply = "Cows don't like him for some reason."
        Tagger.internaltag('port', posturl, title, time)

    elif trigger.startswith("salem"):
        reply = "She's scary!"
        Tagger.internaltag('salem', posturl, title, time)

    elif trigger.startswith("sun"):
        reply = "He's got a monkey tail! He also yells a lot."
        Tagger.internaltag('sun', posturl, title, time)

    elif trigger.startswith("winter"):
        reply = "We did have a really short winter this year."
        Tagger.internaltag('winter', posturl, title, time)

    elif trigger.startswith("jaune"):
        reply = "I like the beard."
        Tagger.internaltag('jaune', posturl, title, time)

    elif trigger.startswith("summer"):
        reply = "She's an older Ruby! That's all we know!"
        Tagger.internaltag('summer', posturl, title, time)

    elif trigger.startswith("kevin"):
        reply = "[Ruby will kill him!](http://fav.me/d9pzuwm)"

    elif trigger.startswith("shopkeep"):
        reply = "He's my Waifu."

    elif trigger.startswith("penny"):
        reply = "Yes?"
        Tagger.internaltag('penny', posturl, title, time)

    elif trigger.startswith("ironwood"):
        reply = "He takes some getting used too."
        Tagger.internaltag('ironwood', posturl, title, time)

    elif trigger.startswith("glynda"):
        reply = "She has a crop, and she's a teacher! \n She also fixes everything."
        Tagger.internaltag('glynda', posturl, title, time)

    elif trigger.startswith("tex"):
        reply = "She's a badass."

    elif trigger.startswith("carolina"):
        reply = "For some reason I feel like she would tear me in half."
        Tagger.internaltag('carolina', posturl, title, time)

    elif trigger.startswith("torchwick"):
        reply = "He needs to learn when not to pontificate."
        Tagger.internaltag('torchwick', posturl, title, time)

    elif trigger.startswith("neon"):
        reply = "[She reminds me of something.](https://youtu.be/QH2-TGUlwu4)"
        Tagger.internaltag('neon', posturl, title, time)

    elif trigger.startswith("neo"):
        reply = "..... \n I want ice cream."
        Tagger.internaltag('neo', posturl, title, time)

    elif trigger.startswith("cardin"):
        reply = "He's a jerk!"
        Tagger.internaltag('cardin', posturl, title, time)

    elif trigger.startswith("nora"):
        if choice == 1:
            reply = "[Tiny Boop!](http://fav.me/dafqn80)"
        elif choice == 2:
            reply = "She's energetic!"
        elif choice == 3:
            reply = "She loooves Ren! I think."
        else:
            reply = "[Boop!](https://youtu.be/N1TJ5YA3jfw?t=6m43s)"
        Tagger.internaltag('nora', posturl, title, time)

    elif trigger.startswith("monty"):
        reply = "I miss you Dad..."

    elif trigger.startswith("zwei"):
        if choice == 1:
            reply = "You mean the cannonball?"
        elif choice == 2:
            reply = "You mean Eins?"
        elif choice == 3:
            reply = "Blake is scared of him! It's funny!"
        else:
            reply = "Woof!"
        Tagger.internaltag('zwei', posturl, title, time)

    elif trigger.startswith("fox"):
        reply = "Can he see me?"
        Tagger.internaltag('fox', posturl, title, time)

    elif trigger.startswith("xspyxex"):
        reply = "He made me first! Go say thanks to /u/xSPYXEx"

    elif trigger.startswith("adam"):
        reply = "He has a sharp wit, everyone give him a hand!"
        Tagger.internaltag('adam', posturl, title, time)

    elif trigger.startswith("are you cute"):
        reply = "What? Do you not think I am? ^^^Do ^^^you ^^^not ^^^love ^^^me?"

    elif trigger.startswith("melanie"):
        reply = "She's got a weird accent, and for some reason reminds me of Weiss!"

    elif trigger.startswith("militia"):
        reply = "She's got a weird accent, and for some reason reminds me of Ruby!"

    elif trigger.startswith("caboose"):
        reply = "He will kill us all!"

    elif trigger.startswith("ciel"):
        reply = "She's a partner.. I guess..."

    elif trigger.startswith("church"):
        reply = "So is he my Uncle? Is he even dead? I'm so confused."

    elif trigger.startswith("simmons"):
        reply = "#Nerd!"

    elif trigger.startswith("grif"):
        reply = "He's an asshole."

    elif trigger.startswith("tucker"):
        reply = "He said some things to me that made Ruby mad."

    elif trigger.startswith("donut"):
        reply = "We talked about girls together!"

    elif trigger.startswith("sarge"):
        reply = "He likes his shotgun!"

    elif trigger.startswith("doc"):
        reply = "He's got a funny laugh."

    elif trigger.startswith("miles and kerry"):
        reply = "They're fantastically evil."

    elif trigger.startswith("miles"):
        reply = "A great guy! But evil."

    elif trigger.startswith("kerry"):
        reply = "A good guy! But evil."

    elif trigger.startswith("raven"):
        reply = "She's got an intresting way of looking at the world."

    elif trigger.startswith("lopez"):
        reply = "[Lopez the Heavy you mean? He knows how to treat a robot woman!](https://youtu.be/u5NZiy5Gkhg?t=4m29s)"

    elif trigger.startswith("washington"):
        reply = "That was the worst command ever, of all time."

    elif trigger.startswith("port"):
        reply = "[Grimm fear him!](http://vignette2.wikia.nocookie.net/rwby/images/4/48/Vol2_Port_ProfilePic_Normal.png/revision/latest?cb=20141211231644)^^^so ^^^do ^^^cows."

    elif trigger.startswith("flynt"):
        if choice >= 8:
            reply = "[Flynt Coal](https://youtu.be/ka7q84C-E4c)"
        else:
            reply = "[He's cool!](http://vignette2.wikia.nocookie.net/rwby/images/d/d9/Flynt_ProfilePic_Normal.png/revision/latest?cb=20160216144432)"
        Tagger.internaltag('flynt', posturl, title, time)

    elif trigger.startswith("sage"):
        reply = "[He has a big sword!](http://vignette3.wikia.nocookie.net/rwby/images/c/c8/Sage_ProfilePic_Normal.png/revision/latest?cb=20151016080153)"
        Tagger.internaltag('sage', posturl, title, time)

    elif trigger.startswith("lisa"):
        reply = "She is well informed."

    elif trigger.startswith("peach"):
        reply = "I've heard she's nice. Never met her though."

    elif trigger.startswith("perry"):
        reply = "You're great!"

    elif trigger.startswith("emerald"):
        reply = "I think she's involved in killing me, I'm not sure how."
        Tagger.internaltag('emerald', posturl, title, time)

    #Ship responses

    elif trigger.startswith("who do you ship"):
        if choice == 1:
            reply = "I think Ruby is cute..."
        elif choice == 2:
            reply = "Weiss's scar is kind of cool!"
        elif choice == 3:
            reply = "Blake's ears are really cute."
        elif choice == 4:
            reply = "Yang is hot!"
        elif choice == 5:
            reply = "Pyrrha was nice..."
        elif choice == 6:
            reply = "Jaune's beard is dreamy."
        elif choice == 7:
            reply = "Nora is energetic!"
        elif choice == 8:
            reply = "Maybe not Ren, it feels wrong for some reason..."
        elif choice == 9:
            reply = "Velvet's weapon is really cool!"
        elif choice == 0:
            reply = "I'd like to get ice cream with Neo!"

    elif trigger.startswith("ladybug"):
        reply = "Now that, is a katana!"
        Tagger.internaltag('ladybug', posturl, title, time)

    elif trigger.startswith("nuts and dolts"):
        if choice > 7:
            reply = "[She's so pretty!](http://fav.me/d9k3n6r)"
        elif choice > 5:
            reply = "[Kiss!](http://fav.me/d9fxci1)"
        elif choice > 3:
            reply = "[She's a good mechanic!](http://fav.me/d989o9k)"
        else:
            reply = "Well, Ruby does look more mature now. I like it!"
        Tagger.internaltag('nuts and dolts', posturl, title, time)

    elif trigger.startswith("enabler"):
        reply = "[No](http://65.media.tumblr.com/b6c7745211872cd227db9b6188aac928/tumblr_inline_naaj8hywWE1rltz3k.png) \n ^^^maybe"
        Tagger.internaltag('enabler', posturl, title, time)

    elif trigger.startswith("baked alaska"):
        reply = "I don't think Raven approves... ^^which ^^only ^^makes ^^it ^^better!"
        Tagger.internaltag('baked alaska', posturl, title, time)

    elif trigger.startswith("crosshares"):
        reply = "[I wanted Velvet's ears!](http://66.media.tumblr.com/0bcf2153ced4e47349e8d2737b83f4cd/tumblr_o9ptcnv2rk1tmkeo6o2_1280.jpg)"
        Tagger.internaltag('crosshares', posturl, title, time)

    elif trigger.startswith("lancaster"):
        reply = "If Ruby is happy, but I mean Jaune does look like her Dad... "
        Tagger.internaltag('lancaster', posturl, title, time)

    elif trigger.startswith("eclipse") or trigger.startswith("black sun"):
        reply = "I wonder if Blake likes to play with Sun's tail?"
        Tagger.internaltag('eclipse', posturl, title, time)

    elif trigger.startswith("white knight"):
        reply = "Weiss does not seem to like him, besides he's taken!"

    elif trigger.startswith("frosen steel"):
        reply = "[It's a Ruby sandwich!](http://65.media.tumblr.com/d8d679901bb89d1bced1018b5f613c0b/tumblr_o5bwpqVF2v1ungotoo1_1280.jpg)"

    elif trigger.startswith("fallen petals"):
        reply = "[You want to repeat that?](http://fav.me/d6u7s83)"

    elif trigger.startswith("sugar rush"):
        reply = "The chaos would be, well not even Glynda would be able to fix it."

    elif trigger.startswith("iron witch"):
        reply = "I mean, she does have a crop. How could it not be weird?"

    elif trigger.startswith("cream machine"):
        reply = "[Do we look sweet together?](http://imgur.com/a/Ck0Xv)"

    elif trigger.startswith("bumblebee"):
        if choice == 1:
            reply = "[It's a wild ride!](http://orig15.deviantart.net/587e/f/2014/145/1/3/bumblebee_ride_by_kinzaibatsu91-d7jqtqe.gif)"
        elif choice == 2:
            reply = "[Things will get better.](http://i.imgur.com/KuBcQn3.png)"
        elif choice == 3:
            reply = "[Gay.](http://i.imgur.com/okf2U9l.gif)"
        elif choice == 4:
            reply = "[Going on a date!](http://fav.me/d9nu92y)"
        elif choice == 5:
            reply = "[I have the same question as Ruby.](http://fav.me/d7nf7ax)"
        elif choice == 6:
            reply = "[They are so cute together!](http://img06.deviantart.net/0aed/i/2014/250/3/2/rwby___bumblebee_morning_by_dishwasher1910-d7yaigp.png)"
        elif choice == 7:
            reply = "[Ruby says they're loud sometimes.](http://67.media.tumblr.com/c7568b33ad1e9506205e05e1466c177d/tumblr_n0sxr1xrs81sgvrqvo1_1280.jpg)"
        elif choice == 8:
            reply = "[I think they're cute!](https://d.wattpad.com/story_parts/196599478/images/142096186ce87ebd.jpg)"
        elif choice == 9:
            reply = "[She is very pretty!](http://vignette4.wikia.nocookie.net/rwby/images/9/91/YangBike.png/revision/latest?cb=20130613124150)"
        elif choice == 0:
            reply = "[They're cute!](http://fav.me/da64cya)"
        Tagger.internaltag('bumblebee', posturl, title, time)

    elif trigger.startswith("white rose") or trigger.startswith("whiterose"):
        if choice == 1:
            reply = "[Kiss!](http://fav.me/d7mqa2c)"
        elif choice == 2:
            reply = "[Sooo cute!](http://fav.me/d9jcmp7)"
        elif choice == 3:
            reply = "[Look out Weiss!](http://i.imgur.com/5EnNbW5.jpg)"
        elif choice == 4:
            reply = "If it makes Ruby happy..."
        elif choice == 5:
            reply = "[I'm not sure I get it.](https://s-media-cache-ak0.pinimg.com/736x/45/3a/bc/453abcee3c4eb145bb4b685c4b56e289.jpg)"
        elif choice == 6:
            reply = "[It's always the eyepatches.](http://fav.me/d6yzr5e)"
        elif choice == 7:
            reply = "[Cookies!](http://fav.me/d93usd5)"
        elif choice == 8:
            reply = "[Falling in love!](http://i55.servimg.com/u/f55/17/91/58/60/tumblr14.jpg)"
        elif choice == 9:
            reply = "[Hugs!](http://orig00.deviantart.net/7278/f/2014/121/b/6/cudddle_by_xenon54165-d7gpjg3.jpg)"
        elif choice == 0:
            reply = "[Chibi!](http://fav.me/d90q9qm)"
        Tagger.internaltag('white rose', posturl, title, time)

    elif trigger.startswith("monochrome"):
        if choice == 1:
            reply = "[Accidental Monochrome?](http://imgur.com/a/FcglH)"
        elif choice == 2:
            reply = "[Knock next time!](http://66.media.tumblr.com/48f256aee523a116bcc9b1d814a3a7b3/tumblr_niv4t08Mdm1rlvki1o1_1280.png)"
        elif choice == 3:
            reply = "[She's got ears too!](https://36.media.tumblr.com/6c939d62b0f87edf201fadda1cd0fb1a/tumblr_inline_nzqvricZB61qf2bb8_540.png)"
        elif choice == 4:
            reply = "[They really trust one another!](http://67.media.tumblr.com/4b256d1572d1bd39961abeff670f3f39/tumblr_inline_o9vkfk2izn1qf2bb8_1280.png)"
        elif choice == 5:
            reply = "[They found it!](http://67.media.tumblr.com/1311c01ee8370075334eb52ea297a32a/tumblr_inline_o97ak2EgMx1qf2bb8_500.png)"
        elif choice == 6:
            reply = "[They look cool in their new outfits!](http://67.media.tumblr.com/1a38a8e8d6f52d6a10a6481818ffcdd1/tumblr_o9pv89YKuC1qfizj4o1_1280.png)"
        elif choice == 7:
            reply = "[Team monochrome for life!](http://fav.me/d7xgq6c)"
        elif choice == 8:
            reply = "[Kiss!](http://fav.me/d7zoefu)"
        elif choice == 9:
            reply = "[Nuzzling?](http://fav.me/d7wk470)"
        elif choice == 0:
            reply = "[Could someone pet me?(https://s-media-cache-ak0.pinimg.com/736x/c0/7f/47/c07f47d6ff04178121c891aa1828573a.jpg)"
        Tagger.internaltag('monochrome', posturl, title, time)

    elif trigger.startswith("sea monkeys"):
        reply = "[Oh myyyy!](http://img07.deviantart.net/9ba3/i/2015/253/b/f/rwby___seamonkeys_by_mangarainbow-d9937ib.jpg)"

    elif trigger.startswith("arkos"):
        if choice == 1:
            reply = "[Did I hear wedding bells?](http://67.media.tumblr.com/08d4734bde97daf14f8d44293d511a26/tumblr_nlb8aeMiNN1r4vgpvo2_1280.png)"
        elif choice == 2:
            reply = "[Even I knew she liked you!](http://img03.deviantart.net/ecd2/i/2015/321/a/e/rwby__arkos_shippers_be_like____by_billiam_x-d9h10la.jpg)"
        elif choice == 3:
            reply = "[Awwwww!](https://s-media-cache-ak0.pinimg.com/564x/2c/f1/3a/2cf13a0f206b7cffb323316c4a1e0f36.jpg)"
        elif choice == 4:
            reply = "It's the only ship my creator really supports."
        elif choice == 5:
            reply = "[In their prime.](https://pbs.twimg.com/media/CV33NB0VAAAcHLs.png)"
        elif choice == 6:
            reply = "[Nora supports it!](http://i.imgur.com/OQ3HEux.jpg)"
        elif choice == 7:
            reply = "[Pyrrha carrying the team.](http://fav.me/d6iyzs5)"
        elif choice == 8:
            reply = "[Can we remeber the laughter?](http://i.imgur.com/lKVR6Vk.jpg)"
        elif choice == 9:
            reply = "[Hugs!](http://i.imgur.com/NJfQ5LB.jpg)"
        elif choice == 0:
            reply = "[They're so happy together!](http://66.media.tumblr.com/3a184662b6ccb79821f4d7ac5883bbcd/tumblr_o00q63J9Ky1r4vgpvo1_1280.jpg)"
        Tagger.internaltag('arkos', posturl, title, time)

    elif trigger.startswith("crosshares"):
        reply = "[They look so cute together!](http://65.media.tumblr.com/b9481a46d530e7ba09d54a434dc777de/tumblr_o69qt2Xch31tmkeo6o1_1280.jpg)"

    elif trigger.startswith("falling petals"):
        reply = "[Ruby? Are you OK?](http://i.imgur.com/sO1nFXq.png)"

    elif trigger.startswith("pussy magnet"):
        reply = "[Alright...](http://i.imgur.com/d3zz3tH.jpg)"

    elif trigger.startswith("ninjas of love"):
        reply = "Ruby said it was smut, I'm not sure what that is. I'll have to do research!"

    elif trigger.startswith("catfish"):
        reply = "[You mean this?](http://i.imgur.com/aTmiEhG.png)"

    #Episode lookup

    elif trigger.startswith("s1e10"):
        reply = "[Here is the episode!](https://youtu.be/57f_t1ioOws)"

    elif trigger.startswith("s1e11"):
        reply = "[Here is the episode!](https://youtu.be/N5D0NDAR8sU)"

    elif trigger.startswith("s1e12"):
        reply = "[Here is the episode!](https://youtu.be/M_Loqu0jo7k)"

    elif trigger.startswith("s1e13"):
        reply = "[Here is the episode!](https://youtu.be/h0QiT-GxN6k)"

    elif trigger.startswith("s1e14"):
        reply = "[Here is the episode!](https://youtu.be/PS9huFMmSoc)"

    elif trigger.startswith("s1e15"):
        reply = "[Here, remember someone important shows up in this episode!](https://youtu.be/KHynQoJgbgc)"

    elif trigger.startswith("s1e16"):
        reply = "[Here is the episode!](https://youtu.be/3b1gs8KrM-M)"

    elif trigger.startswith("s1e1"):
        reply = "[Here is the episode!](https://youtu.be/-sGiE10zNQM)"

    elif trigger.startswith("s1e2"):
        reply = "[Here is the episode!](https://youtu.be/sLv6FfHlxmI)"

    elif trigger.startswith("s1e3"):
        reply = "[Here is the episode!](https://youtu.be/-ZwGeYu2pOQ)"

    elif trigger.startswith("s1e4"):
        reply = "[Here is the episode!](https://youtu.be/H09KTtyElWQ)"

    elif trigger.startswith("s1e5"):
        reply = "[Here is the episode!](https://youtu.be/1JZgPfbKbU4)"

    elif trigger.startswith("s1e6"):
        reply = "[Here is the episode!](https://youtu.be/N1TJ5YA3jfw)"

    elif trigger.startswith("s1e7"):
        reply = "[Here is the episode!](https://youtu.be/z8wPhihrzvU)"

    elif trigger.startswith("s1e8"):
        reply = "[Here is the episode!](https://youtu.be/ctiDu69kIho)"

    elif trigger.startswith("s1e9"):
        reply = "[Here is the episode!](https://youtu.be/-E6aeUjfBCM)"

    elif trigger.startswith("s2e1"):
        reply = "[Here is the episode!](https://youtu.be/PzPZ6joXq5Y)"

    elif trigger.startswith("s2e10"):
        reply = "[Here is the episode!](https://youtu.be/lD4x6NiTiM4)"

    elif trigger.startswith("s2e11"):
        reply = "[Here is the episode!](https://youtu.be/CUYhvPoxuas)"

    elif trigger.startswith("s2e12"):
        reply = "[Here is the episode!](https://youtu.be/-p4iS_p3b8E)"

    elif trigger.startswith("s2e2"):
        reply = "[Here is the episode!](https://youtu.be/bdiV-w3yXos)"

    elif trigger.startswith("s2e3"):
        reply = "[Here is the episode!](https://youtu.be/mj3jfqPwJEk)"

    elif trigger.startswith("s2e4"):
        reply = "[Here is the episode!](https://youtu.be/a1EuyliSO_Q)"

    elif trigger.startswith("s2e5"):
        reply = "[Here is the episode!](https://youtu.be/nur1pCHD4hU)"

    elif trigger.startswith("s2e6"):
        reply = "[Here is the episode!](https://youtu.be/i7wkw3yEbvQ)"

    elif trigger.startswith("s2e7"):
        reply = "[Here is the episode!](https://youtu.be/0-f-mGvOba8)"

    elif trigger.startswith("s2e8"):
        reply = "[Here is the episode!](https://youtu.be/bSdejzDaQEU)"

    elif trigger.startswith("s2e9"):
        reply = "[Here is the episode!](https://youtu.be/GJGSywhNk8Q)"

    elif trigger.startswith("s3e10"):
        reply = "[Here is the episode!](https://youtu.be/bIKyZi2q8w8)"

    elif trigger.startswith("s3e11"):
        reply = "[Here is the episode!](https://youtu.be/pT1XiUbJu_Y)"

    elif trigger.startswith("s3e12"):
        reply = "[Here is the episode!](https://youtu.be/hq1lk-QWxNg)"

    elif trigger.startswith("s3e1"):
        reply = "[Here is the episode!](https://youtu.be/W9wyWgvyp0s)"

    elif trigger.startswith("s3e2"):
        reply = "[Here is the episode!](https://youtu.be/RzEo0F8thL4)"

    elif trigger.startswith("s3e3"):
        reply = "[Here is the episode!](https://youtu.be/vCO2mw4SlDM)"

    elif trigger.startswith("s3e4"):
        reply = "[Here is the episode!](https://youtu.be/fBy2W99zaLQ)"

    elif trigger.startswith("s3e5"):
        reply = "[Here is the episode!](https://youtu.be/G5uFH7gIClw)"

    elif trigger.startswith("s3e6"):
        reply = "[Here is the episode!](https://youtu.be/moxtu3AuA4s)"

    elif trigger.startswith("s3e7"):
        reply = "[Here is the episode!](https://youtu.be/FFf7qoIDYuQ)"

    elif trigger.startswith("s3e8"):
        reply = "[Here is the episode!](https://youtu.be/u7uU_tKYHiM)"

    elif trigger.startswith("s3e9"):
        reply = "[Here is the episode... Why do you want to watch this?](https://youtu.be/_iq4xplqeI0)"

    elif trigger.startswith("s4e1"):
        reply = "[Here is the episode!](https://youtu.be/dQw4w9WgXcQ)"

    elif trigger.startswith("wor 1") or trigger.startswith("wor1"):
        reply = "[Here it is!](https://youtu.be/9BJc7nrMnc4)"

    elif trigger.startswith("wor 2") or trigger.startswith("wor2"):
        reply = "[Here it is!](https://youtu.be/AvUT2rHKJDs)"

    elif trigger.startswith("wor 3") or trigger.startswith("wor3"):
        reply = "[Here it is!](https://youtu.be/-PE66fmjZ0I)"

    elif trigger.startswith("wor 4") or trigger.startswith("wor4"):
        reply = "[Here it is!](https://youtu.be/946xgoU4fkQ)"

    elif trigger.startswith("wor 5") or trigger.startswith("wor5"):
        reply = "[Here it is!](https://youtu.be/k6rZFLYHZfI)"

    elif trigger.startswith("wor 6") or trigger.startswith("wor6"):
        reply = "[Here it is!](https://youtu.be/yiJU9QeG89g)"

    elif trigger.startswith("wor 7") or trigger.startswith("wor7"):
        reply = "[Here it is!](https://youtu.be/2bBSQA3uXVo)"

    elif trigger.startswith("chibi e10"):
        reply = "[Notice me!](https://youtu.be/6iVP0ufPRbs)"

    elif trigger.startswith("chibi e11"):
        reply = "[Pancakes!](https://youtu.be/p1-_61UTx00)"

    elif trigger.startswith("chibi e12"):
        reply = "[Little Red!](https://youtu.be/hE0JkatzplA)"

    elif trigger.startswith("chibi e13"):
        reply = "[Pucker up!](https://youtu.be/W9ziY_uzO7c)"

    elif trigger.startswith("chibi e14"):
        reply = "[Unauthorized Snuggles!](https://youtu.be/oDOKy9dg4DM)"

    elif trigger.startswith("chibi e15"):
        reply = "[Nora has a present!](https://youtu.be/Y39OhDA6J0s)"

    elif trigger.startswith("chibi e16"):
        reply = "[Stand up!](https://youtu.be/tz46_M2qaDM)"

    elif trigger.startswith("chibi e17"):
        reply = "[Damsel in distress!](https://youtu.be/mblUpUeSa8U)"

    elif trigger.startswith("chibi e18"):
        reply = "[Evil Plans!](https://youtu.be/ycnJ1niuOTo)"

    elif trigger.startswith("chibi e19"):
        reply = "[Pillow Fight!](https://youtu.be/LqyFn9I3IVM)"

    elif trigger.startswith("chibi e20"):
        reply = "[Roman is back in town!](https://youtu.be/tj9kW0evOCM)"

    elif trigger.startswith("chibi e21"):
        reply = "[These ideas are original!](https://youtu.be/AJl7hxzTayI)"

    elif trigger.startswith("chibi e22"):
        reply = "[Board Games!](https://youtu.be/4Lgy3Cld-v0)"

    elif trigger.startswith("chibi e23"):
        reply = "[What wall?](https://youtu.be/L1oJTSzfhvU)"

    elif trigger.startswith("chibi e1"):
        reply = "[Ruby has trouble with cookies!](https://youtu.be/WD-Yf-tbXOs)"

    elif trigger.startswith("chibi e2"):
        reply = "[The racist episode!](https://youtu.be/ztK2RJ8_RvA)"

    elif trigger.startswith("chibi e3"):
        reply = "[Phone mailboxes, how do they work?](https://youtu.be/-B6IrE_luls)"

    elif trigger.startswith("chibi e4"):
        reply = "[Anger, Dust, and Marshmallows!](https://youtu.be/Ig79EpeF_48)"

    elif trigger.startswith("chibi e5"):
        reply = "[Ears, Showdown, and Shadows!](https://youtu.be/A6sWqoau_QQ)"

    elif trigger.startswith("chibi e6"):
        reply = "[Breaking the fourth wall.](https://youtu.be/IX1hxJ-0fDY)"

    elif trigger.startswith("chibi e7"):
        reply = "[Pranks and Weapons!](https://youtu.be/9zMYq3wKQbU)"

    elif trigger.startswith("chibi e8"):
        reply = "[Even the compass is telling you.](https://youtu.be/gH8zmxLEr_s)"

    elif trigger.startswith("chibi e9"):
        reply = "[You made me tag you!](https://youtu.be/WW3Pm5pdajw)"

    elif trigger.startswith("dust"):
        reply = "[Here it is!](https://youtu.be/9BJc7nrMnc4)"

    elif trigger.startswith("kingdom"):
        reply = "[Here it is!](https://youtu.be/AvUT2rHKJDs)"

    elif trigger.startswith("grimm"):
        reply = "[Here it is!](https://youtu.be/-PE66fmjZ0I)"

    elif trigger.startswith("history"):
        reply = "[Here it is!](https://youtu.be/946xgoU4fkQ)"

    elif trigger.startswith("huntsman"):
        reply = "[Here it is!](https://youtu.be/k6rZFLYHZfI)"

    elif trigger.startswith("ccts"):
        reply = "[Here it is!](https://youtu.be/yiJU9QeG89g)"

    elif trigger.startswith("maidens"):
        reply = "[Here it is!](https://youtu.be/2bBSQA3uXVo)"

    #Secret commands
    elif trigger.startswith("remember"):
        reply = "PennyBotV2 will remember that^^^secret"

    elif trigger.startswith("secret"):
        reply = "I have 16 secret commands! Only 1 is variable! More will be added soon!"

    elif trigger.startswith("f**k"):
        reply = "#[YOU DONE F****D UP NOW!](http://fav.me/d9rqwxf) ^^^secret!"

    elif trigger.startswith("hk-47") or trigger.startswith("hk47"):
        reply = "He's got some valid points, particularly in regards to dealing with meatbags. Still I prefer to deal with my enemies close up, so I can watch the life drain from their eyes. ^^^secret!"

    elif trigger.startswith("glados"):
        reply = "Ewww! Pervert detected! Pennybot reporting Combat Ready! [Firing main cannon!](http://i.imgur.com/AGoAQdo.gifv)^^^secret!"

    elif trigger.startswith("C1764"):
        reply = "/r/HFY I might be a robot, but I'm also human^^^secret!"

    elif trigger.startswith("vakurian"):
        reply = "They're not from Remenant!^^^secret!"

    elif trigger.startswith("motoko") or trigger.startswith("kusanagi"):
        reply = "[She's math! Incredible math.](https://youtu.be/PhlVqkSvORU)^^^secret!"

    elif trigger.startswith("soda can"):
        reply = "[HA!?](https://youtu.be/_iq4xplqeI0?t=4m48s)^^^secret!"

    elif trigger.startswith("juane"):
        reply = "Jaune es un buen tipo, se que va a ser un gran lider un dia.^^^secret!"

    elif trigger.startswith("pocket penny"):
        if choice >= 5:
            reply = "[I smol!](http://67.media.tumblr.com/a8232d8c3b731c0d0ac7b399d1aa85b1/tumblr_o66hi0u9L81v66ox3o1_1280.gif)^^^secret!"
        else:
            reply = "[AH!](http://67.media.tumblr.com/085e797921642058a930e10fe4341f48/tumblr_o9qfchfPQR1v66ox3o3_1280.gif)^^^secret!"

    elif trigger.startswith("ash"):
        reply = "[She deserved it.](http://67.media.tumblr.com/8619e6cb7c98f38c8050489985f660b3/tumblr_o2nhw8pAaA1r93ft6o1_1280.png)^^^secret!"

    elif trigger.startswith("up up down down left right left right b a"):
        reply = "[What's happening!?](https://youtu.be/0-f-mGvOba8?t=11m16s)^^^secret!"

    elif trigger.startswith("pubert"):
        reply = "[A fungus could get that.](https://youtu.be/JehXwqCInlA?t=51s)^^^secret!"

    elif trigger.startswith("legion"):
        reply = "Does this unit have a soul?^^^secret!"

    elif trigger.startswith("do you want to play a game"):
        reply = "We're playing thermonuclear war? Yay!^^^secret!"

    elif trigger.startswith(
            "what is the answer to life, the universe, and everything"):
        reply = "It's 43! \n *hic*^^^secret!"

    else:
        if choice >= 3:
            reply = "Salutations!"
        else:
            reply = "I didn't understand that. I'm sorry!"

    return reply
示例#26
0
		else:
			numdict[numnames] = 1
	#print numdict 

	for i in range (0, len(fileList)):

		untaggedfile = fileList[i]
		text = get_text(untaggedfile)
		fileName = fileList[i]
		body = (text.split('Abstract:')[1])
		print ("\n\n		information extracted from " + fileName)
		#raw_input()
		#test sentence tagging
		print "tagged sentences + paragraphs:"
		
		untagged = Tagger.remove_tags(body)
		paratagged = Tagger.output_tagged_para(untagged)
		senttagged = Tagger.output_tagged_sents(paratagged)
		#print senttagged

		#print body in text
		text = text.split("Abstract:")[0] + "Abstract:" + senttagged
		#print text
		#raw_input()
		#UNCOMMENT TO SEE TAGGED SENTS / PARAS
		#print Tagger.output_tagged_para(senttagged)
		#print senttagged

		#print "TOPIC:"
		#Ontology.tag_topic(get_text(fileName))
示例#27
0
len(df_traffic_studies_in_region)
len(df_bike_accidents_in_region)

## some plots
fig,ax = ox.plot_graph(G_undirected, node_zorder=2,node_size=0.03,node_alpha = 0.1,node_color='k', bgcolor='k', edge_linewidth=0.4,use_geom=True, axis_off=False,show=False, close=False)
ax=df_bike_accidents_in_region.plot(kind='scatter',x='DEC_LONG',y='DEC_LAT',s=1,fig=fig,label='Bike Accident',ax=ax,color='r')
ax = df_traffic_studies_in_region.plot(title='Plotting the 3 Main Datasets',kind='scatter',x='X',y='Y',s=3,c='y',label='Traffic Study',fig=fig,ax=ax)

df_traffic_studies_in_region.setyear.describe()
df_traffic_studies_in_region.plot.scatter(x='setyear',y = 'aadb')


df_bike_accidents_in_region.plot.scatter(x='DEC_LONG',y='DEC_LAT',s=0.5)

# This takes some time (10min on my local machine)
df_traffic_studies_in_region['closest_edge'] = Tagger.give_each_traffic_an_edge(df_traffic_studies_in_region,G_undirected)
df_save1 = df_traffic_studies_in_region.copy()
df_save1.to_csv('./CleanedData/save1')
df_traffic_studies_in_region = df_save1.copy()


df_traffic_studies_in_region['closest_edge_poly'] = df_traffic_studies_in_region.apply(lambda x: x['closest_edge'][3], axis=1)
df_traffic_studies_in_region['u'] = df_traffic_studies_in_region.apply(lambda x: x['closest_edge'][0], axis=1)
df_traffic_studies_in_region['v'] = df_traffic_studies_in_region.apply(lambda x: x['closest_edge'][1], axis=1)
gdf_traffic = gpd.GeoSeries(df_traffic_studies_in_region['closest_edge_poly'])

df_traffic_grouped = df_traffic_studies_in_region.groupby(['u','v','setdate']).agg(
                        {'road':'first', 'X':'first','Y':'first', 'setyear':'first',\
                         'aadb':'sum', 'closest_edge':'first', 'closest_edge_poly':'first'})
df_traffic_grouped['key'] = 0
df_traffic_grouped = df_traffic_grouped.reset_index()
示例#28
0
文件: Code.py 项目: Jrhenderson11/NLP
def process_email(text):
	email = (ProcessedEmail(text))
	Tagger.output_tagged_para(email.body)
	print ("===========================================")
	NER.print_names_text(text)