Example #1
0
    def __init__(self, filename, backoff = None):
        """Provider which browse data in text files.

        :param filename: path to file with words
        :type filename: str
        :param backoff: optional backoff
        """

        DefaultProvider.__init__(self, backoff)
        self.data_set = self.__load(filename)
        self.conf_cache = None
Example #2
0
    def __init__(self, backoff = None):
        """Provider which browse data in neo4j graph database.

        :param url: database connection url
        :type url: str
        :param backoff: optional backoff
        """

        DefaultProvider.__init__(self, backoff)
        self.__nodeCounter = 0
        self.conn = None
        self.connect()
Example #3
0
    def __init__(self, path, backoff = None):
        """
        Initializes DatabaseProvider.

        This provider requires closing database after using (call close function).

        :param path: path to a database file
        :type path: str
        :param backoff: (optional) backoff provider
        """
        DefaultProvider.__init__(self, backoff)

        self.storage = FileStorage(path + '.fs')
        self.db = DB(self.storage)
        self.connection = self.db.open()
        self.root = self.connection.root()

        if not self.root:
            self.__dictionary_init()
Example #4
0
 def __init__(self, url, backoff):
     DefaultProvider.__init__(self, backoff) 
     self.__url = url
     self._buffered_data = {}