# How to extract numerical information from text descriptions

I have an attribute that is the description of an operation (i.e description of a building consent), I need to translate this to a mathematical operation. I need to find out the new number of dwelling that is going to build, and I have to ignore any other operation. I am not sure how to tackle this problem. I can do Regex, and do lots of searches but there should be a smarter way (is there???) by using machine learning/text mining/NLP(Stemming and lemmatization) but I am not sure where to start and how to approach this problem.

Below examples show a few cases of the description and the mathematical operation(i.e. the number of new unit):

building of a new unit->1 unit

building of a new garage->0 unit (the garage is not a dwelling)

demolishing of the existing unit and building a new one->0 unit (no changes in the total number of dwellings)

construction of an additional unit->1 unit

destroying the old building and building another one->0 unit (no changes in the total number of dwellings)

divining the land into two sub lots and building two new dwellings->2 units

• I think a simple grammar model of the various phrases, is the perfect solution to get almost all operations correctly. One builds a grammar model using any program that builds parsers from grammars and then you extract only the relevant pieces you need Nov 21 at 10:10
• @NikosM. your comment is quite surprising to me. Can you give any example (paper or implementation) where such a 'perfect solution' worked? Nov 21 at 11:30
• A more appropriate title for the question would be something like "How to extract numerical information from text descriptions". Nov 21 at 11:32
• @Valentas, Making a parser out of some grammar model, is perfectly feasible. One can even use ready-made tools (eg lex/yacc, bison etc..). Making a good grammar that can capture almost all the required variations is another matter, but doable. Then one simply directs the generated parser to extract the numerical units. It is simple as that. Nov 21 at 12:41
• @NikosM. Thanks for the suggestion about the title and the solution. I will have a look and families myself with these this week, hopefully, I will have a better understanding of what you are talking about, Nov 21 at 17:00