7

How can I include a "comma" in a Google nGram search?

My problem is that I want to search for phrases like, "Yes, I do ." but Google nGrams uses commas to break up query terms, so it returns a comparison of the phrases "Yes" and "I do .". enter image description here (My apologies if this question seems off-topic. I ask here because Google nGrams is an important tool for ELU users, so we need to know how to get the most out of it.)

| |
  • 1
    I'm not sure, but I thing ngram shows both "Yes I do" and "Yes, I do", if you search for "Yes I do". – user19148 Jul 28 '12 at 14:07
  • 2
    @Carlo_R. The votes so far are all for "off topic" and -- looking at the Meta FAQ -- it does appear that it is, strictly. Meta is for questions about EL&U, not for providing support for other vendors' products. However, it might indeed be useful; so if it is closed, I hope it isn't deleted. – Andrew Leach Jul 28 '12 at 18:21
  • @AndrewLeach This question is not helpful, here; if Google nGram would in future add support for punctuation, the answer for this question should be updated, while there is probably a help page, or similar documentation page, that is maintained from Google. – kiamlaluno Jul 30 '12 at 22:42
  • 2
    @kiamlaluno Google's documentation was the first place I looked. nGram does, in fact, support punctuation, but it receives slightly special treatment: you have to separate out the punctuation with spaces. However, the syntax for entering queries makes it impossible to do this for commas. This is an odd ommission that Google's documentation does not even discuss, which is why I came to this community of experienced nGram users hoping for some answers. – Pitarou Aug 1 '12 at 1:56
  • 1
    I found that in the downloadable raw data for Google Ngram, at least for the American English section, they do include commas in the data sets, which is very helpful. So if you really wanted to, you could theoretically download portions of the data, and perform custom queries with commas. – bmende May 18 '16 at 18:35
  • 1
    It seems you can search for comma punctuation using the _ . _ tag, which includes other punctuation as well as commas. But when it comes down to punctuation, it can be a bit confusing with the viewer. Here's an interesting search. – bmende Aug 13 '16 at 5:37
6

I don't think it is possible. However, if you just search for Yes I do, Ngrams will include results with commas, because Google normally (and sadly) just ignores all punctuation in its search results. When I try this search phrase, I see only results with the comma there, so in practice this should not be a real problem for your particular search. Note that Ngrams do pay attention to capitalization, while ordinary Google search does not.

| |
  • Thanks. That's exactly what I needed. – Pitarou Jul 30 '12 at 5:54
  • Have you tried putting the phrase in quotation marks? – American Luke Jul 30 '12 at 20:19
  • @Luke: That breaks the site for me: I get a blank page. – Cerberus_Reinstate_Monica Jul 31 '12 at 12:10
  • 2
    Google Ngram doesn't actually ignore all punctuation from search results. While you may not be able to search for commas explicitly, you can search for commas using the _ . _ tag in grams of 3 or less. This should include commas, periods, and others. See Yes _ . _ I – bmende Aug 13 '16 at 5:30
  • @bmende: Oh, huh, can you explain what this _ . _ does? – Cerberus_Reinstate_Monica Aug 13 '16 at 13:33

Not the answer you're looking for? Browse other questions tagged .