Mathematica 8 のDictionaryLookup
関数は"English"
、デフォルトで言語として使用します。デフォルト言語を"BritishEnglish"
またはに設定する方法はありますか"Spanish"
?
前もって感謝します。
Mathematica 8 のDictionaryLookup
関数は"English"
、デフォルトで言語として使用します。デフォルト言語を"BritishEnglish"
またはに設定する方法はありますか"Spanish"
?
前もって感謝します。
これに対するオプションはないようですが、 の定義をDictionaryLookup
自分に合うように変更できます。
ここで使用する方法は、DownValues の自動順序付けに依存しており、バージョン 7 用に記述されているため、調整が必要になる場合があります。DownValues[DictionaryLookup]
関数がトップレベルのMathematicaコードであるため、関数がどのように記述されているかを見ることができます。
$dictionaryLanguage = "Spanish";
Unprotect[DictionaryLookup];
DictionaryLookup[pat : Except[_List], x___] /;
! TrueQ[$dicLang] && ValueQ[$dictionaryLanguage] :=
Block[{$dicLang = True},
DictionaryLookup[{$dictionaryLanguage, pat}, x]
]
DownValues[DictionaryLookup] =
RotateRight @ DownValues[DictionaryLookup];
Protect[DictionaryLookup];
この定義では、$dictionaryLanguage
が設定されている場合、その値が言語に使用されます。でデフォルトの動作を復元できます$dictionaryLanguage =.
。例:
$dictionaryLanguage = "Spanish";
DictionaryLookup["*orac*", 3]
{"アドラシオン", "アミノラシオン", "コラボラシオン"}
$dictionaryLanguage =.;
DictionaryLookup["*orac*", 3]
{"コラクル"、"コラクル"、"ホレス"}
呼び出しも の外でルックアップを行うことに注意してくださいDictionaryLookup
。次のような言語の辞書をロードできます。
DataPaclets`Dictionary`ReloadDictionary["Dutch"]
にデータを配置しますDataPaclets`Dictionary`$Dictionary
。検索例:
Pick[#, # ~StringMatchQ~ "*fzand*"] ~Take~ 4 & @ DataPaclets`Dictionary`$Dictionary
{"afzand", "afzandde", "afzandden", "afzanderij"}
同等のDictionaryLookup
クエリ:
DictionaryLookup[{"Dutch", "*fzand*"}, 4]
{"afzand", "afzandde", "afzandden", "afzanderij"}
これらのツールを頻繁に使用する場合は、コンテキスト パスで次のように指定できます。
AppendTo[$ContextPath, "DataPaclets`Dictionary`"]
次に、コンテキスト名なしでReloadDictionary
andをそのまま使用できます。$Dictionary