Go to file
nico fa8c7bd663 [Release] Update to be compliant with kalliope 0.6 2020-01-01 09:15:43 -08:00
tests initial commit 2016-12-17 16:22:53 +01:00
.gitignore [Release] Update to version 0.5 2018-01-13 18:23:33 +01:00
LICENSE.md [Update] add MIT licence 2016-12-23 16:31:07 +01:00
README.md fix args 2017-05-22 20:43:48 +02:00
__init__.py initial commit 2016-12-17 16:22:53 +01:00
dna.yml [Release] Update to be compliant with kalliope 0.6 2020-01-01 09:15:43 -08:00
install.yml add dna and install yaml file 2016-12-17 17:02:22 +01:00
wikipedia_searcher.py [Release] Update to be compliant with kalliope 0.6 2020-01-01 09:15:43 -08:00




Get the summary of a Wikipedia page.


kalliope install --git-url https://github.com/kalliope-project/kalliope_neuron_wikipedia.git


parameter required default choices comment
language yes E.g: "fr", "en", "it", "es" See the list of available language in the "Note" section
query yes The wikipedia page you are looking for. This parameter can be passed as an argument in the neuron from the order with {{ query}}
sentences no 10 Integer in range 1-10 if set, return the first number of sentences(can be no greater than 10) specified in this parameter.

Return Values

Name Description Type sample
summary Plain text summary of the searched page string Wikipedia is a collaboratively edited, multilingual, free Internet encyclopedia supported by the non-profit Wikimedia Foundation..
returncode Error code. See bellow string SummaryFound
may_refer List of pages that can refer the query list ['Marc Le Bot', 'Bot', 'Jean-Marc Bot', 'bot', 'pied bot', 'robot', 'Sam Bot', 'Famille Both', 'Yves Bot', 'Ben Bot', 'Botswana']
returncode Description
SummaryFound A summary hs been found from the querry
DisambiguationError The query match more than ony one page.
PageError No Wikipedia matched a query

Synapses example

This synapse will look for the {{ query }} spelt by the user on Wikipedia

- name: "wikipedia-search"
    - order: "look on wikipedia {{ query }}"
    - wikipedia_searcher:
        language: "en"
        query: "{{ query }}"
        file_template: "wikipedia_returned_value.j2"

Templates example

This template will simply make Kalliope speak out loud the summary section of the Wikipédia page of the query. If the query match more than one page, Kaliope will give the user all matched pages. If the query doesn't match any page on Wikipedia, kalliope will notify the user.

{% if returncode == "DisambiguationError" %}
    The query match following pages    
    {% if may_refer is not none %}
        {% for page in may_refer %}
            {{ page }}
        {% endfor %}
    {% endif %}
{% elif returncode == "PageError" %}
    I haven't  found anything on this
{% else %}
    {{ summary }}
{% endif %}


Available languages in the detailed list of the offical Wikipedia page. The column is called "Wiki". E.g: "en"


Copyright (c) 2016. All rights reserved.

Kalliope is covered by the MIT license, a permissive free software license that lets you do anything you want with the source code, as long as you provide back attribution and "don't hold you liable". For the full license text see the LICENSE.md file.