## # @file load_scm_file.py # @brief load data from scheme file to atomspace # @author Dingjie.Wang # @version 1.0 # @date 2012-08-04 from opencog.atomspace import types, TruthValue, AtomSpace, confidence_to_count from viz_graph import Viz_Graph from types_inheritance import name_type_dict, is_a from m_util import Logger, dict_sub from m_adaptors import FakeAtom, output_atomspace #import atomspace_abserver from m_util import rough_compare_files log = Logger("diff") log.to_file = True #log.add_level(Logger.DEBUG) log.add_level(Logger.INFO) ## # @brief :load every segment( the previous line begin with '(' to previous line) to atomspace # # @param a: atomspace # @param tree : an instance of Viz_Graph # @param root : root of subtree # # @return def add_tree_to_atomspace(a, tree, root): ''' add nodes of a tree to atomspace in postorder ''' out = [] fakeatom = tree.get_node_attr(root)['atom'] if not tree.neighbors(root):
## # @file load_scm_file.py # @brief load data from scheme file to atomspace # @author Dingjie.Wang # @version 1.0 # @date 2012-08-04 from opencog.atomspace import types, TruthValue, AtomSpace, confidence_to_count from viz_graph import Viz_Graph from types_inheritance import name_type_dict, is_a from m_util import Logger, dict_sub from m_adaptors import FakeAtom, output_atomspace #import atomspace_abserver from m_util import rough_compare_files log = Logger("diff") log.to_file = True #log.add_level(Logger.DEBUG) log.add_level(Logger.INFO) ## # @brief :load every segment( the previous line begin with '(' to previous line) to atomspace # # @param a: atomspace # @param tree : an instance of Viz_Graph # @param root : root of subtree # # @return def add_tree_to_atomspace(a, tree, root): ''' add nodes of a tree to atomspace in postorder ''' out = []
from opencog.atomspace import AtomSpace, types from load_scm_file import load_scm_file from m_util import Logger, time_interval import fishgram import m_adaptors import adaptors log = Logger("pre_fishgram.log") log.add_level(Logger.DEBUG) def load_file(): '''docstring for load_file''' a = AtomSpace() load_scm_file(a, "air.scm") return a #fish.forest.extractForest() def run_fishgram(a): reload(fishgram) time_interval.start() fish = fishgram.Fishgram(a) log.debug(" filtering data set...") fishgram.notice_changes(a) fish.forest.extractForest() time_interval.end() log.debug("**take %s seconds on filtering**" % time_interval.interval()) log.debug("mining patterns...") time_interval.start() fish.run() time_interval.end()
from opencog.atomspace import AtomSpace, types from load_scm_file import load_scm_file from m_util import Logger, time_interval import fishgram import m_adaptors import adaptors log = Logger("pre_fishgram.log") log.add_level(Logger.DEBUG) def load_file(): '''docstring for load_file''' a = AtomSpace() load_scm_file(a, "air.scm") return a #fish.forest.extractForest() def run_fishgram(a): reload(fishgram) time_interval.start() fish = fishgram.Fishgram(a) log.debug(" filtering data set..." ) fishgram.notice_changes(a) fish.forest.extractForest() time_interval.end() log.debug("**take %s seconds on filtering**"% time_interval.interval()) log.debug("mining patterns..." ) time_interval.start() fish.run() time_interval.end() log.debug("**take %s seconds on mining**"% time_interval.interval()) log.flush() def run_test(a):