# Two quick Mathematica Questions about the dictionary

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

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?

Max[StringLength[lang]]


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

I set lang = DictionaryLookup[All]

-
Is it homework? – Dr. belisarius Oct 12 '13 at 3:42
What did you use for lang? – R. M. 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

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

-
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