# Using a neural network to identify patterns in strings

I am currently doing a research on data sensing and I came across the following concept. The requirement for me is to identify different data types using neural networks. Please note that I don't want to use regular expressions for this since it is suggested by most when I explain what i want to do. The neural network should learn to identify the string data structure instead of running rules against it.

The requirement in examples is:  If input string is "123.456" => output is "floating point number" If input string is "test@example.com" => output is "email" 

My first approach was to train a multi-layer neural network using different features pre-engineered as the input

ex: 123.456
I input the no. of numeric characters and no. of periods to the network

So far I was able to obtain some accuracy for 2 data types (around 60%). The issue with this approach is that it disregard the order of characters when I provide the input as such.
ex: it disregard that 123 comes before the first '.' and 456 comes after that

So I now thinks of using convolution networks for the process. As per my understanding (please correct me if wrong), convolution networks are primarily tasked with recognizing image patterns given that they were built using the brain anatomy. Hence the best way of input for the network is an image. Thus, I thought of converting the text string to an image and feed it to a convolution network so that I might identify it with considerable context. (like where comes which pattern)

Before digging into this path I want to know if this is possible path or not. Please let me know of your ideas.

Please note that my knowledge on NN are limited and I haven't done enough research on the path.

Thank You

• The conversion into a picture just to use a CNN is inconvenient. For text analysis you should have a look at recurrent neural networks (RNN), especially LSTMs. – dexteritas Jun 23 '17 at 13:46
• Why don't you want to use regular expressions? – D.W. Jun 23 '17 at 16:29
• datascience.stackexchange.com/q/16115/8560 – D.W. Jun 23 '17 at 16:30