Sha256: c37b31bbb19889d60ab0b280820d1dc5ab4d969b2649c6266f9c6d920b73efd1

Contents?: true

Size: 847 Bytes

Versions: 5

Compression:

Stored size: 847 Bytes

Contents

# coding=utf-8

__author__ = 'Josu Bermudez <josu.bermudez@deusto.es>'
__date__ = '11/29/12'

from logging import getLogger


class BaseDocument:
    """ The base for create a document writer.
    """
    def __init__(self, filename="", stream=None, document_id=None, logger=None):
        if logger:
            self.logger = logger
        else:
            self.logger = getLogger("documentWritter")
        self.document_id = document_id
        if stream:
            self.file = stream
        else:
            self.file = open(filename, "w")

    @staticmethod
    def store(*args):
        """Implement here the storing code.
        :param args: The arguments needed for store the graph.
        """
        pass

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        self.file.close()

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opener-coreference-base-2.1.1 core/corefgraph/output/basewriter.py
opener-coreference-base-2.1.0 core/corefgraph/output/basewriter.py
opener-coreference-base-2.0.3 core/corefgraph/output/basewriter.py
opener-coreference-base-2.0.2 core/corefgraph/output/basewriter.py
opener-coreference-base-2.0.1 core/corefgraph/output/basewriter.py