Wolfram 语言

增强的机器学习

用特征提取创建文本查询工具

根据《爱丽丝梦游仙境》中的句子培训特征提取器:

In[1]:=
Click for copyable input
alice = ExampleData[{"Text", "AliceInWonderland"}]; sentences = TextSentences[alice]; fe = FeatureExtraction[sentences]
Out[1]=

根据从数据集提取的特征生成 NearestFunction.

In[2]:=
Click for copyable input
nf = Nearest[fe[sentences] -> Automatic]
Out[2]=

构建显示与《爱丽丝梦游仙境》中最接近句子的函数,并对其他句子进行使用.

In[3]:=
Click for copyable input
nearestalice = sentences[[First@nf[fe[#]]]] &;
In[4]:=
Click for copyable input
nearestalice["Alice and the Rabbit"]
Out[4]=
In[5]:=
Click for copyable input
nearestalice["Off her head"]
Out[5]=

相关范例

de en es fr ja ko pt-br ru