0

I am building a basic workout logger that would save and display some statistics about your number of repetitions per movement over a period of time. The challenge here (for me at least) is that I want to extract these informations from what the user will type in a textbox (no inputbox, no dropdown list with a list of movement). I would like to run an analysis (per line) of what the user has written, extract the number of repetitions, and the movement from it then associate it so I can save it in the DB. So the user would write something like:

For Quality
3 rounds of:
12 push ups at 10kg
10 sit ups

From such a text I would like to extract and associate:

12 push ups
10 sit ups 

For now this would have to be perfect match (no push-ups or sit-ups)

I have no clue where to start. I have Robert Sedgwick's book Algorithms in C which has some chapters on research (sequential, binary, binary tree, red black etc...) and string processing (pattern matching, context free gammar, top down parsing etc...)

What I had in mind was to run that analysis at every stroke, a bit like when you are typing a text on your phone and you have words suggestions.

Does it seems realistic to you ? If so, have you got any pointers to give me ?

Prefix tries is the lead I m exploring at the moment Thanks a lot.

Remaori
  • 95
  • 1
  • 9
  • Prefix tries is a good start. You can fill the trie with some predefined keywords consisting of exercise types and follow the path of a keyword as it is typed and even show suggestions based on it. But keep in mind that if you want to deal with free text, the possibilities are infinite and you can't account for all of them this way. – user1984 Jan 12 '22 at 09:05
  • 1
    This might help: [Parsing natural language ingredient quantities for recipes](https://stackoverflow.com/questions/12413705/parsing-natural-language-ingredient-quantities-for-recipes) – Stef Jan 12 '22 at 11:35
  • 1
    Also [How to extract numbers (along with comparison adjectives or ranges)](https://stackoverflow.com/questions/45126071/how-to-extract-numbers-along-with-comparison-adjectives-or-ranges); [How can I use NLP to parse recipe ingredients?](https://stackoverflow.com/questions/203684/how-can-i-use-nlp-to-parse-recipe-ingredients); – Stef Jan 12 '22 at 11:37
  • 1
    [How can I extract numbers based on context of the sentence in python?](https://stackoverflow.com/questions/66485593/how-can-i-extract-numbers-based-on-context-of-the-sentence-in-python); [How to annotate and train data for predominantly numeric data extraction](https://stackoverflow.com/questions/52030550/how-to-annotate-and-train-data-for-predominantly-numeric-data-extraction) – Stef Jan 12 '22 at 11:37

0 Answers0