# HG changeset patch # User Joseph Turian # Date 1226986359 18000 # Node ID 90a76a8238e8727a3347f94328b9ffc66b88464c # Parent 844bad76459ce86f1236747568f988d425a266f1 Added function length() diff -r 844bad76459c -r 90a76a8238e8 embeddings/process.py --- a/embeddings/process.py Mon Nov 17 14:18:28 2008 -0500 +++ b/embeddings/process.py Tue Nov 18 00:32:39 2008 -0500 @@ -11,6 +11,12 @@ __word_to_embedding = None __read = False +def length(): + """ + @return: The length of embeddings + """ + len(__word_to_embedding[0]) + def word_to_embedding(w): read_embeddings() return __word_to_embedding[w] @@ -39,6 +45,7 @@ w = __words[i] __word_to_embedding[w] = l __read = True + for w in __word_to_embedding: assert len(__word_to_embedding[__words[0]]) == len(__word_to_embedding[w]) sys.stderr.write("...done reading %s\n" % WEIGHTSFILE) import re