INNER CODE UNIT · Python

__init__

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

    def __init__(self, row):
        """        
        Where row is a list, it is processed directly.
        Where row is a string, it is parsed into a list using a csv.reader.
        The attribute names are given in the class variable Datum.header.
        """
        if row.__class__.__name__ in ('str', 'unicode'):
            row = list(csv.reader([row.strip()]))[0]        
        # Set the attributes.
        for i in range(len(row)):
            att_name = Datum.header[i]
            row_value = row[i]
            # Span lists.
            if re.search(r"SpanList", att_name):
                row_value = self.__process_span_list(row_value)
            # Gorn lists.
            elif re.search(r"GornList", att_name):
                row_value = self.__process_gorn_list(row_value)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…