def parse_frankenstein(self, line, scene): bad_string = "Free eBooks at Planet eBook.com " page_regex = '([0-9]{1,3}$)' chapter_regex = "(Chapter \d)" line = line.strip('\n') + ' ' if line != bad_string and not match(page_regex, line) and not match( chapter_regex, line) and line != "Frankenstein ": scene.concat_sentences(line)
def create_scenes(self): scene = MovieScene() for line in read_file(self.path): if match(self.regex, line): self.sc.add(scene) scene = MovieScene() scene.add_line(line) self.size += len(line)
def parse_wizard(self, line, scene): chapter_regex = "([0-9]*\. *)" line = line.strip('\n') + ' ' if not match(chapter_regex, line): scene.concat_sentences(line)
def parse_ripley(self, line, scene): chapter_regex = "(Chapter *)" line = line.strip() + ' ' if not match(chapter_regex, line): scene.concat_sentences(line)
def parse_shining(self, line, scene): chapter_regex = "(<< [0-9]* >>)" line = line.strip('\n') + ' ' if not match(chapter_regex, line) and not line.isupper(): scene.concat_sentences(line)
def parse_bourne(self, line, scene): chapter_regex = "(([0-9]|[0-9][0-9])$)" line = line.strip('\n') + ' ' if not match(chapter_regex, line) and line != '': scene.concat_sentences(line)
def parse_schindlers(self, line, scene): chapter_regex = "((PROLOGUE|CHAPTER|EPILOGUE).*)" line = line.strip('\n') + ' ' if not match(chapter_regex, line): scene.concat_sentences(line)