INNER CODE UNIT · Python

sup_pos

ElizaLo/NLP-Natural-Language-Processing · Shallow Discourse Parsing/PDTB_exploration/pdtb.py:305

    def sup_pos(self, index, wn_format=False, lemmatize=False):
        """
        Returns the list of (word, pos) pairs (if any) associated with
        SupN where N = index (1 or 2). lemmatize=True uses
        nltk.stem.WordNetStemmer() on the list. wn_format=True merely
        converts to WordNet tags where possibl, without stemming.
        """
        return self.__pos("Sup%s" % index, wn_format=wn_format, lemmatize=lemmatize)

    def __pos(self, typ, wn_format=False, lemmatize=False):
        """
        Internal method used to get the POS version, potentially lemmatized, associated with
        typ strings (Arg1, Sup2, etc.)
        """
        results = []
        trees = eval("self.%s_Trees" % typ)
        for tree in trees:
            results += tree.pos()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…