GSOC - Natural Input Parser

123 views
Skip to first unread message

Jerry Li

unread,
Feb 29, 2016, 8:26:34 PM2/29/16
to sympy
Hi, 

I'm currently a first-year undergraduate Engineering student at the University of Toronto who is fairly experienced with Python, and I'm interested in contributing to SymPy for GSOC 2016. After familiarizing myself with the basics of SymPy and reading through GSOC Ideas page, I was drawn to the idea of improving SymPy Gamma/Live's language recognition so that it could interpret natural English and text-based math, like Wolfram Alpha. I understand that the best way of doing this would be to include the functionality in the SymPy library itself so that it could be called from SymPy Gamma/Live. 

I've read through the Parsing page in the SymPy wiki, as well as some related threads in this mailing list. The thread linked on the wiki especially seems to include lots of informative discussion, but not much of it was followed up upon. I've been doing some preliminary research, and I believe that, with time and a lot of learning, it should be within my scope to implement a parser that would work for most common English/text inputs and include some informative error messages to help the user. This perhaps could involve using adapted code from external libraries and a parser generator. I'd be willing to put a lot of time into learning new skills to get the project done.

I believe that this functionality could improve the user experience of SymPy Live/Gamma, which would help people out and draw more attention/users to SymPy. I was also interested in implementing a LaTeX parser, but it seems like there's some work in progress in that area.

Anyways, I was mostly wondering if anyone had input on whether or not this would be a suitable project to pursue for GSoC, and if there were any suggestions on recommended approaches. If so, I'll do some more research and start drafting up a proposal. If not, I'll look into other potential things to contribute in for SymPy. In terms of the patch requirement for GSoC, I've submitted one bug fix pull request which was merged so far, and will be looking for more opportunities to do so in the next few weeks.

Thanks, 
Jerry

Jason Moore

unread,
Feb 29, 2016, 8:44:49 PM2/29/16
to sy...@googlegroups.com
Jerry,

As far as I know there is no work to get that latex2sympy parser into sympy or coordinate anything further than what was said in that issue. It would be worth contacting the author.

Jason

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/02716b63-2833-47d8-95ce-3fc6411615c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anthony Scopatz

unread,
Feb 29, 2016, 8:47:27 PM2/29/16
to sy...@googlegroups.com
This would be great to have, though!


For more options, visit https://groups.google.com/d/optout.
--

Asst. Prof. Anthony Scopatz
Nuclear Engineering Program
Mechanical Engineering Dept.
University of South Carolina
Affiliated Professor of the University of Haifa
sco...@cec.sc.edu
Office: (803) 777-7629
Cell: (512) 827-8239
Check my calendar

Jerry Li

unread,
Mar 13, 2016, 9:45:29 PM3/13/16
to sympy
Hi,

I'm beginning to work on a proposal for this project, and I just had a question about how I should approach it. Using a parser generator would probably make it easier to create a parser, but may introduce an external dependency. Would this be discouraged? Should I aim for everything to be custom-written and kept within SymPy? 

I also reached out to the creator of latex2sympy to see if he's still planning to add it to SymPy. If not, I'll probably try to find a way to work LaTeX parsing into my proposal as well, since it would be quite useful. My question about introducing an external dependency would need to be discussed with regards to latex2sympy as well, since that uses a parser generator.

Thanks, Jerry

Aaron Meurer

unread,
Mar 14, 2016, 1:51:08 PM3/14/16
to sy...@googlegroups.com
External dependencies are fine for SymPy Gamma, especially if it's
something like an NLP framework, which we wouldn't want to rewrite
ourselves.

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/8baaf0e5-ffe9-4d1c-89fa-05b9306af903%40googlegroups.com.

Jason Moore

unread,
Mar 15, 2016, 6:55:20 PM3/15/16
to sy...@googlegroups.com
We have optional dependencies in SymPy. If their latex2sympy parser works well, it would be nice to use it, but I'm not sure how complex it is to install antlr and everything else. Antlr seems like a very powerful and useful tool and probably does everything we need to do with parsing better than what we could do if we wrote it ourselves. It's nice not reinventing (or maintaining) the wheel for things like this.

Richard Fateman

unread,
Mar 20, 2016, 1:16:32 AM3/20/16
to sympy
I suggest you first study ambiguous grammars and how to parse them.
but there are others that you can find.

It is not a case of "writing a program"   but  solving the problem.

Is fx  the same as f*x or f(x)?    What about sinx,  sin x  sin x,

what does sin x+y  mean?    same as sin x + y?

And we haven't even mentioned "natural language".

Good luck.
Reply all
Reply to author
Forward
0 new messages