Created
November 16, 2015 19:58
-
-
Save dijs/a29c6aa70d12b4768648 to your computer and use it in GitHub Desktop.
Spying on James Bond
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'babel-polyfill' | |
import Wiki from './dist/wiki' | |
import Knwl from 'knwl.js' | |
let knwlInstance = new Knwl('english') | |
knwlInstance.register('dates', require('./node_modules/knwl.js/default_plugins/places')); | |
let wiki = new Wiki({ | |
uri: 'http://jamesbond.wikia.com/api.php' | |
}) | |
async function findBondPlaces() { | |
let films = await wiki.search('James_Bond_films') | |
let pages = await Promise.all(films.results.map(film => wiki.page(film))) | |
let descriptions = await Promise.all(pages.map(page => page.content())) | |
let text = descriptions.join(' ') | |
knwlInstance.init(text) | |
let places = knwlInstance.get('places') | |
} | |
findBondPlaces() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment