Пример #1
0
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)
Пример #2
0
 def topic_vector(self, words):
     return np.array([
         v for k, v in self._lda.__getitem__(
             self._dictionary.doc2bow(common.filter(words)), eps=0)
     ])
Пример #3
0
 def topics(self, words):
     return self._lda[self._dictionary.doc2bow(common.filter(words))]
Пример #4
0
 def topic_vector(self, words):
     return np.array([v for k, v in self._lda.__getitem__(self._dictionary.doc2bow(common.filter(words)), eps=0)])
Пример #5
0
 def topics(self, words):
     return self._lda[self._dictionary.doc2bow(common.filter(words))]
Пример #6
0
 def search(self, search_text):
     return list(common.filter(search_text, self.items))