3
$\begingroup$

It seems WordData isn't complete:

In[508]:= WordData["Alice", "ConceptWeight"]    
Out[508]= WordData["Alice", "ConceptWeight"]    
In[507]:= WordData["Michael", "ConceptWeight"]
Out[507]= {{"Michael", "Noun"} -> 0.462007}

and is sometimes case-sensitive:

In[1]:= # -> WordData[#, "PartsOfSpeech"] & /@ {"French"}
Out[1]= {"French" -> {"Noun", "Adjective", "Verb"}}
In[2]:= # -> WordData[#, "PartsOfSpeech"] & /@ {"french"}    
Out[2]= {"french" -> WordData["french", "PartsOfSpeech"]}

Can anyone write a function to find out if a word W is a verb or a pronoun or whatever, for all correctly spelled english words?

$\endgroup$
2
  • 1
    $\begingroup$ "french" (uncapitalized) is not a proper English spelling and hence should not be in the dictionary. $\endgroup$
    – bill s
    Commented Dec 2, 2014 at 22:47
  • $\begingroup$ @bill - according to Merriam-Webster, "french" used a a transitive verb although often -- is not necessarily -- capitalized. $\endgroup$
    – Bob Hanlon
    Commented Dec 3, 2014 at 1:12

1 Answer 1

-1
$\begingroup$

Determine the potential "PartsOfSpeech"

WordData["cat", "PartsOfSpeech"]

{"Noun", "Verb"}

then test for the type

! FreeQ[WordData["cat", "PartsOfSpeech"], "Noun"]
! FreeQ[WordData["cat", "PartsOfSpeech"], "Adjective"]
! FreeQ[WordData["cat", "PartsOfSpeech"], "Verb"]

True False True

Also see documentation for FreeQ. These tests may be integrated into a simple function, select or case structure.

$\endgroup$
1
  • $\begingroup$ There are many English words not in word data, you'll need to use another source. $\endgroup$
    – M.R.
    Commented Dec 2, 2014 at 23:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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