Skip to content

Commit

Permalink
removed reverse bool
Browse files Browse the repository at this point in the history
  • Loading branch information
puneithk committed Jul 20, 2016
1 parent c9ac6d3 commit d465566
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions language/movie_nl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,9 @@ def rank_entities(reader, sentiment=None, topn=None, reverse_bool=False):
else:
items.append(entity_item)

items.sort(reverse=True)
items.sort(reverse=reverse_bool)
items = [json.dumps(item[1]) for item in items]

if reverse_bool:
items.reverse()

if topn:
print('\n'.join(items[:topn]))
else:
Expand Down Expand Up @@ -340,7 +337,9 @@ def analyze(input_dir, sentiment_writer, entity_writer, sample, log_file):
rank_parser.add_argument(
'--sentiment', help='filter sentiment as "neg" or "pos"')
rank_parser.add_argument(
'--reverse', help='reverse the order of the items')
'--reverse', help='reverse the order of the items', type=bool,

This comment has been minimized.

Copy link
@jerjou

jerjou Jul 20, 2016

Contributor

FYI argparse has a thing for this:

action='store_true'

which will cause args.reverse to be false, unless --reverse appears in the command line, in which case it will be true.

default=False
)
rank_parser.add_argument(
'--sample', help='number of top items to process', type=int)

Expand Down

0 comments on commit d465566

Please sign in to comment.