You are not logged in.

#1 2010-01-31 18:47:30

Lexion
Member
Registered: 2008-03-23
Posts: 510

Cookie: AI personal assistant

Cookie is a chatbot which has organizational commands. Here is an example (the lines starting with '>>>' or 'reminder>' are user inputted):

Webpage: onebluecat.net/cookie

>>> hi
% hi
>>> make a new reminder
reminder> every tuesday i go skating
>>> show me my reminders
Every Tuesday i go skating
>>> i'd like to view a note
What is the name of the note you would like to view: example

[PROCESSED]
-- This is the first sentence of the paragraph

[ORIGINAL]
    This is the first sentence of the paragraph. Cookie takes the first sentences and puts them in the PROCESSED section.
>>> bye
% bye
> /exit

Reminders, notes, and learned phrases are persistent from session to session.

There is now a project called Pretzel by y27 that attempts to do that same thing. If you like cookie, please take a look at Pretzel.

I hope you like it.

EDIT: fixed documentation.

Last edited by Lexion (2010-03-13 20:18:21)


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#2 2010-01-31 19:39:14

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: Cookie: AI personal assistant

Interesting, I'm currently working on a chat bot and have my computer sent up to text/email people. Might be an interesting idea, if you feel like extending your program. I don't program in python, so I'm sort of lost when I get this:

api/sbi_run chat/chat.sbi 
== Cookie ==
backing up logs...
cleaning up pycs...
checking resources...
=====================
=====================
checking for python...
checking for sbi_3d...
executing sbi...
================
= SBI: python main.py main.stdat
= 3D:  no
================
python: can't open file 'main.py': [Errno 2] No such file or directory

cat: *.log: No such file or directory

What am I missing?

Offline

#3 2010-01-31 21:14:56

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: Cookie: AI personal assistant

Sorry, my bad.

you have to cd into the $PROJECT_ROOT/chat directory and type:

aiAPI/sbi_run chat.sbi

urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#4 2010-01-31 21:36:31

baion baion
Member
From: Nicosia, Cyprus
Registered: 2009-06-13
Posts: 48

Re: Cookie: AI personal assistant

Hello, your program is amazing. This is what I always wanted to code, but unfortunately I am still learning and have not been able to implement my ideas. Perhaps you could give a few small pointers on where to start? It does not have to be as complex as your AI, just give a few hints on where to start.
Thank you in advance.

Last edited by baion baion (2010-01-31 21:37:29)

Offline

#5 2010-02-01 00:28:03

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: Cookie: AI personal assistant

Thank you very much.

The first thing you need to do is install (from the AUR) and learn a bit about nltk (Natural Language ToolKit). You can use this to remove articles and unnessesary words from sentences. Then make a key-value table and a way of comparing sentences. Here is the general structure of my AI:

get user input
parse user input
remove unnessesary words

loop through key-value table
    if user's inputted sentence is similar to a key sentence
         display the value sentence

if no sentence can be found that matches
    ask user to give the correct reply
    add reply to key-value table

I hope you find this helpful.


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#6 2010-02-02 23:45:27

Echtor2oo3
Member
From: Germany
Registered: 2009-05-12
Posts: 10
Website

Re: Cookie: AI personal assistant

Great Bot big_smile
cd, ls would be nice smile

Time in German:

Zeit :/shell echo  "Es ist `date +%H` Uhr `date +%M`" | say

