? Swype Keyboard ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password
[Help Wanted] SmileBASIC Documentation Project

Swype Keyboard

Submitted
Updated
Author
MZ952
Public Key
JRTE3KNV
Min. Compat.
All
Rating
10 votes
Description Swype has been updated to make amends for the problems it had the last runaround. The algorithm is now faster and can easily handle larger libraries (the library in this update has 10k words). I've added comments throughout the code to make everything more understandable. You can easily port this over into your own programs, so long as you're careful with copying over all the functions and the global variables too. This also includes a custom keyboard function—which itself is fairly flexible—because the default keyboard will not work for this. This may be the only update I give for this, unless I get some JN brainblast sort-o-thing to help me figure out how to introduce the touch-vector observation/analyzation necessary for higher right-return accuracy. Instructions Use your finger or stylus to Swype across the keyboard.
Categories
Keywords
31 Comment(s) snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements OSP Contest 2 Contest Participant I participated in the second SmileBASIC Source OSP Contest! Night Person I like the quiet night and sleep late. Express Yourself I would suggest against calling this "Swype" since that's a copyrighted name. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Perhaps you're right. GamerCymreig GamerCymreig Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength Pokemon Is Awesome! I love Pokemon! Express Yourself Video Games I like to play video games! Hobbies Cool work! I wonder if someone would do it in another language or maybe built-in a game. spaceturtles spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Just translate the keyboard's dictionary for another language. You can also impliment it in a game by replacing the INPUT call(s) with calls to this keyboard program. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements OSP Contest 2 Contest Participant I participated in the second SmileBASIC Source OSP Contest! Night Person I like the quiet night and sleep late. Express Yourself It would be really interesting if this worked with the built-in keyboard, which is theoretically possible. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies *theoretically not possible. Try swiping across that keyboard, perhaps run a little while loop and observe the keyboard output. The keyboard likes to find button repeats and it acts pretty weird because of that. 12Me21 12Me21 Head Admin Second Year My account is over 2 years old Website Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself You could use TOUCH, and just treat the keyboard as a background "image" though at that point I'm not sure what the benefits would be... MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Yeah, that was thought of as well. I had actually wrote some code that automatically mapped out the dimensions of each key by wiggling the stylus across each key horizontally and vertically, observing when the return was either the key or an empty string. The result was an output of data containing each rectangular key's boarder. It was a fun gimmick, but I think I'm going to try to take this idea somewhere else, so I wrote my own keyboard to supplement. amihart amihart This is pretty cool concept. I don't know if the library is just small or if it's just buggy but half the words I try don't work. The other half work pretty well though. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Thanks! It might just be buggy. My current working version is pretty stable with 10k words. The most prominent troubles I'm coming across are misreadings. Often "quote" vs "quite", "people" vs "pierre", that kind of thing. UnderCake UnderCake Halloween 2017 Contest Runner Up I placed 2nd in the SmileBASIC Source Halloween 2017 Contest! Programming Contest Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength First Year My account is over 1 year old Website I was saddened to see no iteration of the word "cake" in there. Get me the word cake and I'll thumbs up. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies My current working version (not yet updated) has cake and cakes. UnderCake UnderCake Halloween 2017 Contest Runner Up I placed 2nd in the SmileBASIC Source Halloween 2017 Contest! Programming Contest Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength First Year My account is over 1 year old Website Yay MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies I've made some serious progress with the speed issue with larger libraries. I can't see it being an issue in the future. I may post an updated version sooner or later. Let's see if I can implement some more features first. spaceturtles spaceturtles Video Games I like to play video games! Hobbies Avatar Block I didn't change my avatar for 30 days. Website Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Nice. I wonder if I can combine this with an SB IDE. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Shhhhh... I may or may not already be developing that Amoura Amoura Deep Sleep Hidden Website I love Swype Guzzler Guzzler First Week Joined in the very first week of SmileBASIC Source Website Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Really neat. I made my own, longer list of words(10,000) and tried it. It was much slower. Anyway, neat concept. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Much slower you say? I think I can fix that. Edit: is your 10k list SORTed? Guzzler Guzzler First Week Joined in the very first week of SmileBASIC Source Website Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Alphabetically, yes. Guzzler Guzzler First Week Joined in the very first week of SmileBASIC Source Website Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Wait, I misunderstood. I honestly don't know what SORT does lol. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies That may be a factor. I can't see why it would be so slow, because in the initial phase of the algorithm, it trims down your list to a tiny fraction containing phrases with only the beginning and end characters. From 10,000, you'd only expect at most a hundred such entries (if consistency prevails). It really shouldn't be that bad. I'll give it a test with a 10k word dump later on. amihart amihart A sorted list of size 2,500 should only take 12 iterations to find any item in the list, and a sorted list of 10,000 should only take 14 iterations to find any item in the list. Increasing the size of the dictionary should not cause slow down in something like this. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Okay, so I took a decent shower and it quickly occurred to me that every time you call the Swype function, it runs through the entire library once in a FOR loop. This must be the issue, because running through a string array of 10,000 indexes is consuming. I could remove that function and add another argument to the Swype function that calls for a kind of metadata which points to where each sub-alphabetical list of entries are. So basically, I wouldn't need to search your entire library to know where "t" starts, I could simply run through it once and store that information. Hell, if I create a new sorting algorithm that best suits my needs, I'd really be in business, because the next slowest thing is pretty much the same thing as the last problem except it runs through all of the entries it initially pulled from the first run-through, looking for entries sharing the same end-character. The sorting function would need to sort entries alphabetically only by the first and end characters, disregarding all characters in between. Yes, such a function would really boost the speed ... MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies @amihart Well, I am performing a check on each element in the array, and I am also pushing information from that check onto a new stack, so it's a little more than just running through the array. amihart amihart If your array is sorted and you're running through each element, you're doing something wrong. There's always a faster way if the data is sorted. Such as, if you are just doing a single lookup in a list of size 10k, it would take 14 iterations to find any element using a binary search (doing 10k iterations through the whole thing is overkill). Depending on what exactly your algorithm is doing (I haven't looked at it yet so I don't know exactly what you are doing), there will likely be some way you an utilize the fact it's sorted to help you isolate the information you need. Y_ack Y_ack You should at least only look through the entries that begin with the given initial letter. Also, I wonder if it would be good to sort entries based on a system that acknowledges keyboard position, though I'm not sure how such a system would be designed. Maybe some kind of irregular constellation. Then it's easier to do the fuzzy matching. Edit: ignore this, I forgot swype input won't look close to the intended string MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Actually, acknowledging keyboard position (namely, the positions of the keys) is not a bad idea. For most smaller words, say, "me," you have to trek across the keyboard hitting many keys, which may sometimes render as other words with (unintentionally) more algorithmic "hits" than the short, intended word. By observing the direction of the Swype relative to the positions of the keys, it may help for determining when the user intends to type a shorter word versus a potential longer one. Y_ack Y_ack My understanding of the idea with length approximation is to track changes in stroke direction. A sharp change in direction is a high-probability intended key in the approximate area. The problem with this is obviously that there are words where intended letters lie between each other on the arrangement e.g. [w]->[e]->[t] = [w][t]. I'm pretty sure even mobile Swype still has trouble with midpoint key hits. 12Me21 12Me21 Head Admin Second Year My account is over 2 years old Website Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Perhaps it would be better/easier to track changes in SPEED. In the example "wet", the user might slow down around the E, and any direction change is also going to be a change in speed, too. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Actually, in my testing phase, I found that to be incorrect. Speed remains relatively constant throughout the swipe (unless you deliberately slow yourself of course, perhaps as a learning user). Searching for changes in direction could add to the success rate of the algorithm. I imagine it would be implemented in a weighted system, where characters which occupied the swipe's change-of-direction would have more weight over other characters present in other potential results (some "turns" could be wider arcs which skew results, so, unlike the beginning and end characters which are given, you can't say for certain a turn lying on a character is definite). Actually, I think this would be particularly useful for words contained entirely or partially within one key row, ex: "writer, quote, purpose, etc." because those words are the ones the algorithm has most trouble rendering correctly.