Wolfram Language symbols by their Ranks

This gives 5 symbols with the highest rank in "All":

In[1]:= EntityValue["WolframLanguageSymbol", "Ranks", 
  "EntityAssociation"] // Query[TakeSmallest[5] /* Keys, "All"]

Out[1]= {Entity["WolframLanguageSymbol", "List"], 
 Entity["WolframLanguageSymbol", "Rule"], 
 Entity["WolframLanguageSymbol", "Times"], 
 Entity["WolframLanguageSymbol", "Power"], 
 Entity["WolframLanguageSymbol", "Plus"]}

It is currently not possible to get the same result without retrieving all the data because a query like

EntityList[EntityClass[type, "property" -> value]]

is executed only when value is a simple expression like a number, quantity, entity, ..., or one of a selection of operators like ContainsAny[{entity1, ...}], GreaterThan[x], ... .


The "Corpus" qualifier can be used to generate an efficient query.

EntityList[
 EntityClass["WolframLanguageSymbol", 
  EntityProperty["WolframLanguageSymbol", "Ranks", {"Corpus" -> "All"}] -> 
   TakeSmallest[50]]]

Out

There are examples for this in the documentation here and here now.


One possibility is to convert the result of EntityValue[] into a Dataset[] and then perform ranking/sorting queries. Here is what I came up with:

wlranks = Dataset[Association /@ MapAt["Name" -> # &, Prepend[#2, #1] & @@@
                  DeleteMissing[EntityValue["WolframLanguageSymbol",
                                            {"Name", "Ranks"}], 1, 1], {All, 1}]]

Here's how to query the top 50 functions by their "All" ranking:

wlranks[TakeSmallestBy[#All &, 50], "Name"] // Normal
   {"List", "Rule", "Times", "Power", "Plus", "Set", "Alternatives", "Null",
    "Blank", "NoWhitespace", "Pattern", "$Failed", "CompoundExpression", "Slot",
    "Part", "Sqrt", "RGBColor", "None", "Pi", "SetDelayed", "Function", "Equal",
    "Subscript", "Automatic", "True", "Directive", "I", "Map", "Opacity",
    "RuleDelayed", "FinancialData", "GrayLevel", "Sin", "False", "If", "Hold",
    "Quantity", "ReplaceAll", "CityData", "Line", "Cos", "Condition", "Less",
    "Style", "And", "E", "Table", "HoldComplete", "Word", "Length"}

A problem I noticed with querying the bottom 50 is that there seems to be a lot of ties at the bottom. With that caveat, you can use TakeLargestBy[] to extract the bottom 50. A sorted list of the functions ranked by "All" is returned by wlranks[SortBy[#All &], "Name"] // Normal. Similar operations can be done for the other ranks, e.g. "StackExchange":

wdd[TakeSmallestBy[#StackExchange &, 50], "Name"] // Normal
   {"List", "Times", "Set", "Power", "Rule", "Blank", "Pattern", "Slot",
    "CompoundExpression", "Plus", "Part", "Function", "SetDelayed", "Map",
    "Equal", "Null", "Pi", "ReplaceAll", "Table", "Apply", "Sin", "All", "True",
    "Length", "Sqrt", "RuleDelayed", "Range", "Cos", "If", "Derivative", "False",
    "First", "Less", "Flatten", "Greater", "Module", "Plot", "Transpose",
    "PlotRange", "I", "None", "Red", "LessEqual", "And", "ImageSize",
    "StringCases", "With", "Graphics", "PatternTest", "Dynamic"}