I said: Hello teacher, are you teaching music?
He said: Yes. The teaching of musical accomplishment
I said: Teacher, your music class is too boring, how not to appreciate the modern pop music, have to dull classical musical instruments?
He said, "You have to learn!"
==============================================================================================
She said: Courier number?
I said: xxxx
She said: No!
I said: "How can ah?" Clearly sent me a message.
She said: Clearly sent to you, you go to see clearly want, don't block, next! 5, dialogue with students
I said: Classmate, can I talk with you?
===============================================================================================
I said: "Why don't you eat?"
She said: Not hungry
I said: Oh
She said, "you go eat it."
I said: Oh
She said, "Go!
I said: Oh!
f = open (' d:\\ desktop \\record.txt ', encoding = ' utf-8 ')
me = []
he = []
she = []
Count = 1
For Each_line in F:
If each_line[:6]! = ' ====== ':
(role, Line_spoken) = Each_line.split (': ', 1)
if role = = ' I say ':
Me.append (Line_spoken)
if role = = ' he says ':
He.append (Line_spoken)
if role = = ' she says ':
She.append (Line_spoken)
Else
File_name_me = ' me_ ' + str (count) + '. txt '
file_name_he = ' he_ ' + str (count) + '. txt '
File_name_she = ' she_ ' + str (count) + '. txt '
Me_file = open (File_name_me, ' W ')
He_file = open (file_name_he, ' W ')
She_file = open (File_name_she, ' W ')
Me_file.writelines (Me)
He_file.writelines (He)
She_file.writelines (She)
Me_file.close ()
He_file.close ()
She_file.close ()
me = []
he = []
she = []
Count + = 1
File_name_me = ' me_ ' + str (count) + '. txt '
file_name_he = ' he_ ' + str (count) + '. txt '
File_name_she = ' she_ ' + str (count) + '. txt '
Me_file = open (File_name_me, ' W ')
He_file = open (file_name_he, ' W ')
She_file = open (File_name_she, ' W ')
Me_file.writelines (Me)
He_file.writelines (He)
She_file.writelines (She)
Me_file.close ()
He_file.close ()
She_file.close ()
F.close ()
Python File Data segmentation