def _process_maybe_work(self, yes_work, maybe_work, work_dir,
                            yn_results_path, stats):
        """Returns statistics of how `yes_work` compares with `maybe_work`.

        :param yes_work: name of work for which stats are collected
        :type yes_work: `str`
        :param maybe_work: name of work being compared with `yes_work`
        :type maybe_work: `str`
        :param work_dir: directory where generated files are saved
        :type work_dir: `str`
        :param yn_results_path: path to results intersecting
                                `yes_work` with "no" works
        :type yn_results_path: `str`
        :param stats: data structure to hold statistical data of the
                      comparison
        :type stats: `dict`
        :rtype: `dict`

        """
        if maybe_work == yes_work:
            return stats
        self._logger.info(
            'Processing "maybe" work {} against "yes" work {}.'.format(
                maybe_work, yes_work))
        # Set base values for each statistic of interest, for each
        # witness.
        for siglum in self._corpus.get_sigla(maybe_work):
            witness = (maybe_work, siglum)
            stats[COMMON][witness] = 0
            stats[SHARED][witness] = 0
            stats[UNIQUE][witness] = 100
        works = [yes_work, maybe_work]
        # Sort the works to have a single filename for the
        # intersection each pair of works, whether they are yes or
        # maybe. This saves repeating the intersection with the roles
        # switched, since _run_query will use a found file rather than
        # rerun the query.
        works.sort()
        ym_results_path = os.path.join(
            self._ym_intersects_dir, '{}_intersect_{}.csv'.format(*works))
        stats = self._process_intersection(yes_work, maybe_work, work_dir,
                                           ym_results_path, stats)
        stats = self._process_diff(yes_work, maybe_work, work_dir,
                                   ym_results_path, yn_results_path, stats)
        return stats
def _process_maybe_work ( self , yes_work , maybe_work , work_dir , yn_results_path , stats ) : if maybe_work == yes_work : return stats self . _logger . info ( 'Processing "maybe" work {} against "yes" work {}.' . format ( maybe_work , yes_work ) ) for siglum in self . _corpus . get_sigla ( maybe_work ) : witness = ( maybe_work , siglum ) stats [ COMMON ] [ witness ] = 0 stats [ SHARED ] [ witness ] = 0 stats [ UNIQUE ] [ witness ] = 100 works = [ yes_work , maybe_work ] works . sort ( ) ym_results_path = os . path . join ( self . _ym_intersects_dir , '{}_intersect_{}.csv' . format ( * works ) ) stats = self . _process_intersection ( yes_work , maybe_work , work_dir , ym_results_path , stats ) stats = self . _process_diff ( yes_work , maybe_work , work_dir , ym_results_path , yn_results_path , stats ) return stats
Returns statistics of how `yes_work` compares with `maybe_work`.

        :param yes_work: name of work for which stats are collected
        :type yes_work: `str`
        :param maybe_work: name of work being compared with `yes_work`
        :type maybe_work: `str`
        :param work_dir: directory where generated files are saved
        :type work_dir: `str`
        :param yn_results_path: path to results intersecting
                                `yes_work` with "no" works
        :type yn_results_path: `str`
        :param stats: data structure to hold statistical data of the
                      comparison
        :type stats: `dict`
        :rtype: `dict`