Beispiel #1
0
// the functions below can be used to save
// the content of the dabase to the script file.
void Eliza::save_data() {
	scriptfile.open("script.txt", std::ios::out);
	if(scriptfile.fail()) {
		throw std::string("Can't save data");
	}
	saveComment(comments[0]);
	saveTopic(signOn, "S");
	
	saveComment(comments[1]);
	saveTransposTable();
	saveCorrections();
	saveComment(comments[2]);
	
	saveTopic(nullResponse, "N");
	saveComment(comments[3]);
	
	saveTopic(subjectRecall, "M");
	saveComment(comments[4]);

	saveTopic(noKeyWord, "X");
	saveComment(comments[5]);

	saveTopic(topicChanger, "Z");
	saveComment(comments[6]);

	saveTopic(inputRepeat, "W");
	saveComment(comments[7]);

	saveKeyWords();

	scriptfile.flush();
	scriptfile.close();
}
Beispiel #2
0
// the functions below can be used to save
// the content of the dabase to the script file.
void ofxEliza::save( string _scriptFile, string _unknownFile ){
    if( m_bNewData ) {
        scriptfile.open( ofToDataPath(_scriptFile).c_str(), std::ios::out);
        if(scriptfile.fail()) {
            throw std::string("Can't save data");
        }
        saveComment(comments[0]);
        saveTopic(signOn, "S");
        
        saveComment(comments[1]);
        saveTransposTable();
        saveCorrections();
        saveComment(comments[2]);
        
        saveTopic(nullResponse, "N");
        saveComment(comments[3]);
        
        saveTopic(subjectRecall, "M");
        saveComment(comments[4]);
        
        saveTopic(noKeyWord, "X");
        saveComment(comments[5]);
        
        saveTopic(topicChanger, "Z");
        saveComment(comments[6]);
        
        saveTopic(inputRepeat, "W");
        saveComment(comments[7]);
        
        saveKeyWords();
        
        scriptfile.flush();
        scriptfile.close();
    }
    saveUnknownSentences(_unknownFile);
}