How to translate formulas into form of natural language?

Posted by Ricky on Programmers See other posts from Programmers or by Ricky
Published on 2012-08-30T07:35:20Z Indexed on 2012/08/30 9:50 UTC
Read the original article Hit count: 340

Filed under:
|

I am recently working on a project aiming at evaluating whether an android app crashes or not. The evaluation process is

  1.Collect the logs(which record the execution process of an app).
  2.Generate formulas to predict the result
    (formulas is generated by GP)
  3.Evaluate the logs by formulas 



Now I can produce formulas, but for convenience for users, I want to translate formulas into form of natural language and tell users why crash happened.(I think it looks like "inverse natural language processing".)

To explain the idea more clearly, imagine you got a formula like this:

  155 - count(onKeyDown) >= 148

It's obvious that if count(onKeyDown) > 7, the result of "155 - count(onKeyDown) >= 148" is false, so the log contains more than 7 onKeyDown event would be predicted "Failed".

I want to show users that if onKeyDown event appears more than 7 times(155-148=7), this app will crash.

However, the real formula is much more complicated, such as:

  (< !( ( SUM( {Att[17]}, Event[5]) <= MAX( {Att[7]}, Att[0] >= Att[11]) OR SUM( {Att[17]}, Event[5]) > MIN( {Att[12]}, 734 > Att[19]) ) OR count(Event[5]) != 1 ) > (< count(Att[4] = Att[3]) >= count(702 != Att[8]) + 348 / SUM( {Att[13]}, 641 < Att[12]) mod 587 - SUM( {Att[13]}, Att[10] < Att[15]) mod MAX( {Att[13]}, Event[2]) + 384 > count(Event[10]) != 1))

I tried to implement this function by C++, but it's quite difficult, here's the snippet of code I am working right now.

Does anyone knows how to implement this function quickly?(maybe by some tools or research findings?)Any idea is welcomed: )

Thanks in advance.

© Programmers or respective owner

Related posts about c++

Related posts about android