示例#1
0
    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
示例#2
0
    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
示例#3
0
 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
示例#4
0
 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
示例#5
0
    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
示例#6
0
    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
示例#7
0
    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
示例#8
0
    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)
示例#9
0
    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
示例#10
0
 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
示例#11
0
    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
示例#12
0
    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
示例#13
0
 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