Skip to content

Commit

Permalink
add WolframBeta[] function
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoudbuzing committed Apr 30, 2018
1 parent 2cccdcb commit b6502ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Prototypes/Prototypes.wl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Module[ {files},
(* load in any session *)
files = {"Build.wl", "Dataset.wl", "Files.wl",
"Image.wl", "Language.wl", "Paclet.wl",
"Resources.wl", "Search.wl", "String.wl", "Color.wl", "Entities.wl"};
"Resources.wl", "Search.wl", "String.wl", "Color.wl", "Entities.wl", "WolframAlpha.wl"};
Map[ Get[ FileNameJoin[{DirectoryName[$InputFileName], #}] ] &, files ];

(* only load in a notebook session *)
Expand Down
2 changes: 2 additions & 0 deletions Prototypes/Usage.wl
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,5 @@ CreateNotebookIndex::usage = "CreateNotebookIndex[] creates a SearchIndexObject
QuickSearch::usage = "QuickSearch[] provides a quick interactive way to search all notebooks under $InstallationDirectory. You need to run CreateNotebookIndex[] once before using this function";
(* entities *)
EntityPropertiesDataset::usage = "EntityPropertiesDataset[entity] creates a dataset for the supported properties for 'entity'";
(* wolfram alpha *)
WolframBeta::usage = "WolframBeta[input] translates 'input' to English, then calls WolframAlpha with the translation";
5 changes: 5 additions & 0 deletions Prototypes/WolframAlpha.wl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
WolframBeta[ input_String, args___ ] := Module[{language, translation},
language = LanguageIdentify[input];
translation = If[language =!= Entity["Language", "English"], TextTranslation[input, language -> "English"], input];
WolframAlpha[translation, args]
]

0 comments on commit b6502ea

Please sign in to comment.