Hiya! I’m working on a very small-scale language model called Seashell that uses a constantly fine-tuned and updated custom data table. The data table has three columns: word, type, meaning. Word is the actual word, like “hello”, type classifies a word as good or bad using the terms “yes” or “no”, and meaning is the general meaning of the word. For example: hello, yes, greeting, or stupid, no, insult. Right now, I’m testing language filtering, with the help of the “type” column. If a word’s type is “no”, the AI can’t use it and will not respond to it. I’ve made a small and simple code structure that tests if the word a user inputs is in the database, and based on its type displays a label stating if the word is positive or negative. If it cannot be found in the database, it returns with “word not found”. For some reason, it freezes when web testing on my MacBook, and all other computers I try to test it on, and doesn’t do anything on button click when live testing on my phone. I will attach the code snippets and link below, would appreciate if anyone could get back to me. Thanks!
Can you show a screenshot of the user interface please so we can see front and back side? Also all blocks related to this screen would be helpful. You can remove any sensitive ones.
You’re trying to do to much in a loop that repeats immediately with no delay. For example, getting a value from a database is going to take some time but your blocks are going to fire the next iteration of the loop a split second after that before all of those values have populated.
It looks like a really complicated way to do what you described. Try this instead:
set app variable input to maininput’s Text
if in list [list of values in dataset in Table 1 in word] find first occurrence of item [app variable input] > 0
do
…set app variable wordtype to get value from dataset in Table 1 in type
…if app variable wordtype = “yes”
…do
… …continue with existing blocks here
Ok so I am assuming you enter your word into the ‘lets chat’ box and it is supposed to tell me if the word is good or bad while in testing, is that right?
Yes, that’s correct. During testing, I input a word into the “Let’s chat” box and it will return the label on top as either negative/positive or word not found.
Ok. I also cant remember if I change things with the link if it changes on your end or not. If it does please make sure to make a backup copy just in case please.
I’m pretty sure the link automatically makes a copy of the project onto your account that you can edit. You’ll have to send me the link of your version of the project once your done.
This works, thanks! Most of the variables are irrelevant. I’ll delete them. In the actual model, the value won’t be assigned to a label, but instead a variable. The app will test this variable to see if the value returns “yes” or “no”. I’ll also keep this discussion open for any questions. Thanks so much!!!
No problem. One thing to keep in mind. I used the lower case block because the search will be case sensitive. Ive found it is best when testing to see if a word(s) is in a list that both the search and return are either in capitals or lowercase letters. Please mark my post as the solution if it solved your issue. Thank You and Good Luck!
Oh, okay. Will keep in mind. One question, does the code only look for first occurrence? Like for example, if the user types in “hello, stupid” what will it return?
I’m also planning to add a dedicated “response” column to the dataset and use your same technique to display it. For example, “hi, yes, greeting, Hi!”. This way the code can merge different responses, like “Hi! I’m fine, and you?” in responses to “hi how are you”. What are your thoughts on this and what’s a good way to get it done?
The way I showed you it would search for whatever text is in that textbox and look for the first exact match. Ok, so youre looking to make a chatbot so to speak? That would need a much more complex filter but I assume it could be done.