def next_sub_section(self): """ next section and skip this section treating both these operations as same """ """ As of now we have only one lesson """ read_out = ReadOut() segment = "lessons" lesson = "What's the Weather Like" sub_section = self.context["parameters"]["lesson_sub_section"] try: section = self.context["parameters"]["lesson_section"] except: section = fetch_section_with_sub_section_name(sub_section) """ TO-DO :: get section name by getting sub_section """ NextSubSection, PreviousSubSection = self.get_sub_section( section, sub_section) if not NextSubSection: raise ( OperationsException("There are no sub-sections after this.")) self.params["lesson_sub_section"] = NextSubSection response = "The next sub-section is " + "<break time='0.5s' />" response += read_out.read_sub_section(lesson, section, NextSubSection) return response
def previous_sub_section(self): read_out = ReadOut() segment = "lessons" lesson = "What's the Weather Like" sub_section = self.context["parameters"]["lesson_sub_section"] try: section = self.context["parameters"]["lesson_section"] except: section = fetch_section_with_sub_section_name(sub_section) """ TO-DO :: get section name by getting sub_section """ NextSubSection, PreviousSubSection = self.get_sub_section( section, sub_section) if not PreviousSubSection: raise ( OperationsException("There are no sub-sections before this.")) self.params["lesson_sub_section"] = PreviousSubSection response = "The previous sub-section is " + "<break time='0.5s' />" response += read_out.read_sub_section(lesson, section, PreviousSubSection) return response
def read_lesson(self): read_out = ReadOut() """ As of now we are dealing with only one lesson "What's weather like" """ # lesson = "What's the Weather Like?" lesson = self.params["lesson_name"] response = read_out.read_lesson(lesson) self.context = self.context_manager.set_context_for_read_out( self.params, response) return response, self.context
def read_segment(self): read_out = ReadOut() """ As of now dealing with only introduction segment """ segment = self.params["segment"].lower() # self.params["segment"] = segment response = read_out.read_segment( segment) # self.params #Parameters(**self.params) self.context = self.context_manager.set_context_for_read_out( self.params, response) return response, self.context
def previous_introductory_section(self): read_out = ReadOut() segment = "introduction" attr = "sections" NextSection, PreviousSection = self.get_introductory_section() self.params["introductorySection"] = PreviousSection if not PreviousSection: raise (OperationsException("There are no sections before this.")) response = "The previous section is " + "<break time='0.5s' />" response += read_out.read_section(segment, "", attr, PreviousSection) return response
def next_introductory_section(self): read_out = ReadOut() segment = "introduction" NextSection, PreviousSection = self.get_introductory_section() attr = "sections" if not NextSection: raise (OperationsException("There are no sections after this.")) self.params["introductorySection"] = NextSection response = "The next section is " + "<break time='0.5s' />" response += read_out.read_section(segment, "", attr, NextSection) return response
def previous_segment(self): read_out = ReadOut() """ As of now dealing with only introduction segment """ NextSegment, PreviousSegment = self.get_segment() if not PreviousSegment: raise (OperationsException("There are no segment before this")) response = "The previous segment is " + "<break time='0.5s' />" response += read_out.read_segment( PreviousSegment) # self.params #Parameters(**self.params) return response
def next_segment(self): """ next section and skip this section treating both these operations as same As of now dealing with only introduction segment """ read_out = ReadOut() NextSegment, PreviousSegment = self.get_segment() if not NextSegment: raise (OperationsException("There is no segment after this.")) response = "The next segment is " + "<break time='0.5s' />" response += read_out.read_segment(NextSegment) return response # self.params #Parameters(**self.params)
def previous_lesson_section(self): read_out = ReadOut() segment = "lessons" lesson = "What's the weather like" NextSection, PreviousSection = self.get_lesson_section() if not PreviousSection: raise (OperationsException("There are no sections before this.")) self.params["lesson_section"] = PreviousSection attr = "sections" response = "The previous section is " + "<break time='0.5s' />" response += read_out.read_section(segment, lesson, attr, PreviousSection) return response
def read_lesson_additional_section(self): read_out = ReadOut() """ As of now we have only one lesson """ segment = "lessons" lesson = "What's the Weather Like" attr = "additional_sections" section = self.params["lesson_additional_section"] # response = fetch_ordinal_of_section( "lessons",section, "additional_sections") response = read_out.read_section(segment, lesson, attr, section, self.params["query"]) self.context = self.context_manager.set_context_for_read_out( self.params, response) return response, self.context
def next_lesson_additional_section(self): """ As of now we have only one lesson """ read_out = ReadOut() segment = "lessons" lesson = "What's the weather like" attr = "additional_sections" NextSection, PreviousSection = self.get_lesson_additional_section() if not NextSection: raise (OperationsException("There are no sections after this.")) self.params["lesson_additional_section"] = NextSection response = "The next section is " + "<break time='0.5s' />" response += read_out.read_section(segment, lesson, attr, NextSection) return response
def read_lesson_sub_section(self): read_out = ReadOut() context_manager = ContextManager(self.context) """ As of now we have only one lesson """ segment = "lessons" lesson = "What's the Weather Like" sub_section = self.params["lesson_sub_section"] #try : # section = context_manager.fetch_data_from_context("lesson_section") #except: section = fetch_section_with_sub_section_name(sub_section) # response = fetch_ordinal_of_section("lessons",sub_section, "sub_sections") response = read_out.read_sub_section(lesson, section, sub_section, self.params["query"]) self.context = self.context_manager.set_context_for_read_out( self.params, response) return response, self.context
def read_segment_section(self): read_out = ReadOut() """ As of now dealing with only introduction segment, TO-DO need to get segment name for a given section name if other segments also implemented """ segment = "introduction" # self.params["segment"].lower() section = self.params["introductorySection"] """ attr :: lesson segment have sections & additional sections attibute other segments only have sections attribute """ attr = "sections" # self.params["segment"] = segment # response = fetch_ordinal_of_section("introduction",section, "sections") response = read_out.read_section( segment, "", attr, section, self.params["query"]) # self.params #Parameters(**self.params) self.context = self.context_manager.set_context_for_read_out( self.params, response) return response, self.context