From 5fe2e2ae1ff48b7f7ba9ab05cee2ad14ac90253e Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Sun, 11 Oct 2020 11:38:06 +0200 Subject: [PATCH] chg: [readable] add span description (token/word queried) --- bin/napkin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/napkin.py b/bin/napkin.py index 8cbc68e..3cdcd7d 100644 --- a/bin/napkin.py +++ b/bin/napkin.py @@ -134,17 +134,20 @@ for entity in doc.ents: if args.o == "json": output_json = {"format":"napkin"} for anal in analysis: + more_info = "" if args.analysis == "all" or args.analysis == anal: pass else: continue + if anal == "span": + more_info = "for {}".format(args.token_span) if args.o == "readable": previous_value = None x = redisdb.zrevrange(anal, 1, args.t, withscores=True, score_cast_func=int) if args.o == "csv": print() elif args.o == "readable": - header = ["\033[1mTop {} of {}\033[0m".format(args.t, anal)] + header = ["\033[1mTop {} of {} {}\033[0m".format(args.t, anal, more_info)] readable_table = [] elif args.o == "json": output_json.update({anal:[]})