2
$\begingroup$

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.

$\endgroup$
2
$\begingroup$

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

System`WordFrequencyDump`Private`iWolframAlphaAPICompute[\
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:

System`WordFrequencyDump`Private`$WordFrequencyValidLanguages

{"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).

$\endgroup$

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.