Ejemplo n.º 1
0
 def export_cooc(self,
         dataset,
         periods,
         outpath=None,
         minCooc=1
     ):
     """
     returns a text file outpath containing the db cooc
     for a list of periods ans an ngrams whitelist
     """
     self._load_config()
     storage = self.get_storage(dataset, create=True, drop_tables=False)
     if storage == self.STATUS_ERROR:
         return self.STATUS_ERROR
     if outpath is None:
         outpath = self._get_user_filepath(
             dataset,
             'cooccurrences',
             "%s-export_cooc.txt"%"+".join(periods)
         )
     whitelist = None
     if whitelistpath is not None:
         whitelist = self._import_whitelist(whitelistpath)
     exporter = Writer('coocmatrix://'+outpath)
     # is a generator
     return exporter.export_from_storage( storage, periods, minCooc )