Skip to content

Auto read functionality

Vera Chellgren edited this page Nov 11, 2021 · 5 revisions

Think of auto-read as a sort of "gathering-up" of words and sentences.

How auto-read works

YeetWords will automatically look for a folder starting with word and one starting with sentence (case-insensitive) within the working directory where you are using YeetWords. It is not compulsory to make use of this ability. YeetWords will still run fine without those folders, but it makes it a lot more convenient for you to use it, as it saves manually typing everything into ASSIGNLIST or ASSIGNCATALOG statments.

You do not need to do anything to invoke this functionality, it happens automatically.

If no directories are found that match the requirements, a warning will be emitted to make sure this was intentional, but the program will continue.

On the other hand, if you have more than one folder fulfilling those requirements for each, it's important to note that YeetWords will take the first one it finds for each. Therefore, to avoid confusion, it's best to only have one match for each, meaning that old sentence and word folders you might want to archive would best be renamed by prefixing OLD_ to the folder name, or moved elsewhere.

"The first one it finds for each" is not necessarily something that is easy to predict (the newest? the oldest? first in alphabetical order?) - this depends on the way that Ruby implements the Dir.glob function. Not only could this in theory differ for different operating systems, but also, it could theoretically vary from one version of Ruby to the next. Therefore, stick with only one folder starting with word and one starting with sentence.

How your file data should be organized

Inside those folders, you should have text files containing lists of words or sentences, one per line. No brackets, braces or parentheses - just the word or sentence on a line, next one on next line, and so on.

Leading and trailing spaces are automatically removed; this is to make it easier for those who start with "messy" word data that comes with extra spaces that are otherwise frustrating to remove. Spaces in the middle are preserved.

YeetWords gathers up all the files there and makes them into variables of type list. Each list has the variable name of the filename, without the .txt. These are then gathered up into a catalog. Let's look at a concrete example:

Suppose in the word folder you had 3 files, one called noun.txt, the other adjective.txt and the last one called verb.txt. Let's suppose you had 10 words in each list. The 10 words in the noun.txt file will go into a YeetWords list called noun; the 10 words in adjective.txt will go into a list called adjective, and the 10 words in verb.txt will go into a list called verb.

What does YeetWords do with these lists? It actually puts them into a catalog straight away in special variable names. The catalog name is wfolder for the contents of the word folder, and sfolder for the contents of the sentence folder. These catalog variable names sfolder and wfolder can therefore be used throughout the program as needed. These are special variables that are created automatically for you, and they will always have these names. Also, all the list variable names (in the example given above, this would be noun, adjective and verb) may also be used throughout the program as needed.

Naming your files

It is always best to name your files using alphabet and number (alphanumeric) characters only, so avoid special characters like underscores or hyphens. This is because you will want to use these to substitute for matching wordcodes, and wordcodes allow only alphanumeric characters.

Remember that your file names are considered case-insensitive by YeetWords, so a file named Adjectives.txt is equivalent to adjectives.txt, so make sure your file names are distinct in other ways than case.

Clone this wiki locally