Building an app using the Google Mobile Vision Text API which scans Library of Congress Classification Numbers from library books and determines if any books are out of order. I am having trouble writing the algorithm that is going to determine if the text block received is in the valid format.
Format should be as follows:
First Line: one or two letters ex) AB
Second Line: decimal number ex) 2405; or 234.23
Third Line: combination of letters and decimal number ex) .H65; or F123
- There may be multiple combination lines usually not more than 4
Line After Combo Lines: year the book was published ex) 2001
- This line is not always included
I receive the code read as a TextBlock which can be broken up into individual Lines, which are made up of individual Elements
The mobile vision text api is very poor at recognizing single letters, so I'm just going to ignore the first line since it's not super important for determining relative order.
The problem I am facing is how to determine if each line matches the criteria above, since I don't know until runtime how many letter/number combo lines are included.
Lines are stored as a List<? Extends Text> lines
Looking for suggestions on how to iterate through that list and determine if a line breaks the criteria.
Thank you.