Joe
Joe

Reputation: 15349

Constructing human readable sentences based on a survey

The following is a survey given to course attendees to assess an instructor at the end of the course.

Communication Skills
1. The instructor communicated course material clearly and accurately.
Yes No
2. The instructor explained course objectives and learning outcomes.
Yes No
3. In the event of not understanding course materials the instructor was available outside of class.
Yes No
4. Was instructor feedback and grading process clear and helpful?
Yes No
5. Do you feel that your oral and written skills have improved while in this course?
Yes No

We would like to summarize each attendees selection based on the choices chosen by him.

If the provided answers were [No, No, Yes, Yes, Yes]. Then we would summarize this as "The instructor was not able to summarize course objectives and learning outcomes clearly, but was available and usually helpful outside of class. The instructor feedback and grading process was clear and helpful and I feel that my oral and written skills have improved because of this course.

Based on the selections chosen by the attendee the summary would be quite different. This leads to many answers based on the choices selected and the number of such questions in the survey. The questions are usually provided by the training organization. How do you come up with a generic solution so that this can be effectively translated into a human readable form. I am looking for tools or libraries (java based), suggestions which will help me create such human readable output. I would like to hide the complexity from the end users as much as possible.

Upvotes: 6

Views: 434

Answers (7)

Ryan
Ryan

Reputation: 2112

I would recommend something similar to what Yuval has proposed, with a couple of slight modifications to make the language more natural.

Preparation

You will need to create a positive version and a negative version for each statement. You will also need to sort the statements by their subject; in your example, the first four question can generate a statement about the instructor, whereas the last question should generate a statement about myself. This is important, as non-runon sentences tend to have a singular subject.

Subject: The instructor

Positive: "communicated course material clearly and accurately", "explained course objectives and learning outcomes", "was available outside of class to explain course materials", "provided feedback and grades that were both clear and helpful"

Negative: "did not communicate material clearly or accurately", "did not explain course objectives or learning outcomes", "was not available outside of class to explain course materials", "did not provide feedback and grades that were clear or helpful"

Subject: I/me

Positive: "feel that my oral and written skills have improved while in this course"

Negative: "do not feel that my oral and written skills have improved while in this course"

Combining Statements

Agreeing statements

When statements 1-4 are all in agreement (either all positive or all negative), you only need to combine them in a very simple manner: "The instructor {statement1}, {statement2}, {statement3} and {statement4}."

If statement 5 agrees with statements 1-4, finish it off with: "Overall, I {statement5}"

If statement 5 disagrees, finish it off with: "However, I still {statement5}"

Disagreeing statements

The tricky stuff happens when some of the statments are positive and some are negative. The end result will need to look like: "The instructor {statement1} and {statement2}, but {statement3} and {statement4}. Overall, I {statement5}."

We essentially have 2 groups of statements; in my example, statements 1 and 2 are in the first group, statements 3 and 4 are in the second. To make this work, the groups should contain agreeing statements; each group should be all positive or all negative. Reorder the statements to put each groups in agreement. We will then combine the group statements like so: "The instructor {group_statement}, but {other_group_statement}"

If there is only 1 statement in a group, use the individual statement as the group statement. When there are multiple statements in a group, link all statements except the final statement with a comma. Link the final statement in the group with an "and"

The use of the English 'but' tends to put more emphasis on what comes after it than before it: if we finish with the positive group, the whole statement sounds positive, and if we finish with the negative group, the whole statement sounds much more negative. It will be up to you to decide how you want to emphasize the statements, but I would recommend ordering it so that it agrees with statement 5 and finishing off with "Overall, I {statement5}". If you decide to order it in a way that disagrees with statement 5, you should end with "However, I still {statement5}".

That should get you started, and you can make a few modifications as necessary.

Upvotes: 1

Corvin
Corvin

Reputation: 990

Of course, you probably have your own reasons for wanting a feature like this, but from the design point of view I would vote strongly against this if this was my code. Writing 32 (in the worst case) different paragraphs for your example will definitely provide human-readable sentences for your end user and make them feel like someone is communicating to them. Trying to generate something automatically will rob you of much time and still will look too bland, especially if you end user should happen to see the survey results more than once.

Upvotes: 0

Danny Varod
Danny Varod

Reputation: 18068

Try looking at the implementation of Matlab's "why" function as an example.

Upvotes: 0

Jim Kiley
Jim Kiley

Reputation: 3652

Have you looked at any natural language processing projects, such as http://opennlp.sourceforge.net/?

Upvotes: 1

Eric Mickelsen
Eric Mickelsen

Reputation: 10377

Unfortunately, I don't think there is a generic solution to this problem. Not only is it hard/impossible to figure out which questions are related and how in order to group them and add words like "but," "and" and "however" where appropriate, but the wording that you are trying to generate isn't an obvious transformation. Take question 4: If the responder answered no, the resulting assertion would be "Either instructor feedback was not clear or not helpful or instructor grading process was not clear or not helpful," assuming the original question was perfectly parsed. I doubt that's what you're looking for. I would also point out that your summary, assuming it contains some form of each response, won't really be any faster for the reviewer to read. You may be underestimating both the natural ambiguity of the English language and the specificity of your desired result.

Upvotes: 1

Yuval
Yuval

Reputation: 8087

You could prepare a positive version and negative response sentence for each question. You could then connect these sentences using connecting words of supporting or contradicting nature (however, furthermore, in addition, despite this...) so that the response will be along the lines of

"the instructor communicated the course material clearly and accurately. Furthermore, the instructor explained course objectives and learning outcomes. However, In the event of not understanding course materials the instructor was not available outside of class."

and so on. All you have to do is check if the response to question n is the same as to question n-1 to decide which connecting word to use. HTH

Upvotes: 6

Henry Hammond
Henry Hammond

Reputation: 173

The simplest solution to this problem would be a large if else block, however that may not be what your looking for.

If you want multiple unique answers without n! if else statements, try making each answer generate one or two sentances. If you have a positive and a negative check the previous answer to and if it contrasts suffix the sentance with 'However' or something along those lines.

I hope this was helpful.

Upvotes: 0

Related Questions