Edit:
I use sox and mbrola for speaking ( http://gentoo-wiki.stefreak.de/de.gento … brola.html )

Edit2:

cd:
    elif "cd" in s:
        os.chdir(result[1])
        print "Dir: "+result[1]
        return 1

Last edited by Echtor2oo3 (2010-02-03 10:58:03)

Offline

#7 2010-02-03 13:16:05

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: Cookie: AI personal assistant

Thanks.

I've added ls and cd. I've also made the instructions more intiutive:

Instead of using

install: <p>
find-pkg: <p>
update
remind: <r>
done: <r>
note: <n>
unnote: <n>
date: <d>
cancel: <d>
show notes
show reminders
show dates

It is now

install <pkg> (no colon)
find the package <pkg>
update my system
please remind me to <r>
i've done <r>

(the rest is the same)

NOTE: you don't have to use the exact words I used.

DOWNLOAD: sbi_0.1a_2-3-2010.tar.gz


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#8 2010-02-03 21:22:06

Blue Peppers
Member
From: Newbury, UK
Registered: 2009-02-01
Posts: 178

Re: Cookie: AI personal assistant

Sweeet... though I've been working on something exactly like this for 6 months tongue

Last edited by Blue Peppers (2010-02-03 21:29:45)


Consistency is not a virtue.

Offline

#9 2010-02-04 09:50:18

leadghost
Member
Registered: 2009-09-09
Posts: 29

Re: Cookie: AI personal assistant

Hi I'm having some trouble getting this working. So far I :
downloaded/extracted the tar.gz
cd  /home/btartsa/pkg_builds/sbi_0.1a_2-3-2010/chat
installed python-nltk and nltk-data from aur (versions seem current)

tried to run it:

$aiAPI/sbi_run chat.sbi
== Cookie ==
backing up logs...
cleaning up pycs...
checking resources...
=====================
=====================
checking for python...
checking for sbi_3d...
executing sbi...
================
= SBI: python main.py main.stdat
= 3D:  no
================
loading environment...
Traceback (most recent call last):
  File "main.py", line 263, in <module>
    gp.read("hello world")
  File "/home/btartsa/pkg_builds/sbi_0.1a_2-3-2010/chat/grammar.py", line 35, in read
    self.cache_tag = nltk.pos_tag(self.cache_tok)
  File "/usr/lib/python2.6/site-packages/nltk/tag/__init__.py", line 62, in pos_tag
    tagger = nltk.data.load(_POS_TAGGER)
  File "/usr/lib/python2.6/site-packages/nltk/data.py", line 593, in load
    resource_val = pickle.load(_open(resource_url))
  File "/usr/lib/python2.6/site-packages/nltk/data.py", line 672, in _open
    return find(path).open()
  File "/usr/lib/python2.6/site-packages/nltk/data.py", line 454, in find
    raise LookupError(resource_not_found)
LookupError:
**********************************************************************
  Resource 'taggers/maxent_treebank_pos_tagger/english.pickle' not
  found.  Please use the NLTK Downloader to obtain the resource:
  >>> nltk.download().
  Searched in:
    - '/home/btartsa/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'
**********************************************************************

cat: *.log: No such file or directory

Searched the missing resource:

$locate english.pickle
/usr/share/nltk/data/taggers/maxent_treebank_pos_tagger/english.pickle
/usr/share/nltk/data/tokenizers/punkt/english.pickle

So...I'm at a loss. Googling was no help either. Would like to try this out though!


Hand over the spoon Milt...

Offline

#10 2010-02-04 10:06:40

Echtor2oo3
Member
From: Germany
Registered: 2009-05-12
Posts: 10
Website

Re: Cookie: AI personal assistant

remove the nltk-data packet and install this -> http://echtor.net/null/python/nltk_data.tar.gz

greetz

Last edited by Echtor2oo3 (2012-05-02 15:11:40)

Offline

#11 2010-02-04 12:18:55

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: Cookie: AI personal assistant

@Blue Peppers: Please, keep working on yours (if you want). Competition would be nice.


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#12 2010-02-06 16:13:55

baion baion
Member
From: Nicosia, Cyprus
Registered: 2009-06-13
Posts: 48

Re: Cookie: AI personal assistant

I don't seem to have a folder named aiAPI nor do I have python module file named aiAPI.py. Is there something wrong with the download tarball?

Offline

#13 2010-02-06 16:17:01

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: Cookie: AI personal assistant

I download and then test every tarball now, so no. Try this:

cd $PROJECT_ROOT/chat
ln -s ../api aiAPI

This should link the "api" directory into "chat/aiAPI", which is how it's suppose to be.


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#14 2010-02-06 16:41:33

baion baion
Member
From: Nicosia, Cyprus
Registered: 2009-06-13
Posts: 48

Re: Cookie: AI personal assistant

I moved the tarball to an ext4 partition, I previously used a FAT32 one, and the link appeared. I had no idea that links are not working on FAT32 partitions.

Offline

#15 2010-02-06 17:57:20

AlexS
Member
From: Munich, Germany
Registered: 2009-05-16
Posts: 114

Re: Cookie: AI personal assistant

Intriguing... But how is this different from directly interacting with the shell? Am I missing something?

Offline

#16 2010-02-08 18:11:47

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: Cookie: AI personal assistant

@baion baion: I have a similar problem on my win7 machine.
@AlexS: It uses natural language (aka plain english) to interact as opposed to the shell language. Also, it interfaces with the shell to run commands, so it can't replace the shell.

Sorry for the late response.


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#17 2010-02-11 21:01:08

AlexS
Member
From: Munich, Germany
Registered: 2009-05-16
Posts: 114

Re: Cookie: AI personal assistant

Do you think this could facilitate interaction of a non technical person with a terminal, or are the syntax requirements so strict that it's just as hard as to learn the commands directly?

Last edited by AlexS (2010-02-11 21:01:33)

Offline

#18 2010-02-12 02:46:46

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: Cookie: AI personal assistant

I don't intend to facilitate non-tech-literate people. It's more of a cool thing than a useful thing in my eyes (tell me if you think otherwise).


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#19 2010-02-21 06:42:19

winford
Member
From: Springfield, Oregon
Registered: 2010-02-21
Posts: 4

Re: Cookie: AI personal assistant

Regarding leadghost's problem:
LookupError:
**********************************************************************
  Resource 'taggers/maxent_treebank_pos_tagger/english.pickle' not
  found.  Please use the NLTK Downloader to obtain the resource:
  >>> nltk.download().
  Searched in:
    - '/home/btartsa/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'
**********************************************************************

This seems to point to a bug.  The package unsupported/python-nltk looks in '/usr/share/nltk_data' but the package unsupported/nltk-data installs the data into '/usr/share/nltk/data'.  I am not sure which package to blame (but '/usr/share/nltk/data' does seem more logical to me).  I worked around this by adding the following line to /usr/lib/python2.6/site-packages/nltk/data.py.
Starting at line 83:

# Common locations on UNIX & OS X:
else: path += [
    '/usr/share/nltk_data',
    '/usr/share/nltk/data',                  <<- add this line
    '/usr/local/share/nltk_data',
    '/usr/lib/nltk_data',
    '/usr/local/lib/nltk_data']

This is a fantastic bot, endless possibilities...

p.s. edit: After looking into this a bit more the nltk-docs say that the data should be installed to "/usr/share/nltk_data" so this should be fixed in the PKGBUILD if the unsupported/nltk-data is used or (according to the nltk-data docs ) set the environment variable NLTK_DATA="/usr/share/nltk/data" if you used the default location.

Last edited by winford (2010-02-27 15:13:27)

Offline

#20 2010-02-21 07:10:50

mikesd
Member
From: Australia
Registered: 2008-02-01
Posts: 788
Website

Re: Cookie: AI personal assistant

Nifty. I like it. Great work.

Offline

#21 2010-02-21 08:50:09

winford
Member
From: Springfield, Oregon
Registered: 2010-02-21
Posts: 4

Re: Cookie: AI personal assistant

Is there a command (like help or list) that will list all commands? and if so is there a way to show built in ones separately from "learned" ones?

Thanks for the great work!  big_smile

Last edited by winford (2010-02-21 09:03:22)

Offline

#22 2010-02-22 23:16:49

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: Cookie: AI personal assistant

There isn't now, but I can add one. I'm quite busy on another project right now, but in a few days I'll add your suggestions.


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#23 2010-02-23 01:54:27

winford
Member
From: Springfield, Oregon
Registered: 2010-02-21
Posts: 4

Re: Cookie: AI personal assistant

Thanks again.  For the time being I  get the list of "learned" commands by teaching the following:

> what have you learned?
I don't know what to say to that.
new response> /shell less main.stdat

Of course this only works until 'cd' is used. hmm  Looks like its time to start learning python so I can post a patch instead of a feature request next time. smile

Offline

#24 2010-02-23 12:39:21

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: Cookie: AI personal assistant

You shouldn't need to do that. I'll hard code it in the next release.


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#25 2010-03-02 03:09:38

y27
Member
Registered: 2009-05-27
Posts: 147
Website

Re: Cookie: AI personal assistant

Nice project smile

One thing though; your comparing function seems a little overly simple to me - unless I missed something, it's this right?

class Compare(object):
        def basic(self, a, b):
                if len(a) != len(b):
                        return False

                for i in range(0, len(a)):
                        if a[i] != b[i]:
                                return False

                return True

I would expect that if you tell it that "open Program" should open Program, it should also work out that you mean the same when you input something like "launch Program", which your function would miss.

I've written a (very) simple function to do that; it mainly uses wordnet.path_similarity and "crosses-off" words that look similar in its two arguments. This is of course quite primitive (I mainly used this approach to learn about nltk) but I found it to work surprisingly well for simple situations like these (ie you won't type an essay or even a full sentence (usually) in the prompt).

I've added it to my git account, you can find it there if you are interested, using it is very straightforward:
http://github.com/houbysoft/meaningcmp

EDIT: typo

Last edited by y27 (2010-03-02 03:21:26)

Offline

Board footer

Powered by FluxBB