Skip to content

Instantly share code, notes, and snippets.

const _prop1 = Symbol('prop1');
class Test{
constructor(prop1, prop2){
this[_prop1] = prop1;
this.prop2 = prop2;
}
}
const obj = new Test(1,2);
for(keys in obj){
console.log(keys); //doesn print _prop1 property
@AadityaJ
AadityaJ / blog1-symbol3.js
Created February 10, 2019 10:21
blog1-symbol3.js
Symbol.for('abc') === Symbol.for('abc'); //returns true
@AadityaJ
AadityaJ / blog1-symbol2.js
Created February 10, 2019 09:43
blog1-symbol2.js
const symbolX = new Symbol('X'); // throws TypeError
@AadityaJ
AadityaJ / blog1-symbol1.js
Last active February 10, 2019 09:42
Blog1 - Symbol example 1
Symbol() == Symbol(); //returns false
Symbol('test') == Symbol('test'); //returns false
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <fstream>
#include <sstream>
#include <iterator>
#include <algorithm>
using namespace std;
import numpy as np
from gensim import matutils
from gensim.models.ldamodel import LdaModel
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
from gensim.sklearn_integration.SklearnWrapperGensimLdaModel import SklearnWrapperLdaModel
## class to execute fit_predict. Will later on add to lda wrapper.
class dummy(SklearnWrapperLdaModel):
def fit_predict(self,X):
corpus=matutils.Sparse2Corpus(X)
@AadityaJ
AadityaJ / base.py
Created October 9, 2016 11:28
simple non-distributive lda wrapper for sklearn
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
#
"""
scikit learn interface for gensim for easy use of gensim with scikit-learn
"""
import numpy as np
@AadityaJ
AadityaJ / base.py
Last active October 1, 2016 20:29
Provides basics for later scikit learn interface implementation. File structure : 1)base.py and __init__.py in gensim/gensim/sklearn_integration 2)test_sklearn_integration.py added to gensim/gensim/test
"""
scikit learn interface for gensim for easy use of gensim with scikit-learn
"""
import numpy as np
class BaseClass(object):
def __init__(self):
"""init"""
def run(self):
@AadityaJ
AadityaJ / base.py
Created October 1, 2016 20:07
Provides basics for later scikit learn interface implementation. File structure
"""
scikit learn interface for gensim for easy use of gensim with scikit-learn
"""
class BaseClass(object):
def __init__(self):
"""init"""
def run(self):
return 0
@AadityaJ
AadityaJ / base.py
Created October 1, 2016 20:07
Provides basics for later scikit learn interface implementation. File structure
"""
scikit learn interface for gensim for easy use of gensim with scikit-learn
"""
class BaseClass(object):
def __init__(self):
"""init"""
def run(self):
return 0