diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-04-01 01:05:53 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-04-01 01:05:53 +0200 |
| commit | bb5f8a9fe7f3968588b45eeaa0c993ef314ca904 (patch) | |
| tree | 2535fae43c4937ae45357a4e8108ad355220e5c4 /cli/commands/bridge | |
| parent | 2b407d1f4a608d0ac23592ff16def77797e4fa41 (diff) | |
begin bridge
Diffstat (limited to 'cli/commands/bridge')
| -rw-r--r-- | cli/commands/bridge/words.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cli/commands/bridge/words.py b/cli/commands/bridge/words.py new file mode 100644 index 0000000..277b069 --- /dev/null +++ b/cli/commands/bridge/words.py @@ -0,0 +1,30 @@ +""" +Find connections between two words +""" + +import click +import simplejson as json + +from app.thesaurus.api import Thesaurus + +@click.command() +@click.option('-a', '--a', 'opt_word_a', required=True, + help='Starting word') +@click.option('-b', '--b', 'opt_word_b', required=True, + help='Ending word') +@click.pass_context +def cli(ctx, opt_word_a, opt_word_b): + """Find connections between two words + """ + thesaurus = Thesaurus() + print(f"Starting word: {opt_word_a}") + print(f"Ending word: {opt_word_b}") + results_a = thesaurus.search(opt_word_a) + results_b = thesaurus.search(opt_word_b) + # use sets + # make set of results_a + # find overlap with results_b + # if there's no match... + # search for first word in results_a + # loop over results... + # print(json.dumps(results, indent=2)) |
