Skip to content

Instantly share code, notes, and snippets.

View mac389's full-sized avatar

Michael Chary mac389

View GitHub Profile
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 62 columns, instead of 46. in line 1.
,opioid,serotonergic,unclear,cardioactive,antibiotic/antifungal,ssri,ergot,anti-inflammatory,mushrooms,anticoagulant,neurotoxin,misclassified,antacid,stimulants,moiety,snakes,sexual enhancement,salicylate,alcohol,chemical process,cholinergic plant,dopamine agonist,paralytic,abortifacient,analgesic,anticholinergic medicine,maoi,functional class,plant,chemotherapeutic,nsaid,cyanogenic,anesthetic,hepatotoxin,anabolic hormones,antinausea,antihyperglycemic,hiv medications,nonopioid analgesic,inhalant,psychedelic,antipsychotic,bulking agent,serm,metabolite,cannabinoid receptor agonists,endogenous chemical,sedative,antidepressant,structural class,chemical reagent,androgen/estrogen,uncoupler,steroid,nootropic,acetaminophen-containing,element,tricyclic antidepressants,antithyroid,nmda antagonist,vasoactive
opioid,6416.0,5.0,0.0,29.0,31.0,55.0,18.0,18.0,1.0,0.0,0.0,0.0,4.0,1613.0,103.0,0.0,0.0,1.0,51.0,0.0,2.0,5.0,2.0,1.0,4.0,124.0,69.0,296.0,45.0,21.0,13.0,0.0,16.0,1.0,9.0,8.0,1.0,9.0,1.0,17.0,1482.0,43.0,3.0,0.0,33.0
@mac389
mac389 / pubmed_search.py
Created November 8, 2015 21:45 — forked from langner/pubmed_search.py
A class that searches Pubmed for a list of PMIDs via the BioPython Entrez module and returns the results in a simpler dictionary format.
"""Tools for searching Pubmed for a list of PMIDs.
The goal here is to search for many PMIDs at once, since searching
sequentially can take a long time. Using the the BioPython Entrez module
is super convenient to this end.
The results results are returned in a simple dictionary format.
"""
import json
import nltk
#import matplotlib.pyplot as plt
#import utils as tech
from nltk.corpus import stopwords
from nltk import bigrams,trigrams
from pprint import pprint
//
// MasterViewController.swift
// beta
//
// Created by Michael Chary on 5/25/15.
// Copyright (c) 2015 Michael Chary. All rights reserved.
//
import UIKit
import AudioToolbox
//
// SecondViewController.swift
// swiftTest
//
// Created by Michael Chary on 5/24/15.
//
//
import UIKit
import CoreGraphics
@mac389
mac389 / gist:7004a531b18e6fa40747
Created April 4, 2015 17:02
MetaphorandVerbnet (draft)
import nltk
from nltk.draw.util import CanvasFrame
from nltk.draw import TreeWidget
from nltk import Tree, word_tokenize,load_parser
from nltk.corpus import verbnet as vn
from nltk.corpus import wordnet as wn
from nltk.wsd import lesk
from nltk.corpus import framenet as fn
from pprint import pprint
from awesome_print import ap
'''
@date Jan 17, 2010
@author: mjbommar (c) 2010
Free to use for non-commerical purposes. Attribution appreciated :)
'''
import igraph
import Image, ImageDraw
import os, os.path
import nltk, os, json, csv
from scipy.stats import scoreatpercentile
#read the stopwrod file
#do stopwords have to be in the same file as the json files?
READ = 'rb'
stopwords = open('../data/stopwords',READ).readlines()
#lemmatizer
lmtzr = WordNetLemmatizer()
import json, os
from api.Twitter import Twitter
from nlp import SemanticDistance as SD
from nlp.json_to_text import TwitterRecord
from visualization.visualization import SemanticVisualization
keywords = ['alcohol']
trigger = '-'.join(keywords)
@mac389
mac389 / gist:6371712
Created August 28, 2013 21:42
Better NB classifier that uses our curated list of stopwords
require 'rubygems'
require 'stuff-classifier'
require 'spreadsheet'
toxifier = StuffClassifier::TfIdf.new("tox")
rating = {'0' => :no, '1' => :yes, '2' =>:maybe}
toxifier.ignore_words = File.readlines('stopwords')
curated_data = File.readlines('alcohol_MC.txt')
curated_data.each do |spread|