特徴抽出を使ってテキスト検索ツールを作成する
「不思議の国のアリス」の原作(英語)からの文章で特徴検出器を訓練する.
In[1]:=

alice = ExampleData[{"Text", "AliceInWonderland"}];
sentences = TextSentences[alice];
fe = FeatureExtraction[sentences]
Out[1]=

データ集合の抽出された特徴についてNearestFunctionを生成する.
In[2]:=

nf = Nearest[fe[sentences] -> Automatic]
Out[2]=

「不思議の国のアリス」中の最も近い文を表示する関数を構築し,これをいくつかの文に使ってみる.
In[3]:=

nearestalice = sentences[[First@nf[fe[#]]]] &;
In[4]:=

nearestalice["Alice and the Rabbit"]
Out[4]=

In[5]:=

nearestalice["Off her head"]
Out[5]=
