예제 #1
0
    def semestergruppe(self, tup, buffer):
        """@result: 
        
        [
          (semestergruppe, gruppenKuerzel, fach, dozent, raum, jahr, woche, wochentag, anfang, ende, infoString),
          (eintrag-Tupel), ...
        ]
        """
        subTree = multiMap(tup[-1], buffer=buffer)

        infoString, jahr, semestergruppe = dispatchList(
            self, subTree['header'], buffer)[0]

        result = []
        if "sections" in subTree:
            eintraege = dispatchList(self, subTree['sections'], buffer)[0]

            if semestergruppe == None:
                semestergruppe = self._derive_gruppenkuerzel(eintraege)

            for e in eintraege:
                gruppenKuerzel, fach, dozent, raum, woche, wochentag, anfang, ende = e
                result.append(
                    (semestergruppe, gruppenKuerzel, fach, dozent, raum, jahr,
                     woche, wochentag, anfang, ende, infoString))

        return result
예제 #2
0
 def wochenRange(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     anfangsWoche = dispatchList(self, subTree['anfangsWoche'], buffer)[0]
     endWoche = dispatchList(self, subTree['endWoche'], buffer)[0]
     return map(lambda x: str(x), range(
         int(anfangsWoche),
         int(endWoche) + 1))
예제 #3
0
    def semestergruppe(self, tup, buffer):
        """@result: 
            
            [
              (semestergruppe, gruppenKuerzel, fach, dozent, raum, jahr, woche, wochentag, anfang, ende, infoString),
              (eintrag-Tupel), ...
            ]
            """
        subTree = multiMap(tup[-1], buffer=buffer)

        infoString, jahr, semestergruppe = dispatchList(self, subTree["header"], buffer)[0]

        result = []
        if "sections" in subTree:
            eintraege = dispatchList(self, subTree["sections"], buffer)[0]

            for e in eintraege:
                gruppenKuerzel, fach, dozent, raum, woche, wochentag, anfang, ende = e
                result.append(
                    (
                        semestergruppe,
                        gruppenKuerzel,
                        fach,
                        dozent,
                        raum,
                        jahr,
                        woche,
                        wochentag,
                        anfang,
                        ende,
                        infoString,
                    )
                )

        return result
예제 #4
0
 def eintrag(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     if 'sixtupel' in subTree:
         result = dispatchList(self, subTree['sixtupel'], buffer)[0]
     else:
         result = dispatchList(self, subTree['septupel'], buffer)[0]
     return result
예제 #5
0
 def eintrag(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     if 'sixtupel' in subTree:
         result = dispatchList(self, subTree['sixtupel'], buffer)[0]
     else:
         result = dispatchList(self, subTree['septupel'], buffer)[0]
     return result
예제 #6
0
    def wahlpflichtmodul(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)
        
        alphanumGruppe = dispatchList(self, subTree['alphanumGruppe'], buffer)[0]
        no = dispatchList(self, subTree['no'], buffer)[0]

        return wahlpflichtmodul2FullName(alphanumGruppe, no)
예제 #7
0
    def teamStudienEinstieg(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        gruppe = ""
        if "gruppe" in subTree:
            gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        return veranstaltung2FullName("TSE", gruppe=gruppe)
예제 #8
0
 def wpPraktikum(self, tup, buffer):
     subTree = multiMap(tup[-1],buffer=buffer)
     
     alphanumGruppe = dispatchList(self, subTree['alphanumGruppe'], buffer)[0]
     no = dispatchList(self, subTree['no'], buffer)[0]
     gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]
     
     return wpPraktikum2FullName(alphanumGruppe, no, gruppe)
예제 #9
0
 def wocheOrWochenRange(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     wochen = []
     if 'woche' in subTree:
         wochen = dispatchList(self, subTree['woche'], buffer)
     if 'wochenRange' in subTree:
         wochen = dispatchList(self, subTree['wochenRange'], buffer)[0]
     return wochen
예제 #10
0
 def wocheOrWochenRange(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     wochen = []
     if 'woche' in subTree:
         wochen = dispatchList(self, subTree['woche'], buffer)
     if 'wochenRange' in subTree:
         wochen = dispatchList(self, subTree['wochenRange'], buffer)[0]
     return wochen
예제 #11
0
 def header(self, tup, buffer):
     subTree = multiMap(tup[-1],buffer=buffer)
     infoString, jahr = dispatchList(self,subTree['ersteZeile'], buffer)[0]
     gruppenKuerzel = ''
     if 'zweiteZeile' in subTree:
         gruppenKuerzel = dispatchList(self,subTree['zweiteZeile'], buffer)[0]
     else:
         gruppenKuerzel = None
     return (infoString, jahr, gruppenKuerzel)
예제 #12
0
 def sixtupel(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     gruppenKuerzel, fach = dispatchList(self, subTree['fach'], buffer)[0]
     dozent = dispatchList(self, subTree['dozent'], buffer)[0]
     raum = dispatchList(self, subTree['raum'], buffer)[0]
     wochentag = dispatchList(self, subTree['wochentag'], buffer)[0]
     anfang = dispatchList(self, subTree['anfang'], buffer)[0]
     ende = dispatchList(self, subTree['ende'], buffer)[0]
     return (gruppenKuerzel, fach, dozent, raum, wochentag, anfang, ende)
예제 #13
0
 def sixtupel(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     gruppenKuerzel, fach = dispatchList(self, subTree['fach'], buffer)[0]
     dozent = dispatchList(self, subTree['dozent'], buffer)[0]
     raum = dispatchList(self, subTree['raum'], buffer)[0]
     wochentag = dispatchList(self, subTree['wochentag'], buffer)[0]
     anfang = dispatchList(self, subTree['anfang'], buffer)[0]
     ende = dispatchList(self, subTree['ende'], buffer)[0]
     return (gruppenKuerzel, fach, dozent, raum, wochentag, anfang, ende)
예제 #14
0
 def sixtupel(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     gruppenKuerzel, fach = dispatchList(self, subTree["fach"], buffer)[0]
     dozent = dispatchList(self, subTree["dozent"], buffer)[0]
     raum = dispatchList(self, subTree["raum"], buffer)[0]
     wochentag = dispatchList(self, subTree["wochentag"], buffer)[0]
     anfang = dispatchList(self, subTree["anfang"], buffer)[0]
     ende = dispatchList(self, subTree["ende"], buffer)[0]
     return (gruppenKuerzel, fach, dozent, raum, wochentag, anfang, ende)
예제 #15
0
 def header(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     infoString, jahr = dispatchList(self, subTree['ersteZeile'], buffer)[0]
     gruppenKuerzel = ''
     if 'zweiteZeile' in subTree:
         gruppenKuerzel = dispatchList(self, subTree['zweiteZeile'],
                                       buffer)[0]
     else:
         gruppenKuerzel = None
     return (infoString, jahr, gruppenKuerzel)
예제 #16
0
    def vorlUebung(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        fachKuerzel = dispatchList(self, subTree['fachKuerzel'], buffer)[0]

        nummer = ""
        if "nummer" in subTree:
            nummer = dispatchList(self, subTree['nummer'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Vorl./Übung", nummer)
예제 #17
0
 def section(self, tup, buffer):
     subTree = multiMap(tup[-1],buffer=buffer)
     wochen = dispatchList(self,subTree['wochen'], buffer)[0]
     eintraege = dispatchList(self,subTree['eintrag'], buffer)
     eintraegeMitWoche = []
     for woche in wochen:
         for e in eintraege:
             gruppenKuerzel, fach, dozent, raum, wochentag, anfang, ende = e
             eintraegeMitWoche.append((gruppenKuerzel, fach, dozent, raum, woche, wochentag, anfang, ende))
     return eintraegeMitWoche
예제 #18
0
    def tutorium(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        fachKuerzel = dispatchList(self, subTree['fachKuerzel'], buffer)[0]

        nummer = ""
        if "nummer" in subTree:
            nummer = dispatchList(self, subTree['nummer'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Tutorium", nummer=nummer)
예제 #19
0
    def awSeminar(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        fachKuerzel = "AW"

        nummer = ""
        if "nummer" in subTree:
            nummer = dispatchList(self, subTree['nummer'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Seminar", nummer)
예제 #20
0
 def section(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     wochen = dispatchList(self, subTree['wochen'], buffer)[0]
     eintraege = dispatchList(self, subTree['eintrag'], buffer)
     eintraegeMitWoche = []
     for woche in wochen:
         for e in eintraege:
             gruppenKuerzel, fach, dozent, raum, wochentag, anfang, ende = e
             eintraegeMitWoche.append((gruppenKuerzel, fach, dozent, raum,
                                       woche, wochentag, anfang, ende))
     return eintraegeMitWoche
예제 #21
0
    def uebung(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        fachKuerzel = dispatchList(self, subTree['fachKuerzel'], buffer)[0]

        nummer = ""
        if "no" in subTree:
            nummer = dispatchList(self, subTree['no'], buffer)[0]

        gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Übung", nummer, gruppe)
예제 #22
0
    def projekt(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        gruppe = ""
        if "gruppe" in subTree:
            gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        nummer = ""
        if "nummer" in subTree:
            nummer = dispatchList(self, subTree['nummer'], buffer)[0]

        return veranstaltung2FullName("PJ", nummer=nummer, gruppe=gruppe)
예제 #23
0
    def orientierungseinheit(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        roemNr = ""
        if "oe1" in subTree:
            roemNr = dispatchList(self, subTree["oe1"], buffer)[0]
        elif "oe2" in subTree:
            roemNr = dispatchList(self, subTree["oe2"], buffer)[0]
        else:
#            raise Exception("wrong control flow! Veranstaltungskuerzel = " + buffer)
            roemNr = "" #FIXME: just a workaround

        return orientierungseinheit2FullName(roemNr)
예제 #24
0
    def labor(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        labKuerzel = dispatchList(self, subTree['labKuerzel'], buffer)[0]
        #remove the trailing 'L'
        fachKuerzel = labKuerzel[0:len(labKuerzel)-1]

        nummer = ""
        if "no" in subTree:
            nummer = dispatchList(self, subTree['no'], buffer)[0]

        gruppe = ""
        if "gruppe" in subTree:
            gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Labor", nummer, gruppe)
예제 #25
0
    def praktikum(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        prakKuerzel = dispatchList(self, subTree['prakKuerzel'], buffer)[0]
        #remove the trailing 'P'
        fachKuerzel = prakKuerzel[0:len(prakKuerzel)-1]

        nummer = ""
        if "no" in subTree:
            nummer = dispatchList(self, subTree['no'], buffer)[0]

        gruppe = ""
        if "gruppe" in subTree:
            gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        return veranstaltung2FullName(fachKuerzel, "Praktikum", nummer, gruppe)
예제 #26
0
    def veranstaltung(self, tup, buffer):
        """@return: String - full event name
        """
        subTree = multiMap(tup[-1], buffer=buffer)

        def get(veranstaltung):
            return dispatchList(self, subTree[veranstaltung], buffer)[0]

        if "awSeminar" in subTree:
            result = get("awSeminar")
        elif "gwKurs" in subTree:
            result = get("gwKurs")
        elif "labor" in subTree:
            result = get("labor")
        elif "orientierungseinheit" in subTree:
            result = get("orientierungseinheit")
        elif "praktikum" in subTree:
            result = get("praktikum")
        elif "projekt" in subTree:
            result = get("projekt")
        elif "seminar" in subTree:
            result = get("seminar")
        elif "teamStudienEinstieg" in subTree:
            result = get("teamStudienEinstieg")
        elif "tutorium" in subTree:
            result = get("tutorium")
        elif "uebung" in subTree:
            result = get("uebung")
        elif "verbundprojekt" in subTree:
            result = get("verbundprojekt")
        elif "vorlesung" in subTree:
            result = get("vorlesung")
        elif "vorkurs" in subTree:
            result = get("vorkurs")
        elif "vorlUebung" in subTree:
            result = get("vorlUebung")
        elif "wahlpflichtmodul" in subTree:
            result = get("wahlpflichtmodul")
        elif "wpPraktikum" in subTree:
            result = get("wpPraktikum")
        elif "unknown" in subTree:
            logging.warning("veranstaltungenParser could not parse this: " + buffer)
            result = buffer # no mappings found
        else:
            raise Exception("wrong control flow! Veranstaltungskuerzel = " + buffer)

        return result
예제 #27
0
    def verbundprojekt(self, tup, buffer):
        subTree = multiMap(tup[-1],buffer=buffer)

        verbKuerzel = dispatchList(self, subTree['verbKuerzel'], buffer)[0]
        #remove the trailing 'J'
        fachKuerzel = verbKuerzel[0:len(verbKuerzel)-1]

        no = ""
        if "no" in subTree:
            no = dispatchList(self, subTree['no'], buffer)[0]

        gruppe = ""
        if "gruppe" in subTree:
            gruppe = dispatchList(self, subTree['gruppe'], buffer)[0]

        fullName = veranstaltung2FullName(fachKuerzel, "Verbundprojekt", no, gruppe)
        return fullName.replace("Verbundprojekt Verbundprojekt", "Verbundprojekt")
예제 #28
0
    def semestergruppe(self,tup,buffer):
        """@result: 
        
        [
          (semestergruppe, gruppenKuerzel, fach, dozent, raum, jahr, woche, wochentag, anfang, ende, infoString, version),
          (eintrag-Tupel), ...
        ]
        """
        subTree = multiMap(tup[-1],buffer=buffer)

        infoString, version, semester, jahr, semestergruppe = dispatchList(self,subTree['header'], buffer)[0]

        result = []
        if "sections" in subTree:
            eintraege = dispatchList(self,subTree['sections'], buffer)[0]

            if semestergruppe == None:
                semestergruppe = self._derive_gruppenkuerzel(eintraege)

            for e in eintraege:
                gruppenKuerzel, fach, dozent, raum, woche, wochentag, anfang, ende = e
                result.append((semestergruppe, gruppenKuerzel, fach, dozent, raum, jahr, woche, wochentag, anfang, ende, infoString, version, semester))

        return result
예제 #29
0
 def ersteZeile(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     infoString, jahr = dispatchList(self, subTree['infoString'], buffer)[0]
     return (infoString, jahr)
예제 #30
0
 def infoString(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     jahr = dispatchList(self, subTree['semester'], buffer)[0]
     infoString = str(getString(tup, buffer))
     return (infoString, jahr)
예제 #31
0
 def ende(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     h, m = dispatchList(self, subTree['uhrzeit'], buffer)[0]
     return (h, m)
예제 #32
0
 def uhrzeit(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     h = dispatchList(self, subTree['h'], buffer)[0]
     m = dispatchList(self, subTree['m'], buffer)[0]
     return (h, m)
예제 #33
0
 def sections(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     eintraegeList = dispatchList(self, subTree['section'], buffer)
     eintraege = reduce(lambda x, y: x + y, eintraegeList)
     return eintraege
예제 #34
0
 def endWoche(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     endWoche = dispatchList(self, subTree['woche'], buffer)[0]
     return endWoche
예제 #35
0
 def uhrzeit(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     h = dispatchList(self, subTree['h'], buffer)[0]
     m = dispatchList(self, subTree['m'], buffer)[0]
     return (h, m)
예제 #36
0
 def sections(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     eintraegeList = dispatchList(self, subTree['section'], buffer)
     eintraege = reduce(lambda x, y: x + y, eintraegeList)
     return eintraege
예제 #37
0
 def infoString(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     jahr = dispatchList(self, subTree['semester'], buffer)[0]
     infoString = str(getString(tup, buffer))
     return (infoString, jahr)
예제 #38
0
 def ersteZeile(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     infoString, jahr = dispatchList(self, subTree['infoString'], buffer)[0]
     return (infoString, jahr)
예제 #39
0
 def semester(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     jahr = dispatchList(self, subTree['jahr'], buffer)[0]
     return jahr
예제 #40
0
 def zweiteZeile(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     gruppenKuerzel = dispatchList(self, subTree['gruppenKuerzel'],
                                   buffer)[0]
     return gruppenKuerzel
예제 #41
0
 def gwKurs(self, tup, buffer):
     subTree = multiMap(tup[-1],buffer=buffer)
     gwKuerzel = dispatchList(self, subTree['gwKuerzel'], buffer)[0]
     return gwKurs2FullName(gwKuerzel)
예제 #42
0
 def semester(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     jahr = dispatchList(self, subTree['jahr'], buffer)[0]
     return jahr
예제 #43
0
 def ende(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     h, m = dispatchList(self, subTree['uhrzeit'], buffer)[0]
     return (h, m)
예제 #44
0
 def zweiteZeile(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     gruppenKuerzel = dispatchList(self, subTree['gruppenKuerzel'],
                                   buffer)[0]
     return gruppenKuerzel
예제 #45
0
 def fach(self, tup, buffer):
     subTree = multiMap(tup[-1], buffer=buffer)
     gruppenKuerzel = dispatchList(self, subTree['gruppe'], buffer)[0]
     fach = str(getString(tup, buffer))
     return gruppenKuerzel, fach
예제 #46
0
    def parameter_list(self, (tag, start, stop, subtags), buffer):
        """
        Process C{simple_content} production.
        """
        return dp.getString((tag, start, stop, subtags), buffer)

    def instance_list(self, (tag, start, stop, subtags), buffer):
        """
        Process C{complex_content} production.

        @return:  a 2-tuple of (keywords, parameter lists), where keywords is
            the list of KEYWORD occurrences and parameter lists is a list of
            strings (each of which is an unparsed parameter list).
        """
        inst = dp.multiMap((tag, start, stop, subtags), buffer)
        return inst.get("KEYWORD"), inst.get("parameter_list")

    def simple_instance(self, (tag, start, stop, subtags), buffer):
        """
        Process C{simple_instance} production.
        """
        inst = dp.singleMap(subtags, self, buffer)
        iname = int(inst.get("ENTITY_INSTANCE_NAME"))
        self.res["contents"][iname] = inst.get("parameter_list")
        self.res["insttype"][iname] = inst.get("KEYWORD")
        self.res["typeinst"][inst.get("KEYWORD")].append(iname)

    def complex_instance(self, (tag, start, stop, subtags), buffer):
        """
        Process C{complex_instance} production.
예제 #47
0
    def parameter_list(self, (tag, start, stop, subtags), buffer):
        """
        Process C{simple_content} production.
        """
        return dp.getString((tag, start, stop, subtags), buffer)

    def instance_list(self, (tag, start, stop, subtags), buffer):
        """
        Process C{complex_content} production.

        @return:  a 2-tuple of (keywords, parameter lists), where keywords is
            the list of KEYWORD occurrences and parameter lists is a list of
            strings (each of which is an unparsed parameter list).
        """
        inst = dp.multiMap((tag, start, stop, subtags), buffer)
        return inst.get('KEYWORD'), inst.get('parameter_list')

    def simple_instance(self, (tag, start, stop, subtags), buffer):
        """
        Process C{simple_instance} production.
        """
        inst = dp.singleMap(subtags, self, buffer)
        iname = int(inst.get('ENTITY_INSTANCE_NAME'))
        self.res['contents'][iname] = inst.get('parameter_list')
        self.res['insttype'][iname] = inst.get('KEYWORD')
        self.res['typeinst'][inst.get('KEYWORD')].append(iname)

    def complex_instance(self, (tag, start, stop, subtags), buffer):
        """
        Process C{complex_instance} production.