#!/usr/bin/python """ NIPyLL: Non-Intelligent Python Language-Learner A Python emulation of the original NIALL (Non-Intelligent AMOS Language- Learner). NIPyLL receives conversational sentences from the user, builds multisets recording which words follow other words. NIPyLL then responds with a chain of words, built using this information, often producing gibberish, sometimes producing acceptable or amusing sentences. Usage: nipyll.py [ file ] You are free to use, modify or distribute this program under the terms of the GNU General Public License: http://www.gnu.org/copyleft/gpl.html Author: Chris Reece See also: http://www.jessies.org/~car/projects/nipyll/ """ from Lexicon import * import sys if __name__ == '__main__': fileName = None if len(sys.argv) > 1: fileName = sys.argv[1] lexicon = Lexicon(fileName) lexicon.prime('parrot.niplex') print lexicon.talk() while True: try: string = raw_input('> ') except EOFError: break else: lexicon.listen(string) print lexicon.talk()