diff --git a/README.md b/README.md index 9a16a9b..95cb7a9 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Intermediate results are stored in a Redis database to allow the analysis of mul ~~~~ usage: napkin.py [-h] [-v V] [-f F] [-t T] [-s] [-o O] [-l L] [--verbatim] - [--no-flushdb] + [--no-flushdb] [--binary] Extract statistical analysis of text @@ -44,6 +44,7 @@ optional arguments: --no-flushdb Don't flush the redisdb, useful when you want to process multiple files and aggregate the results. (by default the redis database is flushed at each run) + --binary Output response in binary instead of UTF-8 (default) ~~~~ # example usage of napkin diff --git a/bin/napkin.py b/bin/napkin.py index e66198d..ae4c0d7 100644 --- a/bin/napkin.py +++ b/bin/napkin.py @@ -17,13 +17,17 @@ parser.add_argument('-o', help="output format (default is csv), json", default=" parser.add_argument('-l', help="language used for the analysis (default is en)", default="en") parser.add_argument('--verbatim', help="Don't use the lemmatized form, use verbatim. (default is the lematized form)", default=False, action='store_true') parser.add_argument('--no-flushdb', help="Don't flush the redisdb, useful when you want to process multiple files and aggregate the results. (by default the redis database is flushed at each run)", default=False, action='store_true') +parser.add_argument('--binary', help="Output response in binary instead of UTF-8 (default)", default=False, action='store_true') args = parser.parse_args() if args.f is None: parser.print_help() sys.exit() -redisdb = redis.Redis(host="localhost", port=6380, db=5) +if not args.binary: + redisdb = redis.Redis(host="localhost", port=6380, db=5, encoding='utf-8', decode_responses=True) +else: + redisdb = redis.Redis(host="localhost", port=6380, db=5) try: redisdb.ping()