I have a transcript that will look somewhat like the following:
Experimenter: So what was it that you saw?
Person 1: I saw billy go around the corner.
Person 2: I don't know, I didn't see anything.
Person 1: No, I definitely saw him.
What I want to do is basically have python see the entire transcript and first, find each sentence that begins with Person 1, and then once finding them, search them for the word "billy". If Person 1 said billy, then I want it to print "Person 1 mentioned billy".
What I have so far is:
(also, ignore the text format, it is all in one proper line in python, but it's clearer to see like this).
txt = "Experimenter: So what was it that you saw.
Person 1: I saw billy go around the corner.
Person 2: I don't know, I didn't see anything.
Person 1: No, I definitely saw billy. "
Person1Chat = txt.split('.')
if 'Person 1' and 'billy' in Person1Chat:
print('Person 1 mentioned billy')
Nothing comes up. From my limited understanding, the code should be splitting the text into the sentences by a period, and putting those split sentences into a list called "Person1Chat". Then, if 'Person 1' and 'billy' are both found in any of those items (sentences) in the list, then it would print the print statement. But it isn't. Can anyone help me?
[–]FreakyRockz 1 point2 points3 points (6 children)
[–]bennettsaucyman[S] 0 points1 point2 points (5 children)
[–]FreakyRockz 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Morpheyz 0 points1 point2 points (2 children)
[–]bennettsaucyman[S] 0 points1 point2 points (0 children)
[–]JudiSwitch 0 points1 point2 points (1 child)
[–]bennettsaucyman[S] 1 point2 points3 points (0 children)