def build_initialize(self):
"""
Initialize the corpus build.
"""
self.start_time = time.time()
self.logger.info("--- Starting ---")
self.logger.info("Building corpus %s" % self.name)
self.logger.info("Command line arguments: %s" % " ".join(sys.argv[1:]))
if not self._widget:
print("\n%s\n" % textwrap.TextWrapper(width=79).fill(" ".join(self.get_description())))
# Corpus installers may require additional modules. For example,
# Gabra is currently distributed as MongoDB files, which are read by
# using the pymongo library.
# Unless the user wishes to install only the corpus module, try to
# import these additional modules, and raise an exception if they are
# unavailable:
if not self.arguments.only_module:
for module, package, url in self.get_modules():
try:
exec("import {}".format(module))
except ImportError:
raise DependencyError(package, url)
if self.DB.db_type == SQL_MYSQL:
self.DB.connection.execute("SET NAMES 'utf8'")
self.DB.connection.execute("SET CHARACTER SET 'utf8mb4'")
self.DB.connection.execute("SET unique_checks=0")
self.DB.connection.execute("SET foreign_key_checks=0")
评论列表
文章目录