1
$\begingroup$

I know I can write:

SpokenString[a + b^2]

And then obtain as output:

"a plus b squared"

What about the opposite, something like:

ReadString["a plus b squared"]

And then obtain as output (without access to the internet, e.g., calling Wolfram Alpha):

a + b^2
$\endgroup$
  • 2
    $\begingroup$ SpokenString? $\endgroup$ – kglr Apr 18 '18 at 22:59
  • $\begingroup$ Yes, found it right after. Changed my question to ask if there is a way to do the reverse without calling WolframAlpha $\endgroup$ – Luxspes Apr 18 '18 at 23:01
  • $\begingroup$ SpokenString is a great suggestion to go from code -> prose. If you want to go from prose -> code, I recommend checking out inputs in wolframalpha, like wolframalpha.com/input/…. $\endgroup$ – enano9314 Apr 18 '18 at 23:01
  • $\begingroup$ @Luxspes I unfortunately seemed to have missed your edit by a few minutes. If you don't want to call W|A I am not sure your problem is solvable without MUCH work $\endgroup$ – enano9314 Apr 18 '18 at 23:02
  • 1
    $\begingroup$ if you want to restrict input to a handful of "operators" maybe you could do it. Otherwise to be really general you would pretty much be reinventing alpha. $\endgroup$ – george2079 Apr 19 '18 at 0:00
3
$\begingroup$

Assuming:

without calling Wolfram Alpha

means you just want an in-product approach as opposed to a web based approach, you could use Ctrl+= or the WolframAlpha function. For example:

WolframAlpha["a plus b squared", "MathematicaParse"]

HoldComplete[a + b^2]

If you really mean that you don't want to use anything based on Wolfram|Alpha, then I think you will need to create your own parser.

$\endgroup$
  • $\begingroup$ I just want to know if a local function to do it exists $\endgroup$ – Luxspes Apr 19 '18 at 0:02
  • 1
    $\begingroup$ @Luxspes Meaning you want a function that you can use without access to the internet? If so, I think you're out of luck. $\endgroup$ – Carl Woll Apr 19 '18 at 0:29
  • $\begingroup$ Is there a way to be sure? $\endgroup$ – Luxspes Apr 19 '18 at 1:36

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.