Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'd like to insert grammatical mistakes (not typo) in a correct sentence, to make a small game. For instance:

My name is John
-> My name are John
He leaves the room
-> He leave the room

I only found some tools to detect languages but nothing about verb/noun/adjective detection/transformation. Is there a tool that could help me ?

share|improve this question
    
Not directly programming-related, but is there a name for deliberately inserting mistakes? "Anti-typo" is not quite correct. Also, what is the name for putting in the correct word, when you desire to put in a misspelling, grammatical error or poor usage? –  Bruce Ediger Dec 20 '11 at 18:18
    
@BruceEdiger: I don't know of this showing up in any dictionaries, but what about "discorrecting"? And for the second, how about just "correcting"? –  compman Dec 20 '11 at 22:06
    
@compman the second could be "mis-discorrecting" –  saus Dec 21 '11 at 1:01
    
@saus: Very nice; putting an error in the word itself. Kind of like "reduplication" in the design of the word. –  compman Dec 21 '11 at 2:17

3 Answers 3

up vote 1 down vote accepted

Looks like the Lancaster (Paice/Husk) stemming algorithm (or an alternative) might get you one method to insert random grammatical errors.

Wikipedia:

In linguistic morphology and information retrieval, stemming is the process for reducing inflected (or sometimes derived) words to their stem, base or root form—generally a written word form.

So, this algorithm will give you the ability to take words such as "taken" or "waiting" and derive their root forms ("take" and "wait"). I don't believe, however, that it produces the derived forms from roots.

share|improve this answer
    
I think it's a great idea to uses this kind of algorithms, as transforming a word to its root form will produce, almost for sure, a mistake in the sentence. And as an algorithm exists especially for French, your solution matches almost all my needs. Thank you ! –  ldiqual Dec 20 '11 at 19:39

I do not know of any tool, but on "Kevin's Word List Page" on SourceForge you will find some wordlists with part-of-speech (POS) information: http://wordlist.sourceforge.net/ (That's what you refer to as "verb/noun/adjective".) I hope it will be helpful to you.

share|improve this answer
    
Well, that's not a generic solution as it's meant to be applied on english words. Thanks anyway ;) –  ldiqual Dec 20 '11 at 19:43

In your example, those aren't spelling errors, those are grammatical errors. Creating random spelling errors is fairly straight forward, creating grammatical errors is quite a bit more challenging.

I'd recommend finding a word list with part of speech information, that includes all case-number-gender declensions (he, him, his, etc). Then, when you find a word that has multiple declensions, switch it with one of the others randomly.

If you want to be particular about swapping only verbs, or only nouns, you're pretty much not going to do it reliably, because writing a computer program to reliably tell when a word is being used as a verb, noun, or adjective is a significant challenge in and of itself.

share|improve this answer
    
You're right about "spelling", sorry. As the English language is not my native one, I just mistranslated what I meant to say. –  ldiqual Dec 20 '11 at 19:33
    
I am reminded of a bit of standup from comedian Bernie Mac, where he used the word "mtherfcker" as a verb, a noun, and an adjective to demonstrate its versatility. –  Graham Dec 20 '11 at 19:35
    
@Graham: en.wikipedia.org/wiki/… –  whatsisname Dec 20 '11 at 20:28
    
@whatsisname: nice one ! –  ldiqual Dec 20 '11 at 22:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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