Skip to content

Instantly share code, notes, and snippets.

View djokester's full-sized avatar
🎯
Focusing

Samriddhi Sinha djokester

🎯
Focusing
View GitHub Profile
julia> Pkg.clone("https://github.com/JuliaText/TextAnalysis.jl")
┌ Warning: Pkg.clone is only kept for legacy CI script reasons, please use `add`
└ @ Pkg.API /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:391
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Cloning git-repo `https://github.com/JuliaText/TextAnalysis.jl`
Updating git-repo `https://github.com/JuliaText/TextAnalysis.jl`
Resolving package versions...
Installed Requires ──────────────────── v0.5.2
Installed Reexport ──────────────────── v0.2.0
@djokester
djokester / output.json
Last active June 3, 2019 15:09
Updated
[{'Hey': 'Hey'}, {'head': 'Nigel Adkins stabbed in the back by Southampton as Argentina Mauricio Pochettino steps in as manager', 'body': 'The Premier League soap opera contained a particularly brutal and bizarre episode at St Mary’s on Friday. Adding to the sense of betrayal of Adkins was the revelation from his successor, Mauricio Pochettino, that he had been researching Southampton’s squad for “several weeks”. The former Espanyol coach also consulted distinguished La Liga coaches as he assessed the Southampton job.', 'author': 'By Henry Winter', 'source': '', 'time': 'Jun 01, 2019', 'link': 'https://www.telegraph.co.uk/sport/football/teams/southampton/9810861/Nigel-Adkins-stabbed-in-the-back-by-Southampton-as-Argentina-Mauricio-Pochettino-steps-in-as-manager.html'}, {'head': 'Head coach Maurizio Sarri Sarri nearer to Chelsea exit', 'body': 'Sarri led Chelsea to victory in the Europa League finalHarold Cunningham/Getty ImagesMaurizio Sarri will hold further talks with Chelsea about his future today after a
from sklearn.cluster import KMeans
from sklearn import metrics
import pylab as pl
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
kmeans_model = KMeans(n_clusters= 60, init='k-means++', max_iter=100)
X = kmeans_model.fit(model.docvecs.doctag_syn0)
labels= kmeans_model.labels_.tolist()
l = kmeans_model.fit_predict(model.docvecs.doctag_syn0)
import gensim
model = gensim.models.Doc2Vec(vector_size= 200, window= 3, min_count= 0, workers=4, epochs= 40)
model.build_vocab(docs)
model.train(docs, total_examples=model.corpus_count, epochs=model.iter)
from nltk import word_tokenize
from nltk.corpus import stopwords
from gensim import models
from gensim.models.doc2vec import TaggedDocument
#Function for normalizing paragraphs.
def normalize(string):
lst = word_tokenize(string)
lst =[word.lower() for word in lst if word.isalpha()]
lst = [w for w in lst if not w in stopwords.words('english')]
return(lst)
#Assigning question to topics.
question_list = []
final_topic_list = []
for topic in topic_list:
temp = []
for question in questions:
context = [i["name"] for i in question["topics"]]
if topic in context:
temp.append(question['question_text'])
if len(temp) >= 5:
@djokester
djokester / QuoraAnswered2.py
Created August 7, 2018 06:37
Aggregating Topics
# Create the list of topics
topic_list = []
for question in questions:
if len(question["topics"]) > 0:
for topic in question["topics"]:
topic_list = topic_list + [topic["name"]]
topic_list = list(set(topic_list))
print(len(topic_list))
@djokester
djokester / QuoraAnswered1.py
Last active August 7, 2018 06:23
Reading from the data files for the challenge
import json
f = open("answered_data_10k.in").read().split("\n")
train_set = f[1:9001]
test_set = f[9002:-1]
train = [json.loads(i) for i in train_set]
test = [json.loads(i) for i in test_set]
questions = train + test

100 Days Of ML Code - Example Log

Use this as a base template. Create your own repository on GitHub and start logging your work daily!

Day 0: February 29, 2016 (Example 1)

(delete me or comment me out)

Today's Progress: Fixed CSS, worked on canvas functionality for the app.

Thoughts: I really struggled with CSS, but, overall, I feel like I am slowly getting better at it. Canvas is still new for me, but I managed to figure out some basic functionality.

@djokester
djokester / JOINCorrect
Created May 27, 2017 11:29
Corrections for JOIN
Sentences with -JOIN in them
JOIN
जम्मू -कश्मीर हाईकोर्ट में दर्ज शिकायत में हिंदू समुदाय के लोगों की भावनाओं को ठेस पहुंचाने का आरोप लगाया गया है ।
किस्तवार के नागरिकों द्वारा दर्ज याचिका में राज्य सरकार , प्रदेश के मुख्य सचिव , पर्यटन विभाग के आयुक्त - सचिव और निदेशक को भी मामले में नामित किया गया है ।
आरआईएल एक पाइपलाइन के जरिए गैस की आपूर्ति कृष्णा - गोदावरी के गैस फील्ड के सीमा क्षेत्र काकीनाडा से आएगी ।
वह है प्रोजेक्ट के लिए ऋण देने वाले अंतर - संस्थागत बैंक समूहों और वित्तीय संस्थानों की ओर से हरी झंडी ।
यह अलग बात है कि मुंबई में होने वाले वन - डे मैच की पूर्व संध्या पर चैपल ने इस सवाल पर फिर चुप्पी साध ली , जबकि प्रबंधन ने यह कहकर मामला समेटने की कोशिश की कि ऐसी कोई घटना हुई ही नहीं ।
गुरुद्वारा साहिबजादा अजीत सिंह फेस २ की प्रबंधक कमेटी की बैठक सोमवार को गुरुद्वारा परिसर में जोगिंदर सिंह सौंधी की अध्यक्षता में हुई .
पार्टी का कहना है कि सपा चोरी और सीना - जोरी कर रही है ।
कांग्रेस ने उप्र सरकार को सलाह दी है कि उसे इस तरह की राजनीति करने के बजाए कानून - व्यवस्था व बुनियादी सुविधाओं की तरफ ध्यान दे