Skip to content
Permalink
Browse files

pretty print on command cli

  • Loading branch information...
Arian Pasquali
Arian Pasquali committed Mar 11, 2019
1 parent b66928b commit 37f556df37277ead9d30312d52d789d7dafbc130
Showing with 9 additions and 4 deletions.
  1. +2 −1 requirements.txt
  2. +7 −3 yake/cli.py
@@ -1,7 +1,8 @@
tabulate
pytest
flake8
segtok
jellyfish
networkx
numpy
click
click
@@ -4,6 +4,7 @@

import click
import yake
from tabulate import tabulate

@click.command()
@click.option("-ti",'--text_input', help='Input text, SURROUNDED by single quotes(\')', required=False)
@@ -25,11 +26,14 @@ def run_yake(text_content):
windowsSize=window_size, top=top)
results = myake.extract_keywords(text_content)

table = []
for kw in results:
if (verbose):
print(kw[0], kw[1])
table.append({"keyword":kw[0], "score":kw[1]})
else:
print(kw[1])
table.append({"keyword":kw[0]})

print(tabulate(table, headers="keys"))

if text_input and input_file:
print("You should specify either an input file or direct text input, but not both!")
@@ -46,4 +50,4 @@ def run_yake(text_content):
run_yake(text_content)

if __name__ == "__main__":
main()
keywords()

0 comments on commit 37f556d

Please sign in to comment.
You can’t perform that action at this time.