Acora doesn't work with gzip-opened files
Question: I'm trying to run Acora parsing on a file, which works as expected on plain
text files. When I try to run it on gzipped files using the python gzip module
(which is supposed to allow transparent reading of compressed files) I receive
nothing in return. This is not a case of not rewinding the file to the
beginning, I tried it from fresh with both compressed and uncompressed.

    
    
    from acora import AcoraBuilder
    
    f1 = open('input_file.txt', 'r')
    ac = AcoraBuilder(tokens).build()
    ac.filefindall(f1)  ## Works as expected
    
    import gzip
    f2 = gzip.open('input_file.txt.gz', 'r')
    ac = AcoraBuilder(tokens).build()
    ac.filefindall(f2)  ## Doesn't work, returns no results
    

Please let me know if this is something I'm missing.


Answer: I think Acora doesn't has support to compacted files. You need to extract it
before use it.

    
    
    from acora import AcoraBuilder
    import gzip
    
    with gzip.GzipFile('input_file.txt.gz', 'rb') as fp:
        f2 = fp.read()
    
    ac = AcoraBuilder(tokens).build()
    ac.findall(f2)
    

Anyway, acora has native support to search in files.

    
    
    keywords = ['Import', 'FAQ', 'Acora', 'NotHere'.upper()]
    
    builder = AcoraBuilder([s.encode('ascii') for s in keywords])
    ac = builder.build()
    
    found = set(kw for kw, pos in ac.filefind('README.rst'))
    

