Can WordFrequencyData be used with phrases? I'd like to look up words/phrases like "cell phone" instead of "cellphone".

WordFrequencyData[{"cellphone", "cell phone"}, {"TimeSeries"}, All, IgnoreCase -> False]

Google's Ngram viewer allows this, so the data exists. I read through the documentation and didn't see anything.

Example from Google Books Ngram viewer.


If you look at the DownValues of WordFrequencyDaya it's working through this:

WordFrequencyData, "MWAWordFrequency", {arg1, "Year" -> date, 
  IgnoreCase -> caseoption, "IncludeCaseVariants" -> casevariants, 
  "IncludePOSVariants" -> posvariants, 
  "SourceCorpus" -> sourcecorpus}]

Where the relevant parameter is "SourceCorpus" which happens to just be any member of this list:


{"english", "hebrew", "italian", "german", "french", "spanish", \
"russian", "chinese"}

And so it just passes that up to WolframAlpha to compute, so let's try this test case: Frequency of phrase cell phone in English

And it fails to compute that, so this function likely can't handle that case. Note that it is possible to compute this: Frequency of word cellphone in English so it's not just that the query is bad.

On the other hand, if you have a decent corpus you could do the first part of what this guy did. Or, alternatively, you can just use google's data (see, for instance, the NOUN 2-grams).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.