Skip to content

Instantly share code, notes, and snippets.

View rg089's full-sized avatar
:octocat:

Rishabh rg089

:octocat:
View GitHub Profile
{
"width":{
"acl":455.244,
"ieee":516.0
}
}
@rg089
rg089 / latex_plots.txt
Last active January 11, 2023 14:06
Style for latex plots in matplotlib/seaborn. Adapted from: http://aeturrell.com/2018/01/31/publication-quality-plots-in-python/. Reference: https://matplotlib.org/stable/tutorials/introductory/customizing.html for the meaning of parameters.
# FONT
font.size: 10
font.family: STIXGeneral
# AXES
axes.titlesize: 11
axes.titlepad: 3.5
axes.titleweight: bold
@rg089
rg089 / contractions.json
Last active December 1, 2021 10:44
A dictionary of contractions for easy removal
{"ain't": "is not", "aren't": "are not", "can't": "cannot", "'cause": "because", "could've": "could have", "couldn't": "could not", "didn't": "did not", "doesn't": "does not", "don't": "do not", "hadn't": "had not", "hasn't": "has not", "haven't": "have not", "he'd": "he would","he'll": "he will", "he's": "he is", "how'd": "how did", "how'd'y": "how do you", "how'll": "how will", "how's": "how is", "I'd": "I would", "I'd've": "I would have", "I'll": "I will", "I'll've": "I will have","I'm": "I am", "I've": "I have", "i'd": "i would", "i'd've": "i would have", "i'll": "i will", "i'll've": "i will have","i'm": "i am", "i've": "i have", "isn't": "is not", "it'd": "it would", "it'd've": "it would have", "it'll": "it will", "it'll've": "it will have","it's": "it is", "let's": "let us", "ma'am": "madam", "mayn't": "may not", "might've": "might have","mightn't": "might not","mightn't've": "might not have", "must've": "must have", "mustn't": "must not", "mustn't've": "must not have", "needn't": "need not", "needn'
from datetime import datetime
def convert_to_datetime(articles):
"""
converts the field 'time' in each article from a string to python datetime objects
@params
articles: a list of dictionaries obtained from the API
returns: a list of dictionaries with time processed to datetime objects
"""
import requests
url = "http://www.newsemble.ml/news/"
data = requests.get(url).json()
@rg089
rg089 / stopwords.txt
Created July 15, 2021 14:48
A List of English Stopwords
0o
0s
3a
3b
3d
6b
6o
a
a1
a2