Reverse Polish Abbreviations Generator

[The below provides a good example of pseudo code thinking about how to structure your program]

So in my previous post about "Something (Not) Happening" (here), I hinted at my reversal of strategy. (Switching to the use of "post-fix" operators) for my abbreviations-expanding Python program (an OOP project)

I was initially thinking like a programmer and assuming that the trigger (e.g. the prime char) should come first when I should have instead been thinking like a user of the code.

From the user's perspective it's like this:

You are typing some prose in left to right progression, say "The quick brown fox jum...". As you hit the "j", you recall that you have a prestored abbreviation for "jumped". You recall the name of that shortcut as being j "prime". So you type the j and then hit the prime key on your keyboard (the left tilted quote just below the ESCAPE key on the top left of your (y prime)  keyboard (k prime). After the prime key, you hit the space key OR a sentence terminator (e.g., period)  Medium link for image is (here)

In response, the software detects the single prime character and the following space/terminator. It looks back to the single prime (`) and the one preceding character (a "j"). It uses the latter as a key into your Python dictionary, fetches the corresponding long form ("jumped " --note the space included at the end), replaces the j prime you typed with the long form and lets you keep typing. Unless of course, there was a sentence terminator, in which case the software has to delete the last space in the long form, if present. -- To Be Continued

I'm not quite all there yet with my current Py project. Right now I drafted a .help method that explains how the algorithm is to work and a .menu method that displays one of the test dictionaries. Also a dictionary generating method that populates the dictionary with all possible one char keys a-z, A-Z, etc.

Comments

Popular posts from this blog

Links for Python Noobs

The Learn HOW to Learn Page

Welcome to Circular Import Hell