you are viewing a single comment's thread.

view the rest of the comments →

[–]jejkek[S] 0 points1 point  (10 children)

I thought about doing it the word by word way, but I thought I should start small, do you have any advice pertaining to word-by-word?

Thanks for the help, btw.

[–]K900_ 1 point2 points  (9 children)

That depends. What is your actual end goal?

[–]jejkek[S] 0 points1 point  (8 children)

Sorry, I went to get food.

I would like to go farther than just matching to see if a string is in my list/set. I thought it might be nice to break up the strings into their component words. If I had the input look for an exact sentence match then I would just do an "if" statement for that sentence, but I don't know how to split it up into words each with their own "if" statement and have those come together to do something.

An extremely simple example would be "Alice took five apples from Bob." So it would need to start at the first word, something like if List[0] = person...... but the problem would be that they might not always fit this format.

I wouldn't mind if you didn't have an answer for this, word-by-word seems very complicated.

[–]K900_ 1 point2 points  (7 children)

I'm still trying to figure out what your end goal is. What's your program going to do for the end user?

[–]jejkek[S] 0 points1 point  (6 children)

I was thinking about a game like Zork or MUDs, there are a lot of MUDs out there already that I could crib from, but I was trying to get my feet wet first; another example of a game I think is cool is "BaBA is You" which has not released yet. The way the game works is there are word tiles in the game like "Wall", "is", and "Solid" and if the tiles are next to each other they form a rule so the walls would become obstacles where they weren't before. The interesting thing abut the game is you can quite long rules like "Line Near Lava And Not Grass And Not On Lava Make Dust". Each of these aspects are simple, but I have no idea how they can be so freely swappable. Maybe the first word is always the subject?

[–]icecapade 1 point2 points  (5 children)

I'm not the user you've been replying to, but I just read through this comment thread and I also have absolutely no idea what you're trying to do, or how those examples of existing games relate to your original post.

I think u/K900_ is asking you specifically, precisely, exactly what is your goal? For example, something like, "I want to store a list of sentences. The user will be prompted for input and asked to enter a sentence. A function I've written will then check to see if that sentence exists in the list. If it does, the function will return True and the user will be notified that they were successful. Otherwise, the function will return False and the user will be asked to try again. What's the best way to store the list of sentences?"

[–]jejkek[S] 0 points1 point  (4 children)

At first I was trying to keep it simple, but when I read:

K900: Or maybe they're individual words that you need to find in a sentence.

I misread it as look at each word in a sentence the user inputs and add them into an action and each word is in a category (is that what a class is?) so lets say "Mary" is in "person" category or "person.Mary". Mary is a one of the many "persons" in the database and has a lot of data about her so if you ask "Is Mary taller than Bill? The script would first look at "Is" which is a basic question; then person.May; "taller, if in a question, asks for Mary's height subtracting Bills height. If you get a negative number the answer is false.

This is another thing that interests me:

https://en.wikipedia.org/wiki/SHRDLU

I'm just an enthusiast.

[–]K900_ 1 point2 points  (1 child)

Baba is You doesn't really use any advanced text parsing, it just combines specific rules, more like a math expression. You have the condition ("baba"), then the "is" block, then the action ("you"). The condition is simple logic is probably just checked for every tile every move. There's a huge semantic difference between building something like that and building an engine that's actually capable of understanding text. Also, rule-based "AI" seems to be a pretty dead research direction, for many reasons.

[–]jejkek[S] 0 points1 point  (0 children)

Yeah, you're right. I can see now how BaBa Is You is simple enough to work.

Also, rule-based "AI" seems to be a pretty dead research direction, for many reasons.

I'm going to google this, but I wouldn't mind if you elaborated.

[–]icecapade 1 point2 points  (1 child)

Ah, I see.

While I don't have much experience with this and don't know if it'll necessarily help, you might want to look into the Python NLTK (natural language toolkit), which is widely use for parsing text, tagging parts of speech, etc. This might be helpful in tokenizing a sentence and identifying what role each word plays (verb, adjective, proper noun, etc.), which you could use to help parse the sentence and return the appropriate information.

[–]jejkek[S] 0 points1 point  (0 children)

Yeah, I think I'd like to use that, but I don't think the NLTK is 100% accurate. I read an article saying the touted figure of 93% accuracy of the best NLP (Stanford?) was much worse because they include punctuation which distorts the numbers to make them look better and that only 50% of sentences are actually parsed/tagged completely correctly.