Ask Your Question
0

Basic string parsing

asked 2020-05-20 22:29:11 +0200

zf gravatar image

I realize the solution I'm looking for can easily be accomplished by adding additional columns for words and conditionally check for them, but I am hoping to do some basic string parsing instead to minimize the number of columns that I would not otherwise need in all other contexts.


  • How to parse string based on simple "language"?

If A1 has the value "a past 6m", add 6 months to the date in B1 and return that date in D1; if A1 has the value "b past 12m" add 12 months to the date in C1 and return that date in D1. That's all for the language: interpret whether the first word is "a" or "b" and the last word to be the number of months to add. The sentence could also be "a past 6" instead of "a past 6m" but I'd rather have the given context of "6 months" than it being implied the # of months.

  • How to check that A1 contains a certain string A AND B2 contains word B and word C, but not word D? E.g.:

A1 has the value "teacher" and B1 has the value "math science". C1 should check that A1 is "teacher" and B1 has the words "math" and "science" but not "history", so returns true in this case. If B1 was e.g. instead "math history science" or "math", return false.

Much appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-05-21 07:35:27 +0200

JohnSUN gravatar image

This is an interesting puzzle, but it does not have a good solution using Basic. Even if your macro recognizes texts in a test set of strings well, be prepared for the fact that in real data you will get a “taecher” or “teechar” instead of a “teacher”, “6n” instead of “6m” and the like.

The problem has a solution - it is not very simple and is not based on Basic macros. If you really need to solve such a problem, then look in the direction of "neural networks." Perhaps, after a short additional training, learning of Python (now de facto it is BASIC of neural networks) and the fundamentals of differential calculus, you will be able to easily and quickly solve this problem. In the end, neural networks easily recognize images of letters and numbers written by hand, identify the breeds of birds in photographs and offer products for young mothers to young schoolgirls (they say that this is a beautiful marketing legend and this was not in real).

To show that this is possible - here is one of the videos. I didn't choose specifically, I took the first one that Google showed - you can find many others.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-05-20 22:29:11 +0200

Seen: 30 times

Last updated: May 21