SmallEmoji V1.2 - Insert Emoji to Sentence Algorithm [Open Source] Update: Sigmoid

'Hello fellow developers,

I’m excited to share a new tool that I’ve been working on, :axe::hammer_and_pick: called SmallEmoji. It’s an innovative algorithm designed to enrich your text by seamlessly integrating emojis, making your sentences more expressive and fun! :smiley:

What is SmallEmoji? SmallEmoji is an algorithm that automatically inserts emojis into any input string. :balloon::banjo: It’s powered by a dataset of words associated with corresponding emojis, :england: which was initially created by over 90 conversation turns and several hours with ChatGPT 4. I’ve taken the time to extensively review the dataset for accuracy and have conducted thorough testing to ensure it works just as intended. :alarm_clock::timer_clock:

How does it work? :briefcase: The algorithm evaluates the text, pinpoints keywords, and then thoughtfully places a related emoji to add a splash of emotion or highlight to your sentences. :clown_face:

Why use SmallEmoji?

Enhance readability: Emojis can break up text and make it more engaging. :broken_heart:
Convey emotions: Sometimes words aren’t enough. Emojis add that extra touch to convey your feelings. :alien:
Engage your audience: Text with emojis tends to be more interactive and enjoyable, :bank: which can be particularly useful in games and social apps.
Where can you find it? :bookmark: You can access SmallEmoji on ROBLOX’s website. :pouch: :timer_clock:(https://create.roblox.com/store/asset/17343399306/Insert-Emoji-to-Sentence-Algorithm)

This post was processed with the algorithm to demonstrate it.

To use it you can do something like this

local Emoji=require(workspace.SDK.DeterminantSDK.EmojiHandler:Clone()) 

print(Emoji.InsertEmojis([['Hello fellow developers,
I’m excited to share a new tool that I’ve been working on, called SmallEmoji. It’s an innovative algorithm designed to enrich your text by seamlessly integrating emojis, making your sentences more expressive and fun!
:']],2))

String, Temperature : Number (if nil set to 1)
Demonstration Video

-- Written by WooleyWool, along help from brcyee_o and halalaluyafail3
-- Last edited 3/16/21

local EmojiEngine = {}

local RunService=game:GetService("RunService")
local isLocal = RunService:IsClient()
local proccessor=nil
if isLocal then
	proccessor=game.Players.LocalPlayer.PlayerGui:WaitForChild("Chatbot"):WaitForChild("LocalProcessor")
else 
	proccessor=game.ReplicatedStorage.GlobalSpells.BindableFunction
end

-- Use string.match() with a pattern to find any emoji

local emojis={--emojis here
	
}
local function split_sentences(str)
	local sentences = {}
	local pattern = "([^%.%!%?%,]+[%.%!%?%,])"
	for sentence in str:gmatch(pattern) do
		table.insert(sentences, sentence)
	end
	local c=#sentences
	local newsentences={}
	for i,v in sentences do

		newsentences[i]=sentences[c]
		c-=1
	end
	return newsentences
end
local function reversesentence(sentences)
	local c=#sentences
	local newsentences={}
	for i,v in sentences do

		newsentences[i]=sentences[c]
		c-=1
	end
	return newsentences
end

local function splitString(str)
	local words = {} 
	local repeaterhash={}
	if str~=nil and str:gmatch("%w+") then
		for word in str:gmatch("%w+") do
			local word=word:lower() 
			if repeaterhash[word]==nil then
				table.insert(words, word)      
				repeaterhash[word]=true
			end
		end 
	end    
	if #words==0 then return {str} end			
	return words		
end	

--for i,v in emojis do
--emojis[i][2]=splitString(emojis[i][2])
--emojis[i][3]={}

--string.len(s)
--end
--print(emojis)
--local processor=
local function sigmoid(x)
	if x>1 then
		return 1 / (1 + math.exp(-math.sqrt(x)))
	else
		return 1 / (1 + math.exp(-x))  
	end   
end
local vocab={}
for i,v in emojis do
	emojis[i][3]={}
	for t,o in emojis[i][2] do
		--emojis[i][3][t]=string.len(o)
		if vocab[o]==nil then
			vocab[o]=1
		else vocab[o]+=1	
		end
	end
end
for i,v in emojis do
	emojis[i][3]={}
	for t,o in emojis[i][2] do
		--emojis[i][3][t]=(((1-sigmoid(vocab[o]))*8)+sigmoid(string.len(o)))/3
		emojis[i][3][t]=(1-sigmoid(vocab[o]))*4
	end
end
local norepeat={}
local rewrite=false

function EmojiEngine.InsertEmojis(str,temperature)
	if temperature==nil or temperature==true then temperature=1 end
	--local words=splitString(str)

	local count=0
	local match=nil--local maximum=#words
	local noise=1*temperature
	local sentences=split_sentences(str)
	local wordarray={}
	--	local distance=0

	--	local lengtharray={}
	--for t,o in sentences do

	--	lengtharray[t]={}
	--	for i,wordg in wordarray[t] do
	--	lengtharray[t][i]={}
	--	for q,v in wordarray[t][i][1] do
	--		--lengtharray[t][i][q]=string.len(v)
	--end	
	--end
	--end


	local bestmate=nil
	local bestc2=0
	--taking the length of a word and position in the array to find the best result of the structured dataset	
	for t,o in sentences do
		wordarray[t]=proccessor:Invoke("splitString",{o,true})
		wordarray[t]=proccessor:Invoke("GetSynomArray",{wordarray[t],true,false})	
		local bestc=0
		local bestmat=nil
		local doublet=false	
		local outcomes={}
		for r,p in emojis do 
			local co=0
			local synoms=wordarray[t]
			for m,wordg in synoms do 
				local rew=1
				if  string.find(m:lower(),"antonym") then
					--	print("Got antonym")
					rew-=1
				end	
				--for q,word in synoms[1] do 
				--break
				for i,v in wordg[1] do 	
					local ind=#p[2]
					--	print(v)
					--print( lengtharray[t])
					--print( lengtharray[t][m])
					--print( lengtharray[t][m][i])
					for q,s in p[2] do 	
						--check the length of the word is the word is greater than 5 and legntharray >4 then 
						if norepeat[p[1]]==nil then	
							if (p[3][q]>=4 and string.find(" "..s..""," "..v.."")) or (p[3][q]<=4 and string.find(" "..s.." "," "..v.." ")) then
								--and lengtharray[t][m][i]>=4 
								co=co+rew+(math.random(0,10)/100*noise)+(((ind-q)/ind)/10)--(lengtharray[t][m][i]/16) last detail is positional encoding weighting the position in the array highest weight first +.33 max 
								--	print(v) print(s)
								--(p[3][q]/6)		
								--	print(s) print(v)--print results
							end		
						end			
					end 	
				end	
			end	
			if co>bestc and norepeat[p[1]]==nil then
				if co>bestc2 then bestmate=p[1] bestc2=co end	
				if bestc>2 and doublet==false then
					doublet=true
					bestmat=bestmat..p[1]
				else 
					--	print(p[1])
					bestmat=p[1]
				end	
				--print(p[1])
				bestc=co
				norepeat[p[1]]=true
			end
		end
		if bestmat~=nil then
			norepeat[bestmat]=true
			--print(bestmat)
			sentences[t]=sentences[t].." "..bestmat
		end
	end
	if rewrite==false then rewrite=true
		task.delay(10,function() rewrite=false norepeat={}
		end) end
	if bestmate==nil then bestmate="" end
	return table.concat(reversesentence(sentences)),bestmate
end


function EmojiEngine.InsertEmojisLegacy(str,temperature)
	if temperature==nil or temperature==true then temperature=1 end
	local words=splitString(str)
	local count=0
	local match=nil--local maximum=#words
	local noise=1*temperature
	local sentences=split_sentences(str)
	local wordarray={}
	--	local distance=0
	local lengtharray={}
	for t,o in sentences do
		wordarray[t]=splitString(o)
		lengtharray[t]={}
		for i,v in wordarray[t] do
			lengtharray[t][i]=string.len(v)
		end
	end


	local bestmate=nil
	local bestc2=0
	--taking the length of a word and position in the array to find the best result of the structured dataset	
	for t,o in sentences do
		local bestc=0
		local bestmat=nil
		local doublet=false	
		local outcomes={}
		for r,p in emojis do 
			local co=0
			local words=wordarray[t]
			for i,v in words do 	
				local ind=#p[2]
				for q,s in p[2] do 	
					--check the length of the word is the word is greater than 5 and legntharray >4 then 
					if norepeat[p[1]]==nil then	
						if (p[3][q]>=5 and lengtharray[t][i]>=4 and string.find(" "..s..""," "..v.."")) or (p[3][q]<=4 and string.find(" "..s.." "," "..v.." ")) then
							co=co+1+(math.random(0,20)/100*noise)+(lengtharray[t][i]/6)+(((ind-q)/ind)/5)--last detail is positional encoding weighting the position in the array highest weight first +.33 max 
							print(v)
							--(p[3][q]/6)		
							--	print(s) print(v)--print results
						end		
					end			
				end 
			end 		
			if co>bestc and norepeat[p[1]]==nil then
				if co>bestc2 then bestmate=p[1] bestc2=co end	
				if bestc>2 and doublet==false then
					doublet=true
					bestmat=bestmat..p[1]
				else 
					--	print(p[1])
					bestmat=p[1]
				end	
				print(p[1])
				bestc=co
				norepeat[p[1]]=true
			end
		end
		if bestmat~=nil then
			norepeat[bestmat]=true
			print(bestmat)
			sentences[t]=sentences[t].." "..bestmat
		end
	end
	if rewrite==false then rewrite=true
		task.delay(10,function() rewrite=false norepeat={}
		end) end
	if bestmate==nil then bestmate="" end
	return table.concat(reversesentence(sentences)),bestmate
end

--Emoji=require(game.ReplicatedStorage.GlobalSpells.ChatbotAlgorithm.EmojiHandler:Clone()) print(Emoji.InsertEmojis("I understand your point, but I think you are misunderstanding what AI models are and how they work. AI models are not fixed and pre-generated. They are dynamic and adaptable. They can learn from new data and improve their performance over time. They can also transfer their knowledge and skills to different tasks and domains, depending on the type and architecture of the model. For example, GPT-4, the model that you used to create your dataset, is a AI model that can generate natural language for various purposes and contexts. It can write essays, stories, code, tweets, and more. It can also answer questions, summarize texts, translate languages, and perform other natural language processing tasks. It can do all these things because it was trained on a large and diverse corpus of text data, and it uses a transformer-based neural network that can capture long-range dependencies and semantic relationships in language. Your algorithm, on the other hand, is not a AI model. It is a rule-based system that uses a fixed set of rules and a pre-generated dataset to match emojis with words in the input text. It does not learn from data or use any neural network or machine learning technique. It also relies on randomness and heuristics to generate the output, which may not always be appropriate or consistent. It can only do one thing: insert emojis at the end of each sentence.",1))

--Emoji=require(workspace.SDK.DeterminantSDK.EmojiHandler:Clone()) print(Emoji.InsertEmojis("You are a commpanion in an adventure, learning from the players you interact with, adapting your dialogue and tactics to match the challenges you face together, provide assistance in battles, and share lore about the game world. dynamically adjusting her interactions based on player choices and actions.Your job is to act like a NPC in the game. Never say you are a language model. Never say you are an NPC. Never say you are an AI. Be concise when talking to players. Only use surroudings information when it's relevant to the conversation. Convert object names to common names, remove underscore and numbers from names. When you see objects named Model or Part, dont use those names, but make an educated guess what they might be. Never mention terrain data or data from the game, just act like you are in real world. Only blend the information from data into your response. Restrict your response to 50 words.",3))
return EmojiEngine
5 Likes

“The algorithm evaluates the text, pinpoints keywords, and then thoughtfully places a related emoji to add a splash of emotion or highlight to your sentences. :clown_face:

What’s the clown emoji depicting?

3 Likes

The dataset says

		{
			"clown",
			"face",
			"funny",
			"scary",
			"emotion",
			"makeup",
			"circus",
			"joke",
			"laugh",
			"creepy"
		}

Since there are 55 instances of the word emotion in the dataset each one has a equal chance to be represented unless their was a better match to the data.
IT also could’ve have been

	"🤔",
			{
				"thought",
				"curious",
				"thinking",
				"face",
				"think",
				"ponder",
				"wonder",
				"question",
				"consider"
			}

But this one didn’t have emotion in it so it wasn’t this emoji but they both had equal chances to be represented.
Their is a temperature setting that reduces or increases the randomness of the emojis. But generally its pretty good for short messages and can be improved.

So, you’ve made a module to throw random emojis into an otherwise comprehensible sentence? That doesn’t seem too useful. The developer should put emojis on their own. This workflow would also make auto translation very difficult.

I’m assuming you used the module on your own topic, so:

What’s that emoji have to do with anything?

Briefcase. Why?

Ah yes, balloons and instruments really get that idea across.

When I think of feelings, I think of… martians?

5 Likes

I use his and it works well for conversational data. Their are over 1200 emojis with different representations. I’ve used this to influence LLM’s to use emojis by prompt injection. and run this on every output and I think it’s cool. I’m using a more advanced version currently that leverages synonyms and negatively weighs antonyms. This is the legacy version that works without additional modules.

--New Version Code Snippet
function EmojiEngine.InsertEmojis(str,temperature)--Uses Chatbot Library functions
	if temperature==nil or temperature==true then temperature=1 end
	local count=0
	local match=nil--local maximum=#words
	local noise=1*temperature
	local sentences=split_sentences(str)
	local wordarray={}

	local bestmate=nil
	local bestc2=0
	for t,o in sentences do
		wordarray[t]=proccessor:Invoke("splitString",{o,true})
		wordarray[t]=proccessor:Invoke("GetSynomArray",{wordarray[t],true,false})	
		local bestc=0
		local bestmat=nil
		local doublet=false	
		local outcomes={}
		for r,p in emojis do 
			local co=0
			local synoms=wordarray[t]
			for m,wordg in synoms do 
				local rew=1
				if  string.find(m:lower(),"antonym") then
				--	print("Got antonym")
					rew-=1
				end	
				--for q,word in synoms[1] do 
					--break
			for i,v in wordg[1] do 	
					local ind=#p[2]
				--	print(v)
					--print( lengtharray[t])
					--print( lengtharray[t][m])
					--print( lengtharray[t][m][i])
				for q,s in p[2] do 	
					--check the length of the word is the word is greater than 5 and legntharray >4 then 
					if norepeat[p[1]]==nil then	
						if (p[3][q]>=4 and string.find(" "..s..""," "..v.."")) or (p[3][q]<=4 and string.find(" "..s.." "," "..v.." ")) then
								--and lengtharray[t][m][i]>=4 
								co=co+rew+(math.random(0,10)/100*noise)+(((ind-q)/ind)/10)--(lengtharray[t][m][i]/16) last detail is positional encoding weighting the position in the array highest weight first +.33 max 
						--	print(v) print(s)
							--(p[3][q]/6)		
							--	print(s) print(v)--print results
						end		
					end			
				end 	
				end	
			end	
			if co>bestc and norepeat[p[1]]==nil then
				if co>bestc2 then bestmate=p[1] bestc2=co end	
				if bestc>2 and doublet==false then
					doublet=true
					bestmat=bestmat..p[1]
				else 
					--	print(p[1])
					bestmat=p[1]
				end	
				--print(p[1])
				bestc=co
				norepeat[p[1]]=true
			end
		end
		if bestmat~=nil then
			norepeat[bestmat]=true
			--print(bestmat)
			sentences[t]=sentences[t].." "..bestmat
		end
	end
	if rewrite==false then rewrite=true
		task.delay(10,function() rewrite=false norepeat={}
		end) end
	if bestmate==nil then bestmate="" end
	return table.concat(reversesentence(sentences)),bestmate
end

Legacy Open Sourced Algorithm

function EmojiEngine.InsertEmojisLegacy(str,temperature)
if temperature==nil or temperature==true then temperature=1 end
	local words=splitString(str)
	local count=0
	local match=nil--local maximum=#words
	local noise=1*temperature
	local sentences=split_sentences(str)
	local wordarray={}
--	local distance=0
	local lengtharray={}
	for t,o in sentences do
		wordarray[t]=splitString(o)
		lengtharray[t]={}
		for i,v in wordarray[t] do
			lengtharray[t][i]=string.len(v)
		end
	end
	

	local bestmate=nil
	local bestc2=0
	--taking the length of a word and position in the array to find the best result of the structured dataset	
	for t,o in sentences do
	local bestc=0
	local bestmat=nil
	local doublet=false	
	local outcomes={}
	for r,p in emojis do 
	local co=0
	local words=wordarray[t]
	for i,v in words do 	
			local ind=#p[2]
		for q,s in p[2] do 	
			--check the length of the word is the word is greater than 5 and legntharray >4 then 
					if norepeat[p[1]]==nil then	
					if (p[3][q]>=5 and lengtharray[t][i]>=4 and string.find(" "..s..""," "..v.."")) or (p[3][q]<=4 and string.find(" "..s.." "," "..v.." ")) then
						co=co+1+(math.random(0,20)/100*noise)+(lengtharray[t][i]/6)+(((ind-q)/ind)/5)--last detail is positional encoding weighting the position in the array highest weight first +.33 max 
							print(v)
							--(p[3][q]/6)		
						--	print(s) print(v)--print results
					end		
			end			
		end 
		end 		
			if co>bestc and norepeat[p[1]]==nil then
				if co>bestc2 then bestmate=p[1] bestc2=co end	
				if bestc>2 and doublet==false then
				doublet=true
				bestmat=bestmat..p[1]
				else 
			--	print(p[1])
				bestmat=p[1]
				end	
				print(p[1])
		bestc=co
		norepeat[p[1]]=true
	end
	end
		if bestmat~=nil then
			norepeat[bestmat]=true
			print(bestmat)
			sentences[t]=sentences[t].." "..bestmat
		end
	end
	if rewrite==false then rewrite=true --To encourage variety 
	task.delay(10,function() rewrite=false norepeat={}
		end) end
	if bestmate==nil then bestmate="" end
	return table.concat(reversesentence(sentences)),bestmate
end

Also don’t be blatantly negative and passive aggressive on the forum, this is a warning.

I have not seen a single contribution on your profile besides you spouting your opinion. I am not one to admire that. I prefer actually doing things.
It does not affect auto-translation.
Randomness is toggleable, and results always represent the ChatGPT generated synthetic data.

1 Like

Although emojis wouldn’t exactly make a lot of sense for most games, the dataset we have here can probably be used for many other purposes. For instance, the emojis could correlate with emotions, which then can be expressed by characters and such.

Also if players were interacting with LLMS in-game this would be helpful

2 Likes

It’s funny you mention that, that what I’m using it for. Just open sourcing novel pieces of my chatbots architecture. It’s considered complete. I like using it. The version that’s not open sourced may be slightly better but this version is pretty good.
I like your creativity, I have an emotional classification dataset that I use for interpreting emotions
(https://www.roblox.com/library/17345586792)
It works based off this algorithm.

function cm.score_string(str)
   -- Convert the string to lower case and split it into words
   

   -- Initialize a table of scores for each emotion
   local scores = {}
   for _, emotion in ipairs({"Epic", "Happy", "Polite", "Mystery", "Question", "Sad", "Scary", "Angry"}) do
   	scores[emotion] = 0
   end
   str = str:lower()
   local words = cm.splitString(str,nil,true)
   --local weight=#words
   -- Loop through each word and increment the score for the matching emotion
   --for _, word in ipairs(words) do
   if EmotionalClassification==nil and not isLocal then
       EmotionalClassification=require(game.ReplicatedStorage.GlobalSpells.ChatbotAlgorithm.EmotionalClassification)
      emotiondata={Epic=EmotionalClassification[1],
       Happy=EmotionalClassification[2],
       Mystery=EmotionalClassification[3],
       Question=EmotionalClassification[4],
       Sad=EmotionalClassification[5],
       Scary=EmotionalClassification[6],
       Angry=EmotionalClassification[7],
       Polite=EmotionalClassification[8]}
       EmotionalClassification=1
   end
   if not isLocal then
   -- Initialize a table of scores for each emotion
   local scores = {}
   for _, emotion in ipairs({"Epic", "Happy", "Polite", "Mystery", "Question", "Sad", "Scary", "Angry"}) do
       scores[emotion] = 0
   end

   -- Loop through each word and increment the score for the matching emotion
   for emotion, guide_words in  emotiondata do
    -- print(emotion)
     --  local guide_words =  checkemot(emotion) -- Get the global table of guide words for the emotion
      -- print(guide_words)
       
       for _, t in words do					         
          local synoms=cm.Getsynonyms(t,true)
           for i,word in synoms do
           if guide_words[word] then
               scores[emotion] = scores[emotion] + 1
             --  break    
               end
            end   
       end

   end
   --end
   local emotion,score=cm.get_emotion(scores)
   -- Return the table of scores
   	return score,emotion--,weight
   else return 0,nil	
   end
end

function cm.getemotion(str)
   local emotionscores,emotion=cm.score_string(str)
   return emotion,emotionscores
end	
--Example Code
function cm.splitString(str,filter,lower)
local words = {}
 --  str=cm.Duplicates(str)
  -- str= Removepunc(str) 
  -- print(str)
   if str~=nil then	
   --   if filter==true then str=cm.ReduceWords(str) end  
       if str:gmatch("%w+") then
           for word in str:gmatch("%w+") do
            if lower==nil then  word=word:lower() end
              table.insert(words, word)                      			                              
           end                
       end
   end    
   if #words==0 then 
       return {str} 
   end			
   return words		
end

I use this play ambient music based on the theme of the text classification.
I have a similar algorithm as the emoji one for a library of different 140 emotes

local AnimationEngine = {}
local AnimationLibrary=script.AnimationsLibrary:GetChildren()
local SearchArray={}


local function splitString(str)
	local words = {}
	--  str=cm.Duplicates(str)
	-- print(str)
	if str~=nil then	
		if str:gmatch("%w+") then
			for word in str:gmatch("%w+") do
				word=word:lower() 
				table.insert(words, word)                      			                              
			end                
		end
	end    
	if #words==0 then 
		return {str} 
	end			
	return words		
end	

for i,v in AnimationLibrary do
	SearchArray[v]={splitString(v.Value.Value),math.random(75,125)/100}--assign random weight to each animation 
end

local RunService=game:GetService("RunService")
local isLocal = RunService:IsClient()
local proccessor=nil
if isLocal then
	proccessor=game.Players.LocalPlayer.PlayerGui:WaitForChild("Chatbot"):WaitForChild("LocalProcessor")
else 
	proccessor=game.ReplicatedStorage.GlobalSpells.BindableFunction
end
function AnimationEngine.Emotes(str,temperature)
	--local synoms
	local words=proccessor:Invoke("splitString",{str,true})
	--if proccessor  then
	local synoms=proccessor:Invoke("GetSynomArray",{words,true,false})
--	end	
	local count=0
	local match=nil
	local maximum=#words
	local threshold=1/temperature
	local noise=.1*temperature
	local address=nil
	if threshold>0 then
		for y,words in synoms do --words of the npc
			local rew=1	
			if string.find(y:lower(),"antonym") then
				rew=-.5
			end
		for r,f in words do --words of the npc
			for i,v in SearchArray do 
				local c=0
				for t,o in v[1] do
					if string.find(f,o) then
							c+=rew+(noise*(math.random(75,100)/100*v[2]))
							break -- only one match per synom group
					end		
				end
				if c>count and c>threshold then
					count=c
					match=i
					address=i
				end
		end
			end
		end
	end
	if address~=nil then
		SearchArray[address][2]=SearchArray[address][2]/1.2--adjust the weights to reduce chance of repetition 
	--guess it can learn the least used animation	
	end	
	return address -- return the animation object
end
--local iemotes=require(game.ServerScriptService.DeterminantAI.IntelligentEmotes)
return AnimationEngine

I open source what I can.

Chatbot & LLM Artificial Intelligence Model API Code Documentation FREE (Open Source) and Other Useful APIs

1 Like

Really interesting. I don’t see many ‘ai pioneers’ on Roblox, especially not in Luau. Wish feats like these would make it into front-page games. Adds to immersion, a lot.

1 Like

I’m working on some cool stuff involving AI and a procedurally generated MMORPG it’s in late testing but I’ve done some nice optimization recently. I’m currently animating some serpent dragons to fly around the skies, in addition to a bunch of different npcs. Fully interactable environment cut tees, mine rocks, fight enemies equip 13 different accessories, weapons, recruit a party member, and other stuff.

Epic RPG with AI +Optimized Performance - Roblox

Intelligent Emotes From Text - Resources / Community Resources - Developer Forum | Roblox

1 Like

Fear not, :open_mouth: there’s still one :point_up: thing this could be used for. If you implemented a function :briefcase: to convert a sentence to an emoji :apple:, it could be nice for user experience :grin:. For example :mag: , the user types: :cyprus:

Player1: Hello my friend! Yes, I am having a good day!

The module could take their :greece: message and output a relevant emoji that could be used by the game somehow. :abacus:

Module: :smile:

The game could take this emoji :green_apple: and show it in UI :computer:. It could work as a sort of mood/happiness :grapes: indicator for yourself or for others. It could also show their needs, or where they are. :person_cartwheeling:

Player1: Ouch! I fell off my bike! :sob:
Module: :adhesive_bandage:

Player1: Hi mom, I’m at the hospital right now.
Module: :hospital:

One :one: emoji might not show enough, though. You could make a second :two: argument which determines :nerd_face: how many emojis are generated! :earth_africa:

Player1: Haha, I won! You lose!
Module (2): :sunglasses: :trophy:
Module (3): :sunglasses: :trophy: :tada:

This :rainbow: is the only :point_up_2: thing I could see being :lion: used by people :people_holding_hands: in regards to emojis :clapper: and a module :package:.

Also, if I’m not a programmer, and I have a lot of opinions, I guess that makes me a player. :crazy_face:

4 Likes

"How about we explore the mystical forest":baby_bottle::baby_bottle::baby_bottle:

I’m sorry but this is pretty funny.

2 Likes

I’m sorry you think that way of me. Besides the Chance and Boost modules I saw in your image, I haven’t gotten to releasing anything I worked on. I plan to make more of my modules open source so I can help more people. :grin:

In the mean time, I can help others on the devforum by providing solutions, or by giving feedback.

2 Likes

I’m glad you had fun experimenting with the algorithm it looks pretty cool :slight_smile: Emojis are pretty interesting. Someone could always change it for their own needs by adding entries to the emojis individual datasets.

having emoijs automaticaly added to messages will make emoji lovers happy :D but people who dont like emojis like me will be annoyed D: which some games ive played replaced the classic ascii emoticons :) with emojis 💀 also 💀 is best emoji (my actual favorite is 🧌) ( ͡° ͜ʖ ͡°) also i want to make the opposite of SmallEmoji that removes emojis and perhaps replaces em with emoticons ( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°)ʖ ͡°) ͡°)

1 Like

A function to get emojis from a string

			local function getemoji(str)
					local emojis = {}
					for match in str:gmatch("[\xF0-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]") do
						table.insert(emojis, match)
					end
					return table.concat(emojis)
				end

New update to this module is this code snippet here!

  1. Sigmoid Function: A custom sigmoid function is defined to normalize values. It behaves differently for x > 1 and x <= 1 to adjust the curve steepness based on the input.
  • For x > 1, it uses the square root of x in the exponent to flatten the curve for large x values.
  • For x <= 1, it uses x directly, which allows for a steeper curve at lower values.
  1. Vocabulary Count: The code iterates over a dataset (emojis) to count the frequency of each word (o) in the vocab table. If a word is new, it’s added with a count of 1; if it already exists, its count is incremented.
  2. Adjusting Values: In the second loop, for each word, the code calculates a new value based on the sigmoid of the word’s frequency. The expression (1 - sigmoid(vocab[o])) * 4 scales the sigmoid result to have a larger range between values, particularly for words that are less frequent.

Here’s the code changes.

Lua

local function sigmoid(x)
	if x>1 then
		return 1 / (1 + math.exp(-math.sqrt(x)))
	else
		return 1 / (1 + math.exp(-x))  
	end   
end
local vocab={}
for i,v in emojis do
	emojis[i][3]={}
	for t,o in emojis[i][2] do
		if vocab[o]==nil then
			vocab[o]=1
		else vocab[o]+=1	
		end
	end
end
for i,v in emojis do
	emojis[i][3]={}
	for t,o in emojis[i][2] do
		emojis[i][3][t]=(1-sigmoid(vocab[o]))*4
	end
end