def data(data, discard = False): """Install data: performs just a copy for a plain file, performs a recursive copy for a directory. If discard is given, it contains files to discard from the installation. Discard may a string (a file system regular expression), a list of paths or a function that must takes as parameter a path and return true (keep) or false (discard).""" # check if the path can be computed data = recipe.get_file(data) if not data.INSTALL_TO and not data.PROJECT: common.script_error("to install data, one of PROJECT or INSTALL_TO is required!") # build the rule data = recipe.get_file(data) target = file(data.path.make("install-data-")) action = InstallData(data, common.filter(discard)) recipe.phony([target], [data], action) std.INSTALL.append(target)
def topic_vector(self, words): return np.array([ v for k, v in self._lda.__getitem__( self._dictionary.doc2bow(common.filter(words)), eps=0) ])
def topics(self, words): return self._lda[self._dictionary.doc2bow(common.filter(words))]
def topic_vector(self, words): return np.array([v for k, v in self._lda.__getitem__(self._dictionary.doc2bow(common.filter(words)), eps=0)])
def search(self, search_text): return list(common.filter(search_text, self.items))