# This file is part of Aenea # # Aenea is free software: you can redistribute it and/or modify it under # the terms of version 3 of the GNU Lesser General Public License as # published by the Free Software Foundation. # # Aenea is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public # License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with Aenea. If not, see . # # Copyright (2014) Alex Roper # Alex Roper from aenea import Grammar, MappingRule, Text grammar = Grammar('hello world aenea') print 'Aenea hello world grammar: Loaded.' class TestRule(MappingRule): mapping = { 'test hello world remote grammar': Text('Aenea remote setup operational'), } grammar.add_rule(TestRule()) grammar.load() def unload(): global grammar if grammar: grammar.unload() grammar = None