Consider the following sentences:

  • Every day I want to:

    1. read a book
    2. do my homework
    3. go jogging for 20 minutes
    4. be nice to my mom

To convert these into the following questions:

  • Did you:

    1. read a book today?
    2. do your homework today?
    3. go jogging for 20 minutes today?
  • Were you:

    1. nice to your mom today?

You would change:
me --> you and
be --> were

I need to write a program which does this, are there any cases where this would fail? What are the general rules?

I know for long sentences this would make no sense, but only 50 characters are allowed.

  • 1
    Writing a program for this purpose sounds weird to me. – user8568 May 25 '11 at 21:18
  • 2
    @Third Idiot: The OP is asking for the rules of language, not for help with a piece of code, so that's an ill suggestion. @johnmossel: it hardly sounds as though this will be a mission-critical system and let's guess you can always update it, I'd recommend just writing it, testing and updating - that's even if you need to alter it at all, for so long as it serves its purpose there are no problems. ;) If it's an important application then this obviously (mostly) doesn't apply. – Grant Thomas May 25 '11 at 21:35
  • I can't think of other cases now but IMO, "To Be" or "To Do" is most common way of making questions and as Mr.Disappointment said, you can update it easily when you face an exception. – user8568 May 25 '11 at 21:44
  • 1
    Just for the sake of precision, I'll point out that it should be me --> you and my --> your, not me --> your. – senderle May 25 '11 at 22:09
  • 2
    @senderle Just for the sake of accuracy, I'd suggest the correct word is accuracy, not precision. ;) – Kit Z. Fox May 25 '11 at 22:45

Your program needs to do a couple of things:

  1. Identify the main verb. This is harder than it seems in the general case, but if you've constrained your answers to complete a sentence of the form Every day I want to [blank], then you can be reasonably assured that the first word of the continuation is a verb in the infinitive form.
  2. If the main verb is be, then the verb should be moved directly to the front of the sentence.
  3. If the main verb is have followed by a past participle, then the verb (but not the participle) should be moved directly to the front of the sentence.
  4. For all other verbs, you should leave the verb in place (uninflected) and add Did to the front of the sentence.
  5. Replace all forms of the pronoun I with the corresponding form of the pronoun you
  6. Inflect the verbs at the beginning of the sentence to agree with you.

So it's quite a bit more complicated than you originally described. However, provided that the input sentences are suitably constrained, it should be possible with relatively small effort. (Note, however, that turning arbitrary statements into questions is quite a bit harder, and generally cannot be accomplished without a complete parse of the original statement.)


You might get hung up on more complex forms, but I agree with Mr. Disappointment that you should just write it and start fixing problems as you run into them. (Mr. Disappointment should put that in an answer so he can get reputation for that. :-) )

An example of a problem case: "have finished the previous day's to-do list". That is, you want to arrive at each day having already completed the previous day's tasks. I'm not sure that translates to your target form at all, but the rules you have won't suffice. On the other hand, it's a little convoluted so maybe you don't care.


People doing and being things are the only categories that seem relevant to your needs. If someone does an action like eat, drink, or play, then 'do' would become 'did'. If someone is something like helpful, nice, or polite, then 'be' would become 'were'.

After doing some additional thinking:

  • 'do/did' occur when verbs are used
  • 'be/were' occur when adjectives are used

Question: Is he my classmate in the elementary?
Statement: He is my classmate in the elementary.

Question: Are we going to give that thing?
Statement: we are going to give that thing.

  • This barely qualifies as a tangential comment, let alone as a full-fledged answer to the question as stated. – RegDwigнt Feb 19 '13 at 13:24

protected by RegDwigнt Feb 19 '13 at 13:26

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.