Re: [Sugar-devel] Please review code (was Re: Speak answering maths questions)

2010-06-02 Thread Aleksey Lim
On Tue, Jun 01, 2010 at 10:52:11PM +1200, Tim McNamara wrote:
 Hi Chris, et al.
 
 ref http://pastebin.com/2XNCHGiy
 
 I am most of the way there, as you can see from lines 91 - 143. The function
 is attempting to return something that can be read out loud back to a child
 if they ask the Speak robot a mathematical question.
 
 My biggest question is the best way to import the functionality from the
 Calculate activity. As per silbe's comments on IRC, I'm leaning towards
 duplicating the two modules inside of the Speak activity.

Such duplicating in common case is not good idea (but could optimal
option in case of Calculate modules). Anyway what about creating libmath
(or so) and patch Speak (at least) and Calculate to use this lib.

In case of Speak, it is already using 0sugar dependecies[1]. You can create
separate project on git like libjournal[2]. Only libmath string will be
added[3] to [1] to use libmath in Speak. 0sugar is not yet ready for
broad usage but it can work in case of libmath.

[1] 
http://git.sugarlabs.org/projects/speak/repos/mainline/blobs/master/activity/activity.info#line10)
[2] http://git.sugarlabs.org/projects/journal-service
[3] 
http://wiki.sugarlabs.org/go/Documentation_Team/Services/Activity_Developers_Guide

 I guess I could implement my own parser, I thought about using the ast
 module. Then I realised that I would just make a poor replication of the
 parser  evaluator that's already been created.
 
 Thoughts/comments welcome.
 
 Tim
 
 
 
 On 30 May 2010 05:34, Chris Ball c...@laptop.org wrote:
 
  Hi Tim,
 
  I'd suggest looking at the parsing logic in the Calculate activity --
  it deals with the same problems.
 
  - Chris.
  --
  Chris Ball   c...@laptop.org
  One Laptop Per Child
 

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel


-- 
Aleksey
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] Please review code (was Re: Speak answering maths questions)

2010-06-01 Thread Tim McNamara
Hi Chris, et al.

ref http://pastebin.com/2XNCHGiy

I am most of the way there, as you can see from lines 91 - 143. The function
is attempting to return something that can be read out loud back to a child
if they ask the Speak robot a mathematical question.

My biggest question is the best way to import the functionality from the
Calculate activity. As per silbe's comments on IRC, I'm leaning towards
duplicating the two modules inside of the Speak activity.

I guess I could implement my own parser, I thought about using the ast
module. Then I realised that I would just make a poor replication of the
parser  evaluator that's already been created.

Thoughts/comments welcome.

Tim



On 30 May 2010 05:34, Chris Ball c...@laptop.org wrote:

 Hi Tim,

 I'd suggest looking at the parsing logic in the Calculate activity --
 it deals with the same problems.

 - Chris.
 --
 Chris Ball   c...@laptop.org
 One Laptop Per Child

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Please review code (was Re: Speak answering maths questions)

2010-06-01 Thread Rafael Enrique Ortiz Guerrero
This is great Tim,
this is one of the features that we would like to see on Speak for
some time now. I've heard these ideas by professors that we have been
working with in Bogotá, Colombia.



Rafael Ortiz



On Tue, Jun 1, 2010 at 5:52 AM, Tim McNamara
paperl...@timmcnamara.co.nz wrote:
 Hi Chris, et al.

 ref http://pastebin.com/2XNCHGiy

 I am most of the way there, as you can see from lines 91 - 143. The function
 is attempting to return something that can be read out loud back to a child
 if they ask the Speak robot a mathematical question.

 My biggest question is the best way to import the functionality from the
 Calculate activity. As per silbe's comments on IRC, I'm leaning towards
 duplicating the two modules inside of the Speak activity.

 I guess I could implement my own parser, I thought about using the ast
 module. Then I realised that I would just make a poor replication of the
 parser  evaluator that's already been created.

 Thoughts/comments welcome.

 Tim



 On 30 May 2010 05:34, Chris Ball c...@laptop.org wrote:

 Hi Tim,

 I'd suggest looking at the parsing logic in the Calculate activity --
 it deals with the same problems.

 - Chris.
 --
 Chris Ball   c...@laptop.org
 One Laptop Per Child


 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel