Download Code from Sigmasigmajohnconner/Iamsteve: direct link, hf CLI and curl.
- Browser
- Download file 1.59 kB
-
https://huggingface.co/Sigmasigmajohnconner/Iamsteve/resolve/main/Code
- Command line
-
hf download hf://Sigmasigmajohnconner/Iamsteve/Code
-
curl -L -o Code https://huggingface.co/Sigmasigmajohnconner/Iamsteve/resolve/main/Code
1.59 kB
| -- Voltage Chatbot Lua Script | |
| math.randomseed(os.time()) | |
| -- Memory system | |
| local memory = {} | |
| -- Knowledge base | |
| local knowledge = { | |
| greetings = {"Hello!", "Hi there!", "Hey!", "Greetings!"}, | |
| farewell = {"Goodbye!", "See you later!", "Take care!"}, | |
| weather = {"It looks sunny today!", "Might rain later, take an umbrella!"}, | |
| technology = {"AI is fascinating!", "Technology evolves rapidly!"}, | |
| activities = {"What do you like to do for fun?", "I enjoy chatting with you!"} | |
| } | |
| -- Function to get a response from a category | |
| local function get_response(category) | |
| if knowledge[category] then | |
| return knowledge[category][math.random(#knowledge[category])] | |
| else | |
| return "I am not sure about that." | |
| end | |
| end | |
| -- Function to update memory | |
| local function update_memory(input) | |
| for word in string.gmatch(input, "[%w']+") do | |
| memory[word] = (memory[word] or 0) + 1 | |
| end | |
| end | |
| -- Function to find a matching category | |
| local function match_category(input) | |
| for category, phrases in pairs(knowledge) do | |
| for _, phrase in ipairs(phrases) do | |
| if string.find(string.lower(input), string.lower(phrase)) then | |
| return category | |
| end | |
| end | |
| end | |
| return nil | |
| end | |
| -- Main chatbot loop | |
| while true do | |
| io.write("You: ") | |
| local input = io.read() | |
| if input:lower() == "exit" then break end | |
| update_memory(input) | |
| local category = match_category(input) | |
| local response = category and get_response(category) or "I am still learning!" | |
| print("Voltage: " .. response) | |
| end | |