hello everyone,
im having a little bit of trouble with my python and i was wondering if someone could please give me a hand with it :)
basically, what i am trying to achieve is exactly what is going on in this thread http://ubuntuforums.org/archive/index.php/t-803060.html except in my example, the dict words have multiple words inside them, so parsing through a split string 1 word at a time is not possible. i know it will have something to do with checking the dictionary first, comparing it to the string then replacing it... but im just having a bit of trouble putting that into code form :icon_razz:
this is my reflections array:
reflections = \
[
["yourself", "myself"],
["your", "my"],
["Your", "my"],
["myself", "yourself"],
["my", "your"],
["My", "your"],
["you and I", "we"], # In some contexts "we" should be "us"
["You and I are", "We are"],
["You and I", "we"],
["you and me", "us"],
["You and me", "we"], # Incorrect, but colloquially common, grammar
["me and you", "us"],
["Me and you", "we"],
# Grammar: The first person singular pronoun is "I" when it's a
# subject and "me" when it's an object.
#
["to you", "to me"], # Some person as object cases
["for you", "for me"],
["with you", "with me"],
["at you", "at me"],
["see you", "see me"],
["keep you", "keep me"],
["stop you", "stop me"],
["love you", "love me"],
["like you", "like me"],
["hit you", "hit me"],
["loves you", "loves me"],
["likes you", "likes me"],
["thank you", "thank me"],
["thanks you", "thanks me"],
["hate you", "hate me"],
["hates you", "hates me"],
["about you", "about me"],
["you", "I"], # Otherwise assume person is subject
["You", "I"],
["I", "you"],
["I'm", "you are"],
["I've", "you have"],
["me", "you"],
# Grammar: "Are" (and its derivatives "am", "is", "were", "was",
# etc) is an irregular verb with an exceptionally complicated set
# of conjugation rules. The "reflections" appearing below are
# totally inadequate to account for its full complexity!
#
["am", "are"],
["Am", "are"],
["you are", "I am"],
["you're", "I am"],
["You are", "I am"],
["You're", "I am"],
["we are", "we are"], # These are here to prevent changes to "are"!
["We are", "we are"],
["they are", "they are"],
["They are", "they are"],
["Are they", "are they"],
["Are we", "are we"],
["are", "am"], # In plural contexts "are" should be left unchanged
["Are", "am"],
["he was", "he was"], # Some singular cases
["she was", "she was"],
["He was", "he was"],
["She was", "she was"],
["was", "were"],
["were", "was"],
["Was", "were"],
["Were", "was"],
["yours", "mine"],
["mine", "yours"]
]
thanks in advance! im just feeling pretty lost at where to begin with it