Get a natural language input box by typing +=. Type “all countries” into the box and run the code with +. The result is an Entity that represents all of the world’s countries:
\!\(\*
NamespaceBox["LinguisticAssistant",
DynamicModuleBox[{Typeset`query$$ = "all countries", Typeset`boxes$$ =
TemplateBox[{
"\"all countries, dependencies, and territories\"",
RowBox[{"EntityClass", "[",
RowBox[{"\"Country\"", ",", "\"Countries\""}], "]"}],
"\"EntityClass[\\\"Country\\\", \\\"Countries\\\"]\"",
"\"countries\""}, "EntityClass"],
Typeset`allassumptions$$ = {{
"type" -> "SubCategory", "word" -> "all countries",
"template" -> "Assuming ${desc1}. Use ${desc2} instead",
"count" -> "2",
"Values" -> {{
"name" -> "Countries",
"desc" -> "all countries, dependencies, and territories",
"input" -> "*DPClash.CountryEC.all+countries-_*Countries-"}, \
{"name" -> "SovereignCountries", "desc" -> "all sovereign countries",
"input" -> "*DPClash.CountryEC.all+countries-_*\
SovereignCountries-"}}}}, Typeset`assumptions$$ = {},
Typeset`open$$ = {1}, Typeset`querystate$$ = {
"Online" -> True, "Allowed" -> True,
"mparse.jsp" -> 0.709468`6.302477805217818, "Messages" -> {}}},
DynamicBox[ToBoxes[
AlphaIntegration`LinguisticAssistantBoxes["", 4, Automatic,
Dynamic[Typeset`query$$],
Dynamic[Typeset`boxes$$],
Dynamic[Typeset`allassumptions$$],
Dynamic[Typeset`assumptions$$],
Dynamic[Typeset`open$$],
Dynamic[Typeset`querystate$$]], StandardForm],
ImageSizeCache->{85., {7., 16.}},
TrackedSymbols:>{
Typeset`query$$, Typeset`boxes$$, Typeset`allassumptions$$,
Typeset`assumptions$$, Typeset`open$$, Typeset`querystate$$}],
DynamicModuleValues:>{},
UndoTrackedVariables:>{Typeset`open$$}],
BaseStyle->{"Deploy"},
DeleteWithContents->True,
Editable->False,
SelectWithContents->True]\)
This gives the list of all the properties known about the countries:
EntityProperties[\!\(\*
NamespaceBox["LinguisticAssistant",
DynamicModuleBox[{Typeset`query$$ = "all countries", Typeset`boxes$$ =
TemplateBox[{"\"all countries, dependencies, and territories\"",
RowBox[{"EntityClass", "[",
RowBox[{"\"Country\"", ",", "\"Countries\""}], "]"}],
"\"EntityClass[\\\"Country\\\", \\\"Countries\\\"]\"",
"\"countries\""}, "EntityClass"],
Typeset`allassumptions$$ = {{
"type" -> "SubCategory", "word" -> "all countries",
"template" -> "Assuming ${desc1}. Use ${desc2} instead",
"count" -> "2",
"Values" -> {{
"name" -> "Countries",
"desc" -> "all countries, dependencies, and territories",
"input" -> "*DPClash.CountryEC.all+countries-_*Countries-"},\
{"name" -> "SovereignCountries", "desc" -> "all sovereign countries",
"input" -> "*DPClash.CountryEC.all+countries-_*\
SovereignCountries-"}}}}, Typeset`assumptions$$ = {},
Typeset`open$$ = {1}, Typeset`querystate$$ = {
"Online" -> True, "Allowed" -> True,
"mparse.jsp" -> 0.709468`6.302477805217818, "Messages" -> {}}},
DynamicBox[ToBoxes[
AlphaIntegration`LinguisticAssistantBoxes["", 4, Automatic,
Dynamic[Typeset`query$$],
Dynamic[Typeset`boxes$$],
Dynamic[Typeset`allassumptions$$],
Dynamic[Typeset`assumptions$$],
Dynamic[Typeset`open$$],
Dynamic[Typeset`querystate$$]], StandardForm],
ImageSizeCache->{85., {7., 16.}},
TrackedSymbols:>{
Typeset`query$$, Typeset`boxes$$, Typeset`allassumptions$$,
Typeset`assumptions$$, Typeset`open$$, Typeset`querystate$$}],
DynamicModuleValues:>{},
UndoTrackedVariables:>{Typeset`open$$}],
BaseStyle->{"Deploy"},
DeleteWithContents->True,
Editable->False,
SelectWithContents->True]\)]
Use EntityValue to get the value of a particular property for all countries:
EntityValue[\!\(\*
NamespaceBox["LinguisticAssistant",
DynamicModuleBox[{Typeset`query$$ = "all countries", Typeset`boxes$$ =
TemplateBox[{"\"all countries, dependencies, and territories\"",
RowBox[{"EntityClass", "[",
RowBox[{"\"Country\"", ",", "\"Countries\""}], "]"}],
"\"EntityClass[\\\"Country\\\", \\\"Countries\\\"]\"",
"\"countries\""}, "EntityClass"],
Typeset`allassumptions$$ = {{
"type" -> "SubCategory", "word" -> "all countries",
"template" -> "Assuming ${desc1}. Use ${desc2} instead",
"count" -> "2",
"Values" -> {{
"name" -> "Countries",
"desc" -> "all countries, dependencies, and territories",
"input" -> "*DPClash.CountryEC.all+countries-_*Countries-"},\
{"name" -> "SovereignCountries", "desc" -> "all sovereign countries",
"input" -> "*DPClash.CountryEC.all+countries-_*\
SovereignCountries-"}}}}, Typeset`assumptions$$ = {},
Typeset`open$$ = {1}, Typeset`querystate$$ = {
"Online" -> True, "Allowed" -> True,
"mparse.jsp" -> 0.709468`6.302477805217818, "Messages" -> {}}},
DynamicBox[ToBoxes[
AlphaIntegration`LinguisticAssistantBoxes["", 4, Automatic,
Dynamic[Typeset`query$$],
Dynamic[Typeset`boxes$$],
Dynamic[Typeset`allassumptions$$],
Dynamic[Typeset`assumptions$$],
Dynamic[Typeset`open$$],
Dynamic[Typeset`querystate$$]], StandardForm],
ImageSizeCache->{85., {7., 16.}},
TrackedSymbols:>{
Typeset`query$$, Typeset`boxes$$, Typeset`allassumptions$$,
Typeset`assumptions$$, Typeset`open$$, Typeset`querystate$$}],
DynamicModuleValues:>{},
UndoTrackedVariables:>{Typeset`open$$}],
BaseStyle->{"Deploy"},
DeleteWithContents->True,
Editable->False,
SelectWithContents->True]\),
EntityProperty["Country", "InternetCode"]]
If you mouse over a property like , you’ll see the property name, which you can use in place of the property itself:
EntityValue[\!\(\*
NamespaceBox["LinguisticAssistant",
DynamicModuleBox[{Typeset`query$$ = "all countries", Typeset`boxes$$ =
TemplateBox[{"\"all countries, dependencies, and territories\"",
RowBox[{"EntityClass", "[",
RowBox[{"\"Country\"", ",", "\"Countries\""}], "]"}],
"\"EntityClass[\\\"Country\\\", \\\"Countries\\\"]\"",
"\"countries\""}, "EntityClass"],
Typeset`allassumptions$$ = {{
"type" -> "SubCategory", "word" -> "all countries",
"template" -> "Assuming ${desc1}. Use ${desc2} instead",
"count" -> "2",
"Values" -> {{
"name" -> "Countries",
"desc" -> "all countries, dependencies, and territories",
"input" -> "*DPClash.CountryEC.all+countries-_*Countries-"},\
{"name" -> "SovereignCountries", "desc" -> "all sovereign countries",
"input" -> "*DPClash.CountryEC.all+countries-_*\
SovereignCountries-"}}}}, Typeset`assumptions$$ = {},
Typeset`open$$ = {1}, Typeset`querystate$$ = {
"Online" -> True, "Allowed" -> True,
"mparse.jsp" -> 0.709468`6.302477805217818, "Messages" -> {}}},
DynamicBox[ToBoxes[
AlphaIntegration`LinguisticAssistantBoxes["", 4, Automatic,
Dynamic[Typeset`query$$],
Dynamic[Typeset`boxes$$],
Dynamic[Typeset`allassumptions$$],
Dynamic[Typeset`assumptions$$],
Dynamic[Typeset`open$$],
Dynamic[Typeset`querystate$$]], StandardForm],
ImageSizeCache->{85., {7., 16.}},
TrackedSymbols:>{
Typeset`query$$, Typeset`boxes$$, Typeset`allassumptions$$,
Typeset`assumptions$$, Typeset`open$$, Typeset`querystate$$}],
DynamicModuleValues:>{},
UndoTrackedVariables:>{Typeset`open$$}],
BaseStyle->{"Deploy"},
DeleteWithContents->True,
Editable->False,
SelectWithContents->True]\), "InternetCode"]
“Entity” gives a list of the individual country entities:
EntityValue[\!\(\*
NamespaceBox["LinguisticAssistant",
DynamicModuleBox[{Typeset`query$$ = "all countries", Typeset`boxes$$ =
TemplateBox[{"\"all countries, dependencies, and territories\"",
RowBox[{"EntityClass", "[",
RowBox[{"\"Country\"", ",", "\"Countries\""}], "]"}],
"\"EntityClass[\\\"Country\\\", \\\"Countries\\\"]\"",
"\"countries\""}, "EntityClass"],
Typeset`allassumptions$$ = {{
"type" -> "SubCategory", "word" -> "all countries",
"template" -> "Assuming ${desc1}. Use ${desc2} instead",
"count" -> "2",
"Values" -> {{
"name" -> "Countries",
"desc" -> "all countries, dependencies, and territories",
"input" -> "*DPClash.CountryEC.all+countries-_*Countries-"},\
{"name" -> "SovereignCountries", "desc" -> "all sovereign countries",
"input" -> "*DPClash.CountryEC.all+countries-_*\
SovereignCountries-"}}}}, Typeset`assumptions$$ = {},
Typeset`open$$ = {1}, Typeset`querystate$$ = {
"Online" -> True, "Allowed" -> True,
"mparse.jsp" -> 0.709468`6.302477805217818, "Messages" -> {}}},
DynamicBox[ToBoxes[
AlphaIntegration`LinguisticAssistantBoxes["", 4, Automatic,
Dynamic[Typeset`query$$],
Dynamic[Typeset`boxes$$],
Dynamic[Typeset`allassumptions$$],
Dynamic[Typeset`assumptions$$],
Dynamic[Typeset`open$$],
Dynamic[Typeset`querystate$$]], StandardForm],
ImageSizeCache->{85., {7., 16.}},
TrackedSymbols:>{
Typeset`query$$, Typeset`boxes$$, Typeset`allassumptions$$,
Typeset`assumptions$$, Typeset`open$$, Typeset`querystate$$}],
DynamicModuleValues:>{},
UndoTrackedVariables:>{Typeset`open$$}],
BaseStyle->{"Deploy"},
DeleteWithContents->True,
Editable->False,
SelectWithContents->True]\), "Entity"]
Get both the country entities and their internet codes:
EntityValue[\!\(\*
NamespaceBox["LinguisticAssistant",
DynamicModuleBox[{WolframAlphaClient`Private`query$$ =
"all countries", WolframAlphaClient`Private`boxes$$ =
TemplateBox[{
"\"all countries, dependencies, and territories\"",
RowBox[{"EntityClass", "[",
RowBox[{"\"Country\"", ",", "\"Countries\""}], "]"}],
"\"EntityClass[\\\"Country\\\", \\\"Countries\\\"]\"",
"\"countries\""}, "EntityClass"],
WolframAlphaClient`Private`allassumptions$$ = {{
"type" -> "SubCategory", "word" -> "all countries",
"template" -> "Assuming ${desc1}. Use ${desc2} instead",
"count" -> "2",
"Values" -> {{
"name" -> "Countries",
"desc" -> "all countries, dependencies, and territories",
"input" -> "*DPClash.CountryEC.all+countries-_*Countries-"},\
{"name" -> "SovereignCountries", "desc" -> "all sovereign countries",
"input" -> "*DPClash.CountryEC.all+countries-_*\
SovereignCountries-"}}}},
WolframAlphaClient`Private`assumptions$$ = {},
WolframAlphaClient`Private`open$$ = {1}},
DynamicBox[ToBoxes[
AlphaIntegration`LinguisticAssistantBoxes["", 1,
Dynamic[WolframAlphaClient`Private`query$$],
Dynamic[WolframAlphaClient`Private`boxes$$],
Dynamic[WolframAlphaClient`Private`allassumptions$$],
Dynamic[WolframAlphaClient`Private`assumptions$$],
Dynamic[WolframAlphaClient`Private`open$$]], StandardForm],
ImageSizeCache->{85., {7., 16.}},
TrackedSymbols:>{
WolframAlphaClient`Private`query$$,
WolframAlphaClient`Private`boxes$$,
WolframAlphaClient`Private`allassumptions$$,
WolframAlphaClient`Private`assumptions$$,
WolframAlphaClient`Private`open$$}],
DynamicModuleValues:>{},
UndoTrackedVariables:>{WolframAlphaClient`Private`open$$}],
BaseStyle->{"Deploy"},
DeleteWithContents->True,
Editable->False,
SelectWithContents->True]\), {"Entity", "InternetCode"}]
countrycodes = EntityValue[\!\(\*
NamespaceBox["LinguisticAssistant",
DynamicModuleBox[{WolframAlphaClient`Private`query$$ =
"all countries", WolframAlphaClient`Private`boxes$$ =
TemplateBox[{"\"all countries, dependencies, and territories\"",
RowBox[{"EntityClass", "[",
RowBox[{"\"Country\"", ",", "\"Countries\""}], "]"}],
"\"EntityClass[\\\"Country\\\", \\\"Countries\\\"]\"",
"\"countries\""}, "EntityClass"],
WolframAlphaClient`Private`allassumptions$$ = {{
"type" -> "SubCategory", "word" -> "all countries",
"template" -> "Assuming ${desc1}. Use ${desc2} instead",
"count" -> "2",
"Values" -> {{
"name" -> "Countries",
"desc" -> "all countries, dependencies, and territories",
"input" -> "*DPClash.CountryEC.all+countries-_*Countries-"}\
, {"name" -> "SovereignCountries",
"desc" -> "all sovereign countries",
"input" -> "*DPClash.CountryEC.all+countries-_*\
SovereignCountries-"}}}},
WolframAlphaClient`Private`assumptions$$ = {},
WolframAlphaClient`Private`open$$ = {1}},
DynamicBox[ToBoxes[
AlphaIntegration`LinguisticAssistantBoxes["", 1,
Dynamic[WolframAlphaClient`Private`query$$],
Dynamic[WolframAlphaClient`Private`boxes$$],
Dynamic[WolframAlphaClient`Private`allassumptions$$],
Dynamic[WolframAlphaClient`Private`assumptions$$],
Dynamic[WolframAlphaClient`Private`open$$]], StandardForm],
ImageSizeCache->{91., {7., 16.}},
TrackedSymbols:>{
WolframAlphaClient`Private`query$$,
WolframAlphaClient`Private`boxes$$,
WolframAlphaClient`Private`allassumptions$$,
WolframAlphaClient`Private`assumptions$$,
WolframAlphaClient`Private`open$$}],
DynamicModuleValues:>{},
UndoTrackedVariables:>{WolframAlphaClient`Private`open$$}],
BaseStyle->{"Deploy"},
DeleteWithContents->True,
Editable->False,
SelectWithContents->True]\), {"Entity", "InternetCode"}]