Wolfram Computation Meets Knowledge

Wolfram 语言:
快速编程入门

显示附加备注:
全部选择 
开始使用

真实世界实体 观看视频

Java 程序员备注:

Wolfram 语言中的实体结合了自然语言处理、高级数据语义和知识库访问,以特有的方式统一真实世界实体表示,从而创建了全新的编程流程.

Python 程序员备注:

Wolfram 语言中的实体结合了自然语言处理,高级数据语义和知识库访问,以特有的方式统一真实世界实体表示. 运用紧密集成的笔记本系统的同时,Wolfram 语言实体实现了全新和表性类型的编程流程,这在 Python 中无法快速实现.

在 Wolfram 语言中,真实世界实体只是另一种符号表达式.

Wolfram 语言知道数千种真实世界实体

使用自然语言指定实体很方便:

In[1]:=1
los angeles
Out[1]=1

实体有很多属性. 这是其中的一个

In[2]:=2
EntityValue[Entity["City", {"LosAngeles", "California", "UnitedStates"}], "Population"]
Out[2]=2

entity["Properties"] 找到属性列表.


当输入自然语言时, 用于消除歧义:

In[1]:=1
los angeles

表示一个实体类:

In[1]:=1
EntityList[EntityClass["Country", "GermanSpeaking"]]
Out[1]=1

使用 ctrl+= 输入单位和度量:

In[1]:=1
3 meters
Out[1]=1

InputForm 显示符号表达式的结构:

In[2]:=2
InputForm[%]
Out[2]=2

GeoPosition 代表一个地理位置:

In[1]:=1
GeoPosition[\!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{WolframAlphaClient`Private`query$$ = "eiffel tower", WolframAlphaClient`Private`boxes$$ = TemplateBox[{"\"Eiffel Tower\"", RowBox[{"Entity", "[", RowBox[{"\"Building\"", ",", "\"TourEiffel\""}], "]"}], "\"Entity[\\\"Building\\\", \\\"TourEiffel\\\"]\"", "\"building\""}, "Entity"], WolframAlphaClient`Private`allassumptions$$ = {{ "type" -> "Clash", "word" -> "eiffel tower", "template" -> "Assuming \"${word}\" is ${desc1}. Use as \ ${desc2} instead", "count" -> "2", "Values" -> {{ "name" -> "Building", "desc" -> "a structure", "input" -> "*C.eiffel+tower-_*Building-"}, { "name" -> "Word", "desc" -> "a word", "input" -> "*C.eiffel+tower-_*Word-"}}}}, WolframAlphaClient`Private`assumptions$$ = {}, WolframAlphaClient`Private`open$$ = {1, 2}}, 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->{183., {10., 18.}}, 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]\)]
Out[1]=1

In[2]:=2
GeoListPlot[{\!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{WolframAlphaClient`Private`query$$ = "eiffel tower", WolframAlphaClient`Private`boxes$$ = TemplateBox[{"\"Eiffel Tower\"", RowBox[{"Entity", "[", RowBox[{"\"Building\"", ",", "\"TourEiffel\""}], "]"}], "\"Entity[\\\"Building\\\", \\\"TourEiffel\\\"]\"", "\"building\""}, "Entity"], WolframAlphaClient`Private`allassumptions$$ = {{ "type" -> "Clash", "word" -> "eiffel tower", "template" -> "Assuming \"${word}\" is ${desc1}. Use as \ ${desc2} instead", "count" -> "2", "Values" -> {{ "name" -> "Building", "desc" -> "a structure", "input" -> "*C.eiffel+tower-_*Building-"}, { "name" -> "Word", "desc" -> "a word", "input" -> "*C.eiffel+tower-_*Word-"}}}}, WolframAlphaClient`Private`assumptions$$ = {}, WolframAlphaClient`Private`open$$ = {1, 2}}, 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->{183., {10., 18.}}, 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]\), \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{WolframAlphaClient`Private`query$$ = "Ayers Rock", WolframAlphaClient`Private`boxes$$ = TemplateBox[{"\"Uluru\"", RowBox[{"Entity", "[", RowBox[{"\"Mountain\"", ",", "\"Uluru\""}], "]"}], "\"Entity[\\\"Mountain\\\", \\\"Uluru\\\"]\"", "\"mountain\""}, "Entity"], WolframAlphaClient`Private`allassumptions$$ = {}, WolframAlphaClient`Private`assumptions$$ = {}, WolframAlphaClient`Private`open$$ = {1, 2}}, 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->{130., {10., 18.}}, 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]\)}]
Out[2]=2

DateObject 代表日期/时间:

In[1]:=1
Sunset[Tomorrow]
Out[1]=1

In[2]:=2
InputForm[%]
Out[2]=2

Python 程序员备注:

DateObjects 是 Wolfram 语言的独特函数,可自动将导入或导出解析至其他环境中. 在 Python 中,虽然分别有程序库可以解析数据字符串,但需要手动分割或结合.


© 2019 Wolfram. All rights reserved.