package org.studiorailgun.kobold;

/**
 * Symbol tables for kobold parsing
 */
public class KoboldSymbols {

    /**
     * A list of symbols we do not want to appear in the output
     */
    public static final String[] BANNED_SYMBOLS = new String[]{
        "Note:",
        "**Note**:",
        "support:",
        "Follow-up Questions:",
        "Answer:",
        "Prompt:",
        "---",
        "\\n\\n",
        "Response to the instruction:",
    };
    
    /**
     * Checks if the input contains a banned symbol
     * @param input The input
     * @return true if it contains a banned symbol, false otherwise
     */
    public static boolean containsBannedSymbol(String input){
        for(String symbol : BANNED_SYMBOLS){
            if(input.contains(symbol)){
                return true;
            }
        }
        return false;
    }

    /**
     * Removes banned symbols from the input
     * @param input The input
     * @return The input with banned symbols removed
     */
    public static String removeBannedSymbol(String input){
        String target = input;
        while(KoboldSymbols.containsBannedSymbol(target)){
            for(String symbol : BANNED_SYMBOLS){
                if(input.contains(symbol)){
                    target = target.split(symbol)[0];
                    break;
                }
            }
        }
        return target;
    }

}
