Skip to content

Commit

Permalink
Update progress, Fix #14
Browse files Browse the repository at this point in the history
Some cleanup in wiki module
  • Loading branch information
swapagarwal committed Apr 23, 2016
1 parent dba514b commit 70a69c4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Expand Up @@ -26,6 +26,7 @@ To fix a bug or enhance an existing module, follow these steps:
## Bug / Feature Request

If you find a bug (the bot couldn't handle the query and / or gave irrelevant results), kindly open an issue [here](https://github.com/swapagarwal/JARVIS-on-Messenger/issues/new) by including your search query and the expected result.

If you'd like to request a new functionality, feel free to do so by opening an issue [here](https://github.com/swapagarwal/JARVIS-on-Messenger/issues/new) including some sample queries and their corresponding results.

## General
Expand Down
10 changes: 6 additions & 4 deletions README.md
Expand Up @@ -28,20 +28,21 @@ Take a look at the [contributing guidelines](https://github.com/swapagarwal/JARV

There are a lot of features that I've planned for JARVIS. Feel free to add to this list by opening an issue / PR.

- [ ] Book Rating
- [ ] Book Rating ([#11](https://github.com/swapagarwal/JARVIS-on-Messenger/pull/11))
- [x] Movie Rating
- [ ] News
- [ ] Weather
- [ ] Weather ([#13](https://github.com/swapagarwal/JARVIS-on-Messenger/pull/13))
- [ ] Currency Conversion
- [ ] Random Quote / Fact
- [x] Random Joke
- [x] Dictionary ([#1](https://github.com/swapagarwal/JARVIS-on-Messenger/pull/1))
- [ ] Wikipedia Summary
- [x] Wikipedia Summary ([#9](https://github.com/swapagarwal/JARVIS-on-Messenger/pull/9))
- [ ] Weather
- [ ] Lyrics Search

Some advanced features:

- [ ] Add templates support (Structured Messages)
- [ ] Add templates support (Structured Messages) ([#7](https://github.com/swapagarwal/JARVIS-on-Messenger/issues/7))
- [x] Integrate with [Wit.ai](https://wit.ai/swapagarwal/JARVIS-on-Messenger) to parse Natural Language
- [ ] Retain context between queries

Expand All @@ -66,6 +67,7 @@ JARVIS is at your service [here](http://m.me/J.A.R.V.I.S.on.Messenger). Currentl
`tell me a joke`
`iron man movie`
`define a superhero`
`wiki html`
More examples can be found [here](https://github.com/swapagarwal/JARVIS-on-Messenger/tree/master/modules/tests).

### Local Development / Testing
Expand Down
4 changes: 2 additions & 2 deletions modules/src/__init__.py
Expand Up @@ -4,6 +4,6 @@
'help',
'joke',
'movie',
'wiki',
'request'
'request',
'wiki'
]
2 changes: 1 addition & 1 deletion modules/src/help.py
@@ -1,7 +1,7 @@
def process(input, entities=None):
help = '''\n
Hi there. I'm Jarvis, your personal assistant.\nHow may I help you today? Tell me things like the following:\n
- define a superhero\n - iron man 2 movie plot\n - tell me a joke\n
- define a superhero\n - iron man 2 movie plot\n - tell me a joke\n - wiki html\n
I'm always learning, so do come back and say hi from time to time!\nHave a nice day.\n
'''
output = {
Expand Down
6 changes: 3 additions & 3 deletions modules/src/request.py
@@ -1,8 +1,8 @@
def process(input, entities=None):
request = '''
Kindly head over to https://github.com/swapagarwal/JARVIS-on-Messenger/issues/new to file an issue:\n
- If you find a bug (the bot couldn't handle the query and / or gave irrelevant results), include your search query and the expected result.\n
- If you'd like to request a new functionality, feel free to do so by including some sample queries and their corresponding results.\n
Kindly head over to https://github.com/swapagarwal/JARVIS-on-Messenger/issues/new to:\n
- Report a bug (I couldn't handle the query and/or gave unexpected results), by including your search query and the expected result.\n
- Request a new feature, by including some sample queries and their expected results.\n
'''
output = {
'input': input,
Expand Down
4 changes: 2 additions & 2 deletions modules/src/wiki.py
Expand Up @@ -4,9 +4,9 @@ def process(input, entities):
output = {}
try:
query = entities['wikipedia_search_query'][0]['value']
data = wikipedia.summary(query, sentences=5, auto_suggest=True)
data = wikipedia.summary(query, sentences=1)
output['input'] = input
output['output'] = 'Summary :' + data
output['output'] = 'Wikipedia summary: ' + data
output['success'] = True
except:
output['success'] = False
Expand Down
5 changes: 3 additions & 2 deletions modules/tests/test_wiki.py
@@ -1,6 +1,7 @@
import modules

def test_wiki():
assert('wiki' == modules.process_query('Wikipedia Barack')[0])
assert('wiki' == modules.process_query('Wikipedia HTML')[0])
assert('wiki' == modules.process_query('wikipedia barack')[0])
assert('wiki' == modules.process_query('html wiki')[0])
assert('wiki' != modules.process_query('joke definition')[0])
assert('wiki' != modules.process_query('something random')[0])

0 comments on commit 70a69c4

Please sign in to comment.