TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What are the best tools for analyzing large bodies of text?

83 pointsby CoreSetalmost 10 years ago
I&#x27;m a researcher in the social sciences, working on a project that requires me to scrape a large amount of text and then use NLP to determine things like sentiment analysis, LSM compatibility, and other linguistic metrics for different subsections of that content.<p>The issue: After weeks of work, I&#x27;ve scraped all this information (a few GB&#x27;s worth) and begun to analyze it using a mixture of Node, Python and bash scripts. In order to generate all of the necessary permutations of this data (looking at Groups A, B, and C together, A &amp; C, A &amp; B, etc), I&#x27;ve generated an unwieldy number of text files (the script generated &gt; 50 GB before filling up my pitiful MBP hard drive), which I understand is no longer sustainable.<p>The easiest way forward is loading this all into a database I can query to analyze different permutations of populations. I don&#x27;t have much experience with SQL, but it seems to fit here.<p>So how do I put all these .txt files into a SQL or NoSQL database? Are there any tools I could use to visualize this data (IntelliJ, my editor, keeps breaking). And where should I do all this work? I&#x27;m thinking now either an external hard drive, or on a VPS I can just tunnel into.<p>Thanks in advance for your advice HN!

33 comments

drallisonalmost 10 years ago
It seems to me that you are driving from the wrong direction. Given that you have a large body of text, what is it you want to learn about&#x2F;from the text. Collecting and applying random tools and making measurements without some inkling about what you want or expect to discover makes no sense. Tell us more about the provenance of your corpus of text and what sort of information you want to derive from the data.
评论 #9736579 未加载
评论 #9736986 未加载
评论 #9738413 未加载
评论 #9737103 未加载
rasengan0almost 10 years ago
&gt;a project that requires me to scrape a large amount of text and then use NLP to determine things like sentiment analysis, LSM compatibility, and other linguistic metrics for different subsections of that content.<p>I ran into a similar project and found this helpful working with the unstructured data: <a href="https:&#x2F;&#x2F;textblob.readthedocs.org&#x2F;en&#x2F;dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;textblob.readthedocs.org&#x2F;en&#x2F;dev&#x2F;</a> <a href="https:&#x2F;&#x2F;radimrehurek.com&#x2F;gensim&#x2F;" rel="nofollow">https:&#x2F;&#x2F;radimrehurek.com&#x2F;gensim&#x2F;</a>
cmarciniakalmost 10 years ago
More information would be helpful. In terms of having a data store that you can easily query text I would recommend Elasticsearch. Kibana is a dashboard built on Elasticsearch for performing analytics and visualization on your texts. Elasticsearch also has a RESTful api which would play nicely with your Python scripts or any scripting language for that matter. I would also recommend the Python package gensim for your NLP.
评论 #9737709 未加载
lsiebertalmost 10 years ago
What social science?<p>You shouldn&#x27;t be generating the text in advance and then processing it. You should be dynamically generating the text in memory, so you basically only have to worry about the memory for one text file at a time.<p>As for visualizations, R and ggplot2 may work (R can handle text and data munging, as well as sentiment analysis etc.) It may be worth using it as a social scientist.<p>ggplot2 has a python port.<p>That said, you are probably using nltk, right? There are some tools in nltk.draw. There is probably also a user&#x27;s mailing list for whatever package or tool you are using, consider asking this there.
评论 #9736045 未加载
评论 #9737096 未加载
评论 #9736491 未加载
nutatealmost 10 years ago
Right now the fastest alternative to nltk is spaCy <a href="https:&#x2F;&#x2F;honnibal.github.io&#x2F;spaCy&#x2F;" rel="nofollow">https:&#x2F;&#x2F;honnibal.github.io&#x2F;spaCy&#x2F;</a> definitely worth a look. I don&#x27;t know what you&#x27;re trying to do with the permutations part, but it seems like you can generate those on the fly through some reproducible algorithm (such that some integer seed describes the ordering in a reproducible way) then just keep track of the seeds, not the permuted data.
mark_l_watsonalmost 10 years ago
One approach is to put text files in Amazon S3 and write map reduce jobs that you can run with Elastic MapReduce. I did this a number of years ago for a customer project and it was inexpensive and a nice platform to work with. Microsoft, Google, and Amazon all have data warehousing products you can try if you don&#x27;t want to write MapReduce jobs.<p>That said, if you are only processing 2 GB of text, you can often do that in memory on your laptop. This is especially true if you are doing NLP on individual sentences, or paragraphs.
ChuckMcMalmost 10 years ago
Well if you&#x27;re willing to relocate to the Bay Area I could set you up in an office with a variety of tools to analyze and classify text and do all sorts of analysis on it, I&#x27;d even pay you :-) (yes I&#x27;ve got a couple of job openings where this pretty much describes the job)<p>That said, converting large documents into data sets is examined in a number of papers, you may find yourself getting more traction by splitting the problem up that way, step 1) pull apart the document into a more useful form, then step 2) do analysis on those parts. They are interelated of course and some forms of documents lend themselves to disassembly better than others (scientific papers for example, easy to unpack, random blog posts, less so.<p>As for &quot;where&quot; to do it, the ideal place is a NoSQL cluster. This is what we&#x27;ve done at Blekko for years (and continue to do post acquisition) which is put the documents we crawl from the Internet into a giant NoSQL data base and then run jobs that execute in parallel across all of those servers to analyze those documents (traditionally to build a search index, but other modalities are interesting too.
koopulurialmost 10 years ago
What tools exactly are you using in Node and Python? Python has a nice data analysis tool Pandas(<a href="http:&#x2F;&#x2F;pandas.pydata.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;pandas.pydata.org&#x2F;</a>) which would help with your task of generating multiple permutations of your data. Check out plot.ly to visualize the data (it integrates well with a pandas pipeline from experience); It would also help if you mentioned exactly what kind of visualizations you&#x27;re looking to create from the data.<p>With regards to your issue of scale, this might help: <a href="http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;14262433&#x2F;large-data-work-flows-using-pandas" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;14262433&#x2F;large-data-work-...</a><p>I had similar issues when doing research in computer science, and I feel a lot of researchers working with data have this headache of organizing, visualizing and scaling their infrastructure along with versioning data and coupling their data with code. Also adding more collaborators to this workflow would be very time consuming...
ashleyalmost 10 years ago
&gt;&gt;<i>I&#x27;m thinking now either an external hard drive, or on a VPS I can just tunnel into.</i> Consider setting up an ElasticSearch cluster somewhere, like with AWS, which takes plugins for ElasticSearch. Once you&#x27;ve indexed your data with ES, then queries are pretty easy (JSON-based). This would also solve your other problem with data visualization. ElasticSearch has an analytics tool called Kibana. Pretty useful and doesn&#x27;t require too much effort to set up or use. I&#x27;m using this setup for a sentiment analysis project myself.<p>You didn&#x27;t mention the libraries in your NLP pipeline (guessing NLTK bc of the Python?), but if you&#x27;re doing LSM compatibility, I&#x27;m guessing you might be interested in clustering or topic-modelling algorithms and such...Mahout integrates easily with ElasticSearch.
评论 #9738041 未加载
pvaldesalmost 10 years ago
Don&#x27;t know if is that you need or not, but common lisp has available the package &#x27;cl-sentiment&#x27;, specifically aimed to do sentiment analysis in text.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;RobBlackwell&#x2F;cl-sentiment" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;RobBlackwell&#x2F;cl-sentiment</a><p>Other packages that you could find useful are cl-mongo, for mongo no-sql databases, cl-mysql, postmodern (postgresql) and cl-postres (postgresql)<p>And for Perl you have also Rate_sentiment<p><a href="http:&#x2F;&#x2F;search.cpan.org&#x2F;~prath&#x2F;WebService-GoogleHack-0.15&#x2F;GoogleHack&#x2F;Examples&#x2F;Rate_Sentiment.pl" rel="nofollow">http:&#x2F;&#x2F;search.cpan.org&#x2F;~prath&#x2F;WebService-GoogleHack-0.15&#x2F;Goo...</a>
skadamatalmost 10 years ago
The first immediate thing I would recommend is moving all of your files into AWS S3: <a href="http:&#x2F;&#x2F;aws.amazon.com&#x2F;s3&#x2F;" rel="nofollow">http:&#x2F;&#x2F;aws.amazon.com&#x2F;s3&#x2F;</a><p>Storage is super cheap, and you can get rid of the clutter on your laptop. I wouldn&#x27;t recommend moving to a database yet, especially if you don&#x27;t have any experience working with them before. S3 has great connector libraries and good integrations with things like Spark and Hadoop and other &#x27;big data&#x27; analysis tools. I would start to go down that path and see which tools might be best for analyzing text files from S3!
评论 #9735961 未加载
CoreSetalmost 10 years ago
EDIT:<p>I’m astounded by the number and quality of responses for appropriate tools. Thank you HN! To shed a little more light on the project:<p>I’m compiling research for a sociology &#x2F; gender studies project that takes a national snapshot of romantic posts from classifieds sites &#x2F; sources across the country, and then uses that data to try and draw meaningful insights about how different races, classes, and genders of Americans engage romantically online.<p>I’ve already run some basic text-processing algorithms (tf-idf, certain term frequency lists, etc) on smaller txt files that represent the content for a few major U.S metros and discovered some surprises that I think warrant a larger follow-up. So I have a few threads I want to investigate already, but I also don’t want to be blind to interesting comparisons that can be drawn between data sets, now that I have more information (that’s why I’m asking for a bit of a grab-bag of text-processing abilities).<p>My problem is that the techniques from the first phase (analyzing a few metros) didn’t scale with the larger data set: The entire data set is only 2GB of text, but it started maxing my memory as I recopied the text files over and over again into different groupings. Starting with a datastore from the beginning would also have worked, but it just wasn’t necessary at the beginning of the project.<p>My current setup: Python’s Beautiful Soup + CasperJS for scripting (which is done) Node, relying primarily on the excellent NLP package “natural,” for analysis Bash to tie things together My personal MBP as the environment<p>SO given the advice expressed in the thread (and despite my love of Shiny New Things), a combination of shell scripts and awk (a CL language specifically for structured text files!), which I had heard about before but thought was a networking tool, will probably work best, backed up by a 1TB or similar external drive, which I could use anyway (and would be more secure). I have the huge luxury of course that this is a one-time research-oriented project, and not something I need to worry about being performant, etc.<p>I will of course look into a lot of the solutions provided here regardless, as something (especially along the visualizations angle) could prove more useful, and it’s all fascinating to me.<p>Thanks again HN for all of your help.
评论 #9759231 未加载
bkinalmost 10 years ago
No answer to your question per se, but Software Engineering Radio has a nice episode about working with and extracting knowledge from larger bodies of text: <a href="http:&#x2F;&#x2F;www.se-radio.net&#x2F;2014&#x2F;11&#x2F;episode-214-grant-ingersoll-on-his-book-taming-text&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.se-radio.net&#x2F;2014&#x2F;11&#x2F;episode-214-grant-ingersoll-...</a>
machinelearningalmost 10 years ago
We&#x27;re building a database specifically to solve this problem. We&#x27;re almost production ready and will be going OpenSource in a couple of months. Send us an email at textedb@gmail.com if you&#x27;d like to try it out. <a href="http:&#x2F;&#x2F;textedb.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;textedb.com&#x2F;</a>
评论 #9737258 未加载
quizoticalmost 10 years ago
There are commercial products that do a decent job of what you want. I have experience with Oracle Endeca, and have heard that Qlik is even better. Both have easy ways to load and visualize.<p>There are research frameworks that are quite good. One is Factorie from U.Mass Amherst (factorie.cs.umass.edu) that supports latent dirichlet allocation and lots more. Stanford also has wonderful tools.<p>Yes, you can dump text into SQL, and postgres has some text analytics. But my guess is that you&#x27;ll soon want capabilities that RDBs don&#x27;t have. Mongo has some support for text, but not nearly as much as postgres. I think both SQL and NoSQL are currently round pegs in square holes for deep text analytics. They&#x27;re barely ok for search.
hudibrasalmost 10 years ago
Here&#x27;s a good place to start: <a href="http:&#x2F;&#x2F;www.matthewjockers.net&#x2F;text-analysis-with-r-for-students-of-literature&#x2F;#comment-39991" rel="nofollow">http:&#x2F;&#x2F;www.matthewjockers.net&#x2F;text-analysis-with-r-for-stude...</a>
chubotalmost 10 years ago
This sounds like an algorithmic issue. How many permutations are you generating? Are you sure you can scale it with different software tools or hardware, or is there an inherent exponential blowup?<p>Are you familiar with big-O &#x2F; computational complexity (I ask since you say your background is in social sciences.)<p>A few GB&#x27;s of input data is generally easy to work with on a single machine, using Python and bash. If you need big intermediate data, you can brute force it with distributed systems, hardware, C++, etc. but that can be time consuming, depending on the application.
jaz46almost 10 years ago
I&#x27;d have to know a little more about your setup to be sure, but Pachyderm (pachyderm.io) might be a viable option. Full disclosure, I&#x27;m one of the founders. The biggest advantage you&#x27;d get from our system is that you can continue using all of those python and bash scripts to analyze your data in a distributed fashion instead of having to learn&#x2F;use SQL. If it looks like Pachyderm might be a good fit, feel free to email me joey@pachyderm.io
cafebeenalmost 10 years ago
Might be worth trying a visual analytics system like Overview:<p><a href="https:&#x2F;&#x2F;blog.overviewdocs.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.overviewdocs.com&#x2F;</a><p>There&#x27;s also a nice evaluation paper:<p><a href="http:&#x2F;&#x2F;www.cs.ubc.ca&#x2F;labs&#x2F;imager&#x2F;tr&#x2F;2014&#x2F;Overview&#x2F;overview.pdf" rel="nofollow">http:&#x2F;&#x2F;www.cs.ubc.ca&#x2F;labs&#x2F;imager&#x2F;tr&#x2F;2014&#x2F;Overview&#x2F;overview.p...</a>
Rainymoodalmost 10 years ago
Interesting. I recently wrote my thesis on Latent Dirichlet Allocation (LDA), it&#x27;s worth checking it out. Without going into too much technical detail, LDA is a &#x27;topic model&#x27;. Given a large set of documents (a corpus), it estimates the &#x27;topics&#x27; of the corpus and gives a breakdown of each document, in terms of how much it contains of topic 1, topic 2, etc.
SQL2219almost 10 years ago
SQL Server has a feature called file tables. Basically it&#x27;s the ability to dump a bunch of files into a folder, you can then query the contents using semantic search.<p><a href="https:&#x2F;&#x2F;msdn.microsoft.com&#x2F;en-us&#x2F;library&#x2F;ff929144%28v=sql.110%29.aspx" rel="nofollow">https:&#x2F;&#x2F;msdn.microsoft.com&#x2F;en-us&#x2F;library&#x2F;ff929144%28v=sql.11...</a>
kaa2102almost 10 years ago
Looking at some of the comments it would be helpful if you took a step back and clearly defined for the data, data markers and relationship hypothesis you are looking for.<p>I&#x27;ve done some text file parsing and analysis with just C++ and Excel. You could possibly simplify the analytical process by clearly defining what you need from the text file.
tedchsalmost 10 years ago
Have you considered Google Bigquery? It&#x27;s a managed data warehouse with a SQL-like query language. Easy to load in your data, run queries, then drop the database when you&#x27;re done with it.
effnorwoodalmost 10 years ago
<a href="https:&#x2F;&#x2F;www.chrisstucchio.com&#x2F;blog&#x2F;2013&#x2F;hadoop_hatred.html" rel="nofollow">https:&#x2F;&#x2F;www.chrisstucchio.com&#x2F;blog&#x2F;2013&#x2F;hadoop_hatred.html</a>
wigsgiwalmost 10 years ago
You might be interested in <a href="http:&#x2F;&#x2F;entopix.com" rel="nofollow">http:&#x2F;&#x2F;entopix.com</a>, could be ideal.
timminsalmost 10 years ago
I used a Win app called TextPipe. It has a large feature set to wrangle text but the visualization aspect may need another tool.
halaylialmost 10 years ago
it&#x27;s not clear what your objective is. I can have 1kb text file and end up with a 1TB file after &quot;analyzing&quot; if I don&#x27;t have a goal in mind.
gt565kalmost 10 years ago
apache solr or elasticsearch
kitwalker12almost 10 years ago
a java application with SQL adapters and Apache Tika might work
bra-ketalmost 10 years ago
Apache Spark
评论 #9737919 未加载
nodivbyzeroalmost 10 years ago
grep, sed
codeonfirealmost 10 years ago
If you want high performance and simple why not use flat files, bash, grep (maybe parallel), cut, awk, wc, uniq, etc. You can get very far with these and if you have a fast local disk you cat get huge read rates. A few GB can be scanned in a matter of seconds. Awk can be used to write your queries. I don&#x27;t understand what you are trying to do, but if it can be done with a SQL database and doesn&#x27;t involve lots of joins then it can be done with a delimited text file. If you don&#x27;t have a lot of disk space you can also work with gzipped files, zcat, zgrep, etc. I would not even consider distributed solutions or nosql until I had at least 100GB of data (more like 1TB of data). I would not consider any sort of SQL database unless I had a lot of complex joins.
评论 #9737001 未加载
developer1almost 10 years ago
Does the NSA allow its employees to look for help from the general public like this? Seems odd for such a secretive organization to post publicly asking for help on how to parse our conversations.
评论 #9737013 未加载