Skip to content

Wikia/ask-fandom

Repository files navigation

ask-fandom

Build Status

Your semantic data-based assistant aka Tell me FANDOM, ...

Supported questions

  • When was someone born?
  • Who directed the episode?
  • Who played in episode?
  • Did foo played in bar episode?
  • Which is the first episode with Jana Carpenter?
  • Which species is Jana Carpenter?
  • Who is the main actor in 456 ambassador?
  • Was Jake Simmonds in the Doctor Who cast?
  • Was 456 ambassador engaged in drug dealing?
  • List me the Doctor Who guest actors
  • Who had me first apperance in The End of the World (TV story)?
  • Who starred as Vincent van Gogh?
  • What's species is De Maggio?
  • Who starred as Adam's mum?
  • Which character was portrayed by Terence Brown?
  • List all characters that belong to Gond species
  • In which episode Abzorbaloff first appeared?
  • List me all episodes in 6th season
  • Who starred as a second doctor?
  • List all articles needing citation
  • Who starred in Bad Wolf?

Supported "commands"

  • Tell me something about foo
  • List me the Season 2 stories
>>> rrp.simple_parse("Was Jake Simmonds in the Doctor Who cast?")
'(S1 (SQ (VBD Was) (NP (NP (NNP Jake) (NNPS Simmonds)) (PP (IN in) (NP (DT the) (NN Doctor)))) (NP (WP Who) (NN cast)) (. ?)))'
>>> rrp.simple_parse("Tell me something about foo")
'(S1 (S (VP (VB Tell) (NP (PRP me)) (NP (NP (NN something)) (PP (IN about) (NP (NN foo)))))))'

Command-line tool

$ python ask.py  "Who played Lionel Carson?"
Model directory: /home/macbre/.local/share/bllipparser/WSJ-PTB3
Model directory already exists, not reinstalling
INFO:get_oracle:Parsing question: Who played Lionel Carson?
INFO:get_oracle:Parsed question: [('WP', 'Who'), ('VBD', 'played'), ('NP', 'Lionel Carson')]
INFO:PersonFactOracle:You've asked: 'Who played Lionel Carson?' ({'name': 'Lionel Carson', 'property': 'played'})
INFO:PersonFactOracle:Asking SMW for 'Lionel Carson' page Actor property
INFO:PersonFactOracle:Got the value for Actor: ['Peter Bowles']
---
Who played Lionel Carson?
Lionel Carson is played by Peter Bowles.

Web interface / HTTP API

Run make server to start it. Flask server will listen on 0.0.0.0:5050.

/ask

$ curl -s 'http://127.0.0.1:5050/ask?q=Who%20directed%20The%20Big%20Bang%20episode?' | jq
{
  "_intent": "EpisodeFactIntent",
  "_meta": {
    "answer": "Toby Haynes",
    "name": "The Big Bang episode",
    "property": "directed"
  },
  "_reference": null,
  "_words": {
    "NN": "episode",
    "NP": "The Big Bang episode",
    "VBD": "directed",
    "WP": "Who"
  },
  "answer": "\"The Big Bang episode\" episode has been directed by Toby Haynes."
}

/examples

$ curl -s 'http://127.0.0.1:5050/examples' | jq
{
  "questions": [
    "Where does Lionel Messi play?",
    "Which club Cristiano Ronaldo plays for?",
    "Which faction does the Alterac belong to?",
    "Who directed The Big Bang episode?",
    "Who played Jake Simmonds?"
  ]
}

Data sources

SemanticMediaWiki API

Tools

Questions parsing libraries

Inspirations

Whitepapers

See https://groups.csail.mit.edu/infolab/publications.html

Install

virtualenv env -ppython3
. env/bin/activate
pip install -r requirements.txt
make server