Ask coding questions

← Back to all posts
C++ Does anyone know how to sort words into groups. i.e. Verb, noun.
Icodedtheweb (2)

I'm trying to create a program that can understand basic English.

Answered by KENNETHTRIPP (50) [earned 5 cycles]
View Answer

Try using a regex with things like "ing", "ed", etc. I don't actually know C++ so I don't know if it has regexes, but you can just look it up. Hopefully this helps.
Edit: Or you can upload an API with every word in the English language sorted into catergories, but that would take up a lot of space.

Baconman321 (1056)

Ooooh boy. Here we go with the machine learning again...

So basically English and most other human languages are too complex for a computer to understand. Our minds are different from a computer in that we can infer things. Human languages build off of that and allow us to simply understand sentences and almost instantly recognize the context.

People have tried making programs that understand English and other human languages (to some success, too!), but right now it's quite complicated.

The basic idea you would follow is that you have a computer look over thousands of verbs and other adjectives (when the computer knows what it is looking over I believe it is called a "supervised" model/algorithm). Then, the computer can determine whether or not it is a verb or another type of word. This is sometimes inefficient (not everything that is "similar" falls under a group. Take humans for instance: just because a lot of people like ice cream doesn't mean a person who doesn't isn't a human), but oftentimes it has worked. If you really are trying to get this to work - regardless of how hard the project may be, then I recommend learning more about machine learning (after all, a popular machine learning algorithm called a "neural network" is meant to simulate how the human brain learns).

It's actually quite fun and the first time I ever programmed we tried to classify articles of clothing based off of how they looked (I didn't understand much of it, and the computer was 99.9% sure a shoe was a handbag... or vice versa). Best of luck on your cool assignment, if this works you deserve to be in MIT.

If you think it's too hard though, you can use your knowledge of what classifies as a verb/noun based off of how the letters are formed and use regex like @KENNETHTRIPP mentioned. Machine learning does take up a lot of computing power (hey, our brain alone uses 20 Watts, and our body uses about 100 Watts).

Anyways, just trying to help here, hope it does help!

Icodedtheweb (2)

@Baconman321 Yeah, I don't know if the way I'm going at it has been tried, but, I'm letting the program choose (technically choosing at random) the response, then the program tells itself the correct answer to a question I ask it, all the while learning vocabulary from the questions we ask and the answers we actually program into the code. Its probaly not even going to work as I taught myself how to program with limited resources. I will also look into "neural network", it really sounds interesting.

Baconman321 (1056)

@Icodedtheweb Also, is xxpertHacker helping you?

I noticed the ++i and the only person I know who would practice that here is xxpertHacker.

Icodedtheweb (2)

@Baconman321 No, I don't even know who xxpertHacker is. The only person helping me is my friend.

Icodedtheweb (2)

@Baconman321 His username is NoahPatton

Icodedtheweb (2)

Thank you, I'll make sure to try that.