10
$\begingroup$

For example, to learn the function Alphabet, we can read its document. But it's rather ambiguous, like "Some languages have extra properties". How to find all the languages that can be used in Alphabet ? And how to find all the extra properties of those languages, like "index characters" of "spanish" Alphabet["Spanish", "IndexCharacters"]?

Which means how to find all possible strings that can be passed into Alphabet[#]& ,or can be passed into Alphabet["Spanish",#]& ?

For more examples, how to find all possible strings that can be used in Entity[#]& , or in Entity["PlaneCurve",#]&, or in Entity["PlaneCurve","Cardiod",#]&?.

How to find all possible strings that can be used in SystemModel["Modelica.Electrical.Analog.Basic", #]&?

This question is not specified in those three functions. Is there a more general way to find all those strings which can be used as arguments or options in any functions?

$\endgroup$

1 Answer 1

5
$\begingroup$

My first attempt involved trying Alphabet on every language from EntityList@"Language", all 9211 of them. I also dug around with GeneralUtilities`PrintDefinitions@Alphabet and found a few more.

b3m2a1's comment gets most or all of those languages with his one-liner:

EntityValue[EntityClass["Alphabet",All],"FullCharacters","Association"]

It's hard to compare his code to my results, since the alphabets given don't match with the results of Alphabet in every case. Consider StringJoin@Alphabet@"Korean" (no different with the Entity vs "Korean")

ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣ

vs what is returned by EntityValue

Entity["Alphabet","Korean::2v535"] -> 
"ㄱᄀ-ᄒ伽佳假價加可...廊朗浪狼來ㅁㅂㅅㅇ樂ㅈㅊ車ㅋㅌㅍㅎ滑ᅡ-ᅵᆨ-ᇂ郎"

(I've added the ellipsis and stringjoin)


Are you more interested in which language/curve/other entities exist, or are you interested in what are all the valid inputs and outputs of functions like Alphabet? They're not the same thing.

$\endgroup$
4
  • 2
    $\begingroup$ EntityValue can be used to extract all property values more efficiently. E.g. EntityValue[EntityClass["Alphabet", All], "FullCharacters", "Association"] $\endgroup$
    – b3m2a1
    May 13, 2022 at 6:30
  • $\begingroup$ Thanks a lot. Actually, I'm more interested in all the valid inputs of functions. $\endgroup$ May 14, 2022 at 10:34
  • $\begingroup$ Alphabet calls System`CharacterFunctionsDump`iAlphabet which calls either (1) System`CharacterFunctionsDump`iWritingScriptData for Entity["WritingScript",_] inputs, (2) System`CharacterFunctionsDump`iAlphabetScriptData for String inputs, or (3) System`CharacterFunctionsDump`getLanguageAlphabet for Entity["Language",_] inputs. The first two are hardcoded. The last one looks up Entity properties. This is it; there is an explicit Except@Alternatives[...] definition which throws an error if it's not a String or appropriate Entity. $\endgroup$
    – Adam
    May 16, 2022 at 4:37
  • $\begingroup$ I'll add that the precise values of Entities doesn't really matter: at the end of the day these things are in a database because someone put them there, not because they were derived or provably true. $\endgroup$
    – Adam
    May 16, 2022 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.