NaturalLanguage.frameworkには各種言語の定義を行なった定数が57ほど定義されているようです。ただし、これらの定義がすべて利用できるわけがありません。
とりあえず、本当にどのぐらいの言語が使えるのか、チェックしておくことが必要です。
結論からいえば、Appleが何を考えているのかよくわかりません。macOS 13では7言語ほど使えるという結果になりましたが、macOS 14では英語しか使えないという結果になっています。OSがバージョンアップするとOSの機能が低下するという理解不能な挙動を示しています。バグ、、、なのかも????
Appleが用意した新機能は、ひととおり「本当に使えるのか」をチェックする必要があります。だいたいは搭載されて1発目はバグだらけで、OSのメジャーアップデートを経て良くなったり、よくならなかったりします。
この機能はどちらなんでしょう? Shortcutみたいに「救いようがない」のもありますが……
AppleScript名:指定言語でNLEmbeddingを処理できるかチェック_13_14.scpt |
— – Created by: Takaaki Naganoya – Created on: 2024/03/13 — – Copyright © 2024 Piyomaru Software, All Rights Reserved — use AppleScript version "2.8" use framework "Foundation" use framework "NaturalLanguage" use scripting additions –The result is on macOS 13.6.5 / 14.4 set aRes to testNLLanguage("NLLanguageEnglish") of me –> true set aRes to testNLLanguage("NLLanguageFrench") of me –> true–>false (macOS 14) set aRes to testNLLanguage("NLLanguageGerman") of me –> true–>false (macOS 14) set aRes to testNLLanguage("NLLanguageItalian") of me –> true–>false (macOS 14) set aRes to testNLLanguage("NLLanguagePortuguese") of me –> true–>false (macOS 14) set aRes to testNLLanguage("NLLanguageSimplifiedChinese") of me –> true–>false (macOS 14) set aRes to testNLLanguage("NLLanguageSpanish") of me –> true–>false (macOS 14) set aRes to testNLLanguage("NLLanguageUndetermined") of me –> true –Natural Language framework doesn’t recognize. set aRes to testNLLanguage("NLLanguageAmharic") of me –> false set aRes to testNLLanguage("NLLanguageArabic") of me –> false set aRes to testNLLanguage("NLLanguageArmenian") of me –> false set aRes to testNLLanguage("NLLanguageBengali") of me –> false set aRes to testNLLanguage("NLLanguageBulgarian") of me –> false set aRes to testNLLanguage("NLLanguageBurmese") of me –> false set aRes to testNLLanguage("NLLanguageCatalan") of me –> false set aRes to testNLLanguage("NLLanguageCherokee") of me –> false set aRes to testNLLanguage("NLLanguageCroatian") of me –> false set aRes to testNLLanguage("NLLanguageCzech") of me –> false set aRes to testNLLanguage("NLLanguageDanish") of me –> false set aRes to testNLLanguage("NLLanguageDutch") of me –> false set aRes to testNLLanguage("NLLanguageFinnish") of me –> false set aRes to testNLLanguage("NLLanguageGeorgian") of me –> false set aRes to testNLLanguage("NLLanguageGreek") of me –> false set aRes to testNLLanguage("NLLanguageGujarati") of me –> false set aRes to testNLLanguage("NLLanguageHebrew") of me –> false set aRes to testNLLanguage("NLLanguageHindi") of me –> false set aRes to testNLLanguage("NLLanguageHungarian") of me –> false set aRes to testNLLanguage("NLLanguageIcelandic") of me –> false set aRes to testNLLanguage("NLLanguageIndonesian") of me –> false set aRes to testNLLanguage("NLLanguageJapanese") of me –> false set aRes to testNLLanguage("NLLanguageKannada") of me –> false set aRes to testNLLanguage("NLLanguageKazakh") of me –> false set aRes to testNLLanguage("NLLanguageKhmer") of me –> false set aRes to testNLLanguage("NLLanguageKorean") of me –> false set aRes to testNLLanguage("NLLanguageLao") of me –> false set aRes to testNLLanguage("NLLanguageMalay") of me –> false set aRes to testNLLanguage("NLLanguageMalayalam") of me –> false set aRes to testNLLanguage("NLLanguageMarathi") of me –> false set aRes to testNLLanguage("NLLanguageMongolian") of me –> false set aRes to testNLLanguage("NLLanguageNorwegian") of me –> false set aRes to testNLLanguage("NLLanguageOriya") of me –> false set aRes to testNLLanguage("NLLanguagePersian") of me –> false set aRes to testNLLanguage("NLLanguagePolish") of me –> false set aRes to testNLLanguage("NLLanguagePunjabi") of me –> false set aRes to testNLLanguage("NLLanguageRomanian") of me –> false set aRes to testNLLanguage("NLLanguageRussian") of me –> false set aRes to testNLLanguage("NLLanguageSinhalese") of me –> false set aRes to testNLLanguage("NLLanguageSlovak") of me –> false set aRes to testNLLanguage("NLLanguageSwedish") of me –> false set aRes to testNLLanguage("NLLanguageTamil") of me –> false set aRes to testNLLanguage("NLLanguageTelugu") of me –> false set aRes to testNLLanguage("NLLanguageThai") of me –> false set aRes to testNLLanguage("NLLanguageTibetan") of me –> false set aRes to testNLLanguage("NLLanguageTraditionalChinese") of me –> false set aRes to testNLLanguage("NLLanguageTurkish") of me –> false set aRes to testNLLanguage("NLLanguageUkrainian") of me –> false set aRes to testNLLanguage("NLLanguageUrdu") of me –> false set aRes to testNLLanguage("NLLanguageVietnamese") of me –> false on testNLLanguage(aLangName) set aText to "use AppleScript use framework \"Foundation\" use framework \"NaturalLanguage\" set targLang to (current application’s " & aLangName & ") set aEmb to current application’s NLEmbedding’s wordEmbeddingForLanguage:(targLang) if aEmb = missing value then return false return true " return run script aText end testNLLanguage |
More from my site
(Visited 1 times, 1 visits today)