Code Monkey home page Code Monkey logo

openstreetmap-tags-to-rivescript's Introduction

openstreetmap-tags-to-rivescript

Convert of openstreetmap/id-tagging-schema to RiveScript, the Artificial Intelligence Scripting Language (alternative to AIML)

Pypi: osmtags2rive GitHub

Quickstart

Install

No pip release yet, install from GitHub: pip install https://github.com/fititnt/openstreetmap-tags-to-rivescript/archive/main.zip

Just install via pypi:

pip install --upgrade osmtags2rive

# To see all options
osmtags2rive --help

Fetch cache

A copy of https://github.com/openstreetmap/id-tagging-schema on local disk is necessary. The following example saves on a path that is discovered by the cli tool.

# Prepare the cache directory
git clone https://github.com/openstreetmap/id-tagging-schema.git ./id-tagging-schema

The exact path can be customized with --path-id-tagging-schema option.

Generate RiveScript

osmtags2rive --language=pt > example/brain/osm-tagging_pt.rive
osmtags2rive --language=pt --reverse-index > example/brain/osm-tagging-reverse_pt.rive

Extras

Quickstart on how to use the generated RiveScripts

Check Rivescript website page for interpreters for other programming languages than python or the online playground. They all have a similar interface: allow you to deposit all files in a directory which is loaded by your interpreter.

Online playground

Copy and paste the contents of all the files and run it.

Python example

Using Rive Python interpreter from https://github.com/aichaos/rivescript-python

# install the rivescript python library
pip install rivescript

# Run your application.
# This one is a very simple (no integration with Telegram, Slack, etc) as proof of concept.
python shell.py
# file shell.py

from rivescript import RiveScript

# bot = RiveScript(utf8=True)
bot = RiveScript()
bot.load_directory("./example/brain")
bot.sort_replies()

while True:
    msg = input('You> ')
    if msg == '/quit':
        quit()

    reply = bot.reply("localuser", msg)
    print ('Bot>', reply)

Example of interaction (may change)

You> highway=residential 
Bot> OpenStreetMap preset highway/residential def. Rua residencial
You> estrada desconhecida
Bot> [ERR: No Reply Matched]
You> /quit

@TODO fix spaces on reverse index; "estrada desconhecida", not only strictly "estradadesconhecida"

Disclaimers

OpenStreetMap™ is a trademark of the OpenStreetMap Foundation, and is used with their permission. This project is not endorsed by or affiliated with the OpenStreetMap Foundation. (via OSMF Trademark_Policy)

License

Public Domain

Public domain

openstreetmap-tags-to-rivescript's People

Contributors

fititnt avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

openstreetmap-tags-to-rivescript's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.