Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Question1: Get the list of pairs of the form {language,number of words in dictionary}. Call this list langlength

What I did was this:

langlength = 
  {{Arabic, Length[DictionaryLookup[{"Arabic", All}]]}, 
   {BrazilianPortuguese, Length[DictionaryLookup[{"BrazilianPortuguese", All}]]}, 
   {Breton, Length[DictionaryLookup[{"Breton", All}]]},......}

And so on. What's a shorter way of doing this?


Question2: Look at all the words contained in all the dictionaries. What are the ones of maximum length?

I had:

Max[StringLength[lang]]

But that's not working and not sure what's missing.

Please help me with either or both questions.


I set lang = DictionaryLookup[All]

share|improve this question
3  
Is it homework? –  belisarius Oct 12 '13 at 3:42
    
What did you use for lang? –  rm -rf Oct 12 '13 at 4:10
    
I have the first question, I just need the second question now. I need to find a way to show the longest word of each language. So if I know the longest word in English was 23, I have to find a way to see what THAT word is. –  Sam Oct 12 '13 at 16:38
add comment

1 Answer

This could be automated:

languages = DictionaryLookup[All];
leng = Length /@ (DictionaryLookup[{#, All}] & /@ languages)

The longest words could be extracted:

longw = 
  Last /@ (SortBy[#, StringLength[#] &] & /@ (DictionaryLookup[{#, All}] & /@ languages))

(noting that there may be more than one word of equal maximal length). You can adapt to sut your goal, e.g tabulate language and dictionary length:

Thread[{languages, leng}] // TableForm
share|improve this answer
    
I have the max length of each language, I just need a way to find what words they are exactly. –  Sam Oct 12 '13 at 16:38
    
For the second question, I need to find a way to show the longest word of each language. So for example, if I know the longest word in English was 23, I have to find a way to see what that 23 letter word is. –  Sam Oct 12 '13 at 16:40
    
@Sam longw in the code above is a list of the longest words. You could tabulate language, longest word and length as follows: Thread[{languages,longw,StringLength/@longw}]//TableForm –  ubpdqn Oct 13 '13 at 3:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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