# Path: csc/divisi/cnet.py

# 
# Path: csc/divisi/labeled_tensor.py
# class OldDenseLabeledTensor(LabeledView):
# class OldSparseLabeledTensor(LabeledView):
#     def __repr__(self):
#     def __init__(self, *a, **kw):
#     def __repr__(self):
#     def dot(self, other):
#     def array_op(self, ufunc, *others):
#         def take_data(tensor):
#     def slice(self, mode, label):
#     def dense_slice(self, mode, label):
#     def load(cls, filebase):
# 
# Path: csc/divisi/util.py

# 
# Path: csc/divisi/export_svdview.py
# def denormalize(concept_text):
# def null_denormalize(x): return x
# def _sorted_rowvectors(m, denormalize, num_dims):
#     def fix_concept(c):
# def write_tsv(matrix, outfn, denormalize=None, cutoff=40):
# def write_packed(matrix, out_basename, denormalize=None, cutoff=40):
# def write_annotated(matrix, out_basename, denormalize=None, cutoff=40,
# filter=None, annotations=None, links=None):
# def add_link_2way(links, source, target):
# def feature_str(feature):
# def svdview_single_tensor(tensor, out_basename):


from csc.divisi.cnet import conceptnet_2d_from_db #, conceptnet_2d_from_db_tuple
from csc.divisi.labeled_tensor import SparseLabeledTensor
from csc.divisi.util import get_picklecached_thing
from csc.divisi.export_svdview import export_svdview
import cPickle as pickle
import gzip, os

#os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'csamoa.settings')

def pickledump(filename, obj):
    if not isinstance(filename, basestring):
        filename, obj = obj, filename
    f = gzip.open(filename, 'wb')
    pickle.dump(obj, f)
    f.close()

def normalize_and_copy(tensor):

# Path: csc/divisi/cnet.py

# 
# Path: csc/divisi/labeled_tensor.py
# class OldDenseLabeledTensor(LabeledView):
# class OldSparseLabeledTensor(LabeledView):
#     def __repr__(self):
#     def __init__(self, *a, **kw):
#     def __repr__(self):
#     def dot(self, other):
#     def array_op(self, ufunc, *others):
#         def take_data(tensor):
#     def slice(self, mode, label):
#     def dense_slice(self, mode, label):
#     def load(cls, filebase):
# 
# Path: csc/divisi/util.py

# 
# Path: csc/divisi/export_svdview.py
# def denormalize(concept_text):
# def null_denormalize(x): return x
# def _sorted_rowvectors(m, denormalize, num_dims):
#     def fix_concept(c):
# def write_tsv(matrix, outfn, denormalize=None, cutoff=40):
# def write_packed(matrix, out_basename, denormalize=None, cutoff=40):
# def write_annotated(matrix, out_basename, denormalize=None, cutoff=40,
# filter=None, annotations=None, links=None):
# def add_link_2way(links, source, target):
# def feature_str(feature):
# def svdview_single_tensor(tensor, out_basename):


# Path: csc/divisi/blending.py
from csc.divisi.cnet import conceptnet_2d_from_db #, conceptnet_2d_from_db_tuple
from csc.divisi.labeled_tensor import SparseLabeledTensor
from csc.divisi.util import get_picklecached_thing
from csc.divisi.export_svdview import export_svdview
import cPickle as pickle
import gzip, os


#os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'csamoa.settings')

def pickledump(filename, obj):
    if not isinstance(filename, basestring):
        filename, obj = obj, filename
    f = gzip.open(filename, 'wb')
    pickle.dump(obj, f)
    f.close()

def normalize_and_copy(tensor):

    newt = SparseLabeledTensor(ndim=2)