GithubHelp home page GithubHelp logo

gooofy / zamia-ai Goto Github PK

View Code? Open in Web Editor NEW
157.0 19.0 26.0 121.16 MB

Free and open source A.I. system based on Python, TensorFlow and Prolog.

License: Apache License 2.0

Python 27.63% Shell 0.01% Makefile 0.01% Prolog 72.37%
python tensorflow artificial-intelligence natural-language-processing prolog knowledgebase semantic-web

zamia-ai's Introduction

Zamia AI

The Zamia AI project is a framework that provides a set of components needed to build completely free, open source end-to-end speech and natural language processing A.I. systems.

For more information about the Zamia AI project check out our homepage at:

Getting Started

Try Our Example Applications

The easiest way to see Zamia AI in action is to download one of our precompiled examples:

Chatbot

This is a simple text chat bot built on top of Zamia AI’s knowledge base. You can chat with the model by running the command:

zaicli chat

Here is a sample session giving you some ideas to get your conversation started:

[bofh@centos7 chatbot]$ zaicli chat
...
ai> okay computer
INFO:root:RESP: [   0.5] Greetings! | action: attention(on)
ai> what is your name
INFO:root:RESP: [   0.5] My name is "HAL 9000"
ai> who was the predecessor of barack obama
INFO:root:RESP: [   0.2] The predecessor of "Barack Obama" as "President of the United States of America" was "George W. Bush".
ai> what time is it
INFO:root:RESP: [   0.1] It is 6 minutes past 0
ai> are you a computer
INFO:root:RESP: [   0.1] Yes, I am a Computer. Are you knowledgeable about Computers?
ai> what is your favorite movie
INFO:root:RESP: [   1.0] 2001: A Space Odyssey by Stanley Kubrick
ai>

You can also run the chatbot application itself which shoud also give you a starting point on how to embed Zamia AI into you own applications:

./chatbot.py

Voice Assistant

This example show how Zamia AI can be combined with Zamia Speech Kaldi ASR Models and eSpeak NG to create a completely free, offline capable voice assistant.

Compiling Zamia AI Models

This tutorial uses the chatbot example that comes with Zamia AI. You can also find it online here:

to try it, create a directory and put all the source files there.

Now, the first step is to compile the skills that are used in this examples - i.e. Zamia AI will will compute all sample utterances plus their corresponding responses from the skills our toplevel.py skill depends on into an SQLite DB. To do this, we run the command

zaicli compile all

you can check out the number of utterances extracted from each skill using the command

zaicli stats

also, you can check the utterances extracted from all or specific skills using the command

zaicli utterances [-s skill]

Train word vectors using fastText:

wget 'http://goofy.zamia.org/zamia-speech/misc/sentences-en.txt.xz'
unxz sentences-en.txt.xz

zaicli utterances >utts.txt

cat utts.txt sentences-en.txt > corpus.txt
mkdir model
fasttext skipgram -input corpus.txt -output model/word_embeddings

Once we are satisfied it is time to train our NLP model which will allow Zamia AI to handle utterances that have no exact match in our DB:

zaicli train

Utterance Classification

Utterance classification is used to predict which of the existing skills a new utterance fits best. Can also be used on a text file containing one utterance per line.

Train the classifier:

zaicli utt_class_train

Run the prediction:

zaicli utt_class "Who is the current US President?"

Adapt the Kaldi Speech Recognition Model

Note
This is only needed for application that use voice input.
cat utts.txt utts.txt utts.txt utts.txt utts.txt sentences-en.txt >corpus5.txt

MODEL="/opt/kaldi/model/kaldi-generic-en-tdnn_sp"

cut -f 1 -d ' ' ${MODEL}/data/local/dict/lexicon.txt >vocab.txt
lmplz -o 4 --prune 0 1 2 3 --limit_vocab_file vocab.txt --interpolate_unigrams 0 <corpus5.txt >lm.arpa

rm -rf work
kaldi-adapt-lm ${MODEL} lm.arpa en-tdnn_sp
tar xfJ work/kaldi-en-tdnn_sp-adapt.tar.xz

Further Documentation

For other technical documentation, check out

License

My own scripts as well as the data I create is Apache-2.0 licensed unless otherwise noted in the script’s copyright headers.

Some scripts and files are based on works of others, in those cases it is my intention to keep the original license intact. Please make sure to check the copyright headers inside for more information.

Author

Guenter Bartsch <[email protected]>

zamia-ai's People

Contributors

gooofy avatar mpuels avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zamia-ai's Issues

Errors while trying to start from scratch?

Hi @gooofy ,

I have tried to use your scripts for quite a long time now - and I did have some success, so thank you first of all for sharing this code with us.

Anyway - I keep getting errors while training the nnet3_tdnn_a (I didn't try any LSTM yet) and those errors seem to be caused by the fact that the utterance database used to train the network is already built with all the utterances you use to train your models and that not all of the data you use is being downloaded by your scripts.

Is there any way to start from scratch with a clean model just using the utterances we've downloaded this time?

Thanks in advance!

cmusphinx audio models from voxforge

I could not get your voxforge models to work for me (I didn't want to clone the whole nlp repo but did not know how I should contact you otherwise). I created a repository that explains the problem in more detail here. The error when running cmusphinx (with your cont and ptm models) is (in both cases):

... long list of output ...
WARN: "ngram_model_trie.c", line 435: Duplicate word in dictionary: 
ERROR: "ngram_search.c", line 206: Language model/set does not contain </s>, recognition will fail

how to use

I have another problem that how to use the ai_cli when I ./ai_cli , could you give me some guides about this

The summary

I have download your code and install on the computer with GPU P6000. After the experiment of my own module, I find the network lacks the capacity to handle the long sentence of seq2seq. So, I try to use your resource label to contain the long sentence to shrink the length. Could you give me the instruction about how to use the label like rdfsLabel(HUMAN, de, LABEL)

german Kaldi acoustic model?

Hi Guenter,

I'm using your latest german acoustic model for Sphinx-4 with great success in my ILA - voice assistant! :-) Right now I'm trying to integrate support for Kaldi and I was wondering if you have any plans to make a DNN based model supporting that? I'd be really happy to see that :-)
Thanks for the great work so far!

cu,
Florian

Btw, if you'd like to see you model in action:
https://sites.google.com/site/ilavoiceassistant/

Update existing model?

Hi! I was wondering if there's any way to update a model that has already been computed once we get new training data?
I'm talking about the nnet3 (tdnn) here. I know it's most probably a question for the guys at kaldi but since we have so many useful scripts here I was kind of hoping that I'm not the first one having such an idea...

Thanks in advance.

the problem of training data

I have found that the nlp_model want to drag the training data from sqlite but i have not found the source of the training data, could you tell me which file I can find about training data. Or show the process that training data is loaded into the database

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.