This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
from bs4.element import Comment | |
import requests | |
def tag_visible(element): | |
if element.parent.name in ['script', 'style', 'head', 'title', 'meta', '[document]']: | |
return False | |
if isinstance(element, Comment): | |
return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gensim.models import Word2Vec | |
# from tests import get_all_text | |
def save_model(): | |
# define training data | |
sentences = get_all_text() | |
# print(sentences) | |
# train model | |
model = Word2Vec(sentences, min_count=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from utils import save_to_db, get_topics, get_companies, get_products | |
from tweet_collector.request import collector | |
import csv | |
import requests | |
def get_profiles_from_file(source): | |
""" | |
takes the source file location and extracts all the twitter profiles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
def read_csv(filename="freq.csv"): | |
""" | |
reads a csv file and returns the object | |
:param filename: csv file to be read | |
:return: csv object | |
""" | |
csv_content = [] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from parse import find_posts, set_filename | |
import sys | |
import os | |
import string | |
from bs4 import BeautifulSoup | |
def format_filename(s): | |
""" | |
Take a string and return a valid filename constructed from the string. |
We can't make this file beautiful and searchable because it's too large.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_unit_id,_created_at,_golden,_id,_missed,_started_at,_tainted,_channel,_trust,_worker_id,_country,_region,_city,_ip,the_author_of_the_tweet_seems_to_be_an_eye_witness_of_the_event,type_of_message,nil,the_author_of_the_tweet_seems_to_be_an_eye_witness_of_the_event_gold,tweet,tweet_no,tweet_no_rt,type_of_message_gold,user | |
238841781,12/24/2012 13:41:45,false,787060207,,12/24/2012 13:37:36,false,instagc,0.7333,14425455,USA,MI,Rochester,69.136.129.135,,Informative: other,,,important --> @JebBush suggests federal gov't not crucial to storm recovery http://t.co/pVsV6qoS #haction #2012 #sandy,11899,important --> @JebBush suggests federal gov't not crucial to storm recovery http://t.co/pVsV6qoS #haction #2012 #sandy,,danholler | |
238841781,12/24/2012 13:44:17,false,787063467,,12/24/2012 13:39:45,false,instagc,0.8333,13441146,USA,GA,Cleveland,98.18.108.46,,"Informative: offers/gives donations of money, goods, or free services",,,important --> @JebBush suggests federal gov't not crucial to storm recovery http://t. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Code to open a pgz window | |
""" | |
import pgzrun | |
WIDTH = 800 | |
HEIGHT = 500 | |
BLACK = (0, 0, 0) | |
def draw(): # Pygame Zero draw function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pgzrun | |
from random import randint, choice | |
import string | |
WIDTH = 800 | |
HEIGHT = 500 | |
VELOCITY = 1 | |
BLACK = (0, 0, 0) | |
WHITE = (255, 255, 255) | |
LETTER = {"letter": "", "x": 0, "y": 0} |