Code Monkey home page Code Monkey logo

fargonauts / copycat Goto Github PK

View Code? Open in Web Editor NEW
111.0 13.0 20.0 2.69 MB

Modern port of Melanie Mitchell's and Douglas Hofstadter's Copycat

Home Page: https://en.wikipedia.org/wiki/Copycat_(software)#External_links

License: MIT License

Python 62.70% Jupyter Notebook 0.77% Makefile 0.05% TeX 36.16% Common Lisp 0.32%
douglas-hofstadter python ai artificial-intelligence cognitive-science psychology simulation search creativity analogy farg fluid-concepts concept concepts semantics

copycat's Introduction

co.py.cat

GUI

An implementation of Douglas Hofstadter's Copycat algorithm. The Copycat algorithm is explained on Wikipedia, and that page has many links for deeper reading. See also Farglexandria.

This implementation is a copycat of Scott Boland's Java implementation. The original Java-to-Python translation work was done by J Alan Brogan (@jalanb on GitHub). The Java version has a GUI similar to the original Lisp; this Python version has no GUI code built in but can be incorporated into a larger GUI program.

J. Alan Brogan writes:

In cases where I could not grok the Java implementation easily, I took ideas from the LISP implementation, or directly from Melanie Mitchell's book "Analogy-Making as Perception".

Running the command-line program

To clone the repo locally, run these commands:

$ git clone https://github.com/fargonauts/copycat.git
$ cd copycat/copycat
$ python main.py abc abd ppqqrr --iterations 10

The script takes three or four arguments. The first two are a pair of strings with some change, for example "abc" and "abd". The third is a string which the script should try to change analogously. The fourth (which defaults to "1") is a number of iterations.

This might produce output such as

ppqqss: 6 (avg time 869.0, avg temp 23.4)
ppqqrs: 4 (avg time 439.0, avg temp 37.3)

The first number indicates how many times Copycat chose that string as its answer; higher means "more obvious". The last number indicates the average final temperature of the workspace; lower means "more elegant".

Installing the module

To install the Python module and get started with it, run these commands:

$ pip install -e git+git://github.com/fargonauts/copycat.git#egg=copycat
$ python
>>> from copycat import Copycat
>>> Copycat().run('abc', 'abd', 'ppqqrr', 10)
{'ppqqrs': {'count': 4, 'avgtime': 439, 'avgtemp': 37.3}, 'ppqqss': {'count': 6, 'avgtime': 869, 'avgtemp': 23.4}}

The result of run is a dict containing the same information as was printed by main.py above.

copycat's People

Contributors

alex-linhares avatar jalanb avatar jtauber avatar lsaldyt avatar quuxplusone 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

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.