create_database/database_insertion.py
def parse_file(self, f, file_name):
        """This method overrides the original method
        Keyword arguments:
        f - the file object to be parsed by lxml
        file_name - the name of the file used as metadata
        Yields:
        A document object in sqlalchemy format and the corresponding text
        that will be parsed by CoreNLP
        """

        for event, doc in et.iterparse(f, tag='document'):
            doc_id = str(doc.xpath(self.id)[0])

            if int(doc_id) not in self.tag_filter:
                doc.clear()
                continue

            text = '\n'.join(filter(lambda t: t is not None, doc.xpath(self.text)))

            # guarentees that resources are freed after they have been used
            doc.clear()
            meta = {'file_name': str(file_name)}
            stable_id = self.get_stable_id(doc_id)
            if not(text):
                continue

            yield Document(name=doc_id, stable_id=stable_id, meta=meta), text
This method overrides the original method
        Keyword arguments:
        f - the file object to be parsed by lxml
        file_name - the name of the file used as metadata
        Yields:
        A document object in sqlalchemy format and the corresponding text
        that will be parsed by CoreNLP
        
This method overrides the original method
Keyword arguments:
f - the file object to be parsed by lxml
file_name - the name of the file used as metadata
This method overrides the original method Keyword arguments : f - the file object to be parsed by lxml file_name - the name of the file used as metadata
def parse_file(self, f, file_name):
        for event, doc in et.iterparse(f, tag='document'):
            doc_id = str(doc.xpath(self.id)[0])
            if int(doc_id) not in self.tag_filter:
                doc.clear()
                continue
            text = '\n'.join(filter(lambda t: t is not None, doc.xpath(self.text)))
            doc.clear()
            meta = {'file_name': str(file_name)}
            stable_id = self.get_stable_id(doc_id)
            if not(text):
                continue
            yield Document(name=doc_id, stable_id=stable_id, meta=meta), text
def parse_file ( self , f , file_name ) : for event , doc in et . iterparse ( f , tag = 'document' ) : doc_id = str ( doc . xpath ( self . id ) [ 0 ] ) if int ( doc_id ) not in self . tag_filter : doc . clear ( ) continue text = '\n' . join ( filter ( lambda t : t is not None , doc . xpath ( self . text ) ) ) doc . clear ( ) meta = { 'file_name' : str ( file_name ) } stable_id = self . get_stable_id ( doc_id ) if not ( text ) : continue yield Document ( name = doc_id , stable_id = stable_id , meta = meta ) , text
This method overrides the original method
Keyword arguments:
f - the file object to be parsed by lxml
file_name - the name of the file used as metadata
This method overrides the original method Keyword arguments : f - the file object to be parsed by lxml file_name - the name of the file used as metadata
"""This method overrides the original method
        Keyword arguments:
        f - the file object to be parsed by lxml
        file_name - the name of the file used as metadata
        Yields:
        A document object in sqlalchemy format and the corresponding text
        that will be parsed by CoreNLP
        """ # guarentees that resources are freed after they have been used
None
self
f
file_name