Real World Uses for Parsing
Where is parsing used?
When you get down to it, parsing is a very basic part of data processing. Large amounts of data need to be broken down into smaller parts for analysis, encryption and/or storage. Here are a few examples of real-world parsing:
|
|
Why should we use parsing functions?
By breaking large strings of data into smaller pieces, they are easier to manage, and manipulate.
For example, by breaking down a sentence into each word, and each word into each letter, a spell checker can look for proper spelling and, using proprietary algorithms, look for similar words. If a spell checker had to look for an entire sentence in a dictionary, it could not function. It would be impossible to program every sentence possible into a spell checker.
Also, when long strings are broken down into smaller parts, they can be more easily encrypted. A 16-digit credit card number, when broken down into each digit, can set a unique character shift for each number. If each number is shifted differently, it is much more secure because the key is more difficult to crack. If the number is kept as one long digit, shifting each individual number becomes much more difficult.
Large data management is easier with parsing. And entire file can be stored as one long string, if that stores it most easily. The data included in that string can be parsed out into individual words, and manipulated as necessary. You can search for particular values by parsing the data and searching in an appropriate manner for particular tokens. Depending on how the data is stored, the search methods may vary. For example, a file stored in alphabetical order may be parsed into binary search tree, then traversed to find the token.