Пример #1
0
/*
*   Get the context path of a .grxml grammar, and return it as a string
*
*/
string ears::grammarToString(string sPath)
{
    string sOutput = "";
    ifstream isGrammar(sPath.c_str());

    if (!isGrammar)
    {
        yInfo() << "Error in ears::grammarToString. Couldn't open file : " << sPath << ".";
        return "Error in ears::grammarToString. Couldn't open file";
    }

    string sLine;
    while (getline(isGrammar, sLine))
    {
        sOutput += sLine;
        sOutput += "\n";
    }

    return sOutput;
}
string LanguageActionAnalysis::grammarToString(string sPath)
{
    string sOutput = "";
    ifstream isGrammar(sPath.c_str());

    if (!isGrammar)
    {
        cout << "Error in LanguageActionAnalysis::grammarToString. Couldn't open file : " << sPath << "." << endl;
        return "Error in LanguageActionAnalysis::grammarToString. Couldn't open file";
    }

    string sLine;
    while( getline(isGrammar, sLine) )
    {
        sOutput += sLine;
        sOutput += "\n";
    }

    return sOutput;
}
Пример #3
0
/*
*	Get the context path of a .grxml grammar, and return it as a string
*
*/
string reservoirHandler::grammarToString(string sPath)
{
    string sOutput = "";
    ifstream isGrammar(sPath.c_str());

    if (!isGrammar)
    {
        cout << "Error in reservoirHandler::grammarToString. Couldn't open file : " << sPath << "." << endl;
        return "Error in reservoirHandler::grammarToString. Couldn't open file";
    }

    string sLine;
    while( getline(isGrammar, sLine) )
    {
        sOutput += sLine;
        sOutput += "\n";
    }

    return sOutput;
}
Пример #4
0
string speechInteraction::grammarToString(string sPath)
{
    string sOutput = "";
    ifstream isGrammar(sPath.c_str());

    if (!isGrammar)
    {
        string sErrorMessage = " Error in qRM::grammarToString. Couldn't open file : " + sPath;
        sErrorMessage += " .";
        yInfo() << sErrorMessage;
        return sErrorMessage;
    }

    string sLine;
    while (getline(isGrammar, sLine))
    {
        sOutput += sLine;
        sOutput += "\n";
    }

    return sOutput;
}