Ask HN: How do you index large unknown files?
I want to index about a terabyte of unknown data. I'd like to be able to get emails, usernames, phonenumbers, etc out of it using regexes or some other technique. Is anyone able to point me in the right direction? I was looking at using elasticsearch as it seems like the best atm.
2 comments
[ 2.5 ms ] story [ 15.5 ms ] threadDo you know if the data is at least in a text format? If it is, you could code up a job to walk through the data and extract usernames, phone numbers, etc. Something like OpenNLP would probably work well for you. If you want something a little fancier, like NER with automatic entity linking, you could use Apache Stanbol.
Keep in mind though, none of these tools are magic and none have human level AGI. You probably won't get 100% perfect matching for every single entity you care about. This is especially so using the pre-trained models. To get the best results, you'll need to human label some training data (a subset of your original data) and train your own model using the labeled data.
Once you're able to match all your various entities, then you might want to stick them in ES, Solr, etc. so you can do convenient queries - depending on what your use case is.
Note that if your data isn't in text to begin with (eg, if it's Word docs, PDF, etc.) you might be able to use Tika to extract the content as the first step in your processing pipeline.
For documents, I recommend using Apache Tika which will do a decent job out of the box to extract the raw text. The raw text can then by indexed in ES. In my experience, it is the best tool for detecting a document's type. It is not necessarily the best tool for extracting text depending on the document type. For example, it is better to use a paid solution for OCR PDFs if you can afford it. However it is often good enough and very easy to use.
If you need to extract tabular data from documents, then that is a much harder problem and you are on the cutting-edge of NLP/ML research. One tool available in Stanford CoreNLP that may help is SPIED [3]. If the tool isn't exactly what you need, then I would recommend using the paper as a starting point for literature review.
1. https://github.com/facebookincubator/duckling
2. https://nlp.stanford.edu/software/sutime.html
3. https://nlp.stanford.edu/software/patternslearning.html