Module Expr Str Import alias ImportFrom alias ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad Str attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults Call NameLoad NameLoad Str body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad AttributeLoad NameLoad attr body Assign NameStore ListLoad NameLoad Return Call NameLoad ListComp Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr keyword NameLoad comprehension TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call NameLoad ListComp Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr keyword NameLoad comprehension TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore Call NameLoad ListComp Call AttributeLoad NameLoad attr comprehension NameStore NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str attr For NameStore Call AttributeLoad NameLoad attr Str body If BoolOpOr UnaryOpNot NameLoad Call AttributeLoad NameLoad attr Str body Continue Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body Assign NameStore ListLoad NameLoad Return Call NameLoad ListComp Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr comprehension NameStore NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad Call AttributeLoad NameLoad attr Str attr decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Return Call NameLoad ListComp Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr keyword NameLoad comprehension TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Return Call NameLoad ListComp Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr keyword NameLoad comprehension TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Return ListLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr attr If AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr Assign NameStore ListLoad If NameLoad body For NameStore NameLoad body Assign NameStore Call NameLoad Call AttributeLoad Call AttributeLoad NameLoad attr Str NameLoad attr Num Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad If NameLoad body For TupleStore NameStore NameStore NameLoad body If CompareEq NameLoad Str body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr orelse If CompareEq NameLoad Str body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr orelse If CompareEq NameLoad Str body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad If NameLoad body Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Num Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body For NameStore NameLoad body Assign NameStore Call NameLoad Call AttributeLoad Call AttributeLoad NameLoad attr Str NameLoad attr Num Assign NameStore Call NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If Call AttributeLoad NameLoad attr NameLoad NameLoad body While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If Call AttributeLoad NameLoad attr NameLoad NameLoad body Break Continue If BoolOpAnd UnaryOpNot Call AttributeLoad NameLoad attr NameLoad NameLoad UnaryOpNot Call AttributeLoad NameLoad attr NameLoad UnaryOpNot Call AttributeLoad NameLoad attr NameLoad NameLoad body If AttributeLoad NameLoad attr body Return ListComp Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad comprehension NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse Return ListLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list decorator_list
N/A N/A 
CorpusReader for the Comparative Sentence Dataset.

- Comparative Sentence Dataset information -

Annotated by: Nitin Jindal and Bing Liu, 2006.
              Department of Computer Sicence
              University of Illinois at Chicago

Contact: Nitin Jindal, njindal@cs.uic.edu
         Bing Liu, liub@cs.uic.edu (http://www.cs.uic.edu/~liub)

Distributed with permission.

Related papers:

- Nitin Jindal and Bing Liu. "Identifying Comparative Sentences in Text Documents".
   Proceedings of the ACM SIGIR International Conference on Information Retrieval
   (SIGIR-06), 2006.

- Nitin Jindal and Bing Liu. "Mining Comprative Sentences and Relations".
   Proceedings of Twenty First National Conference on Artificial Intelligence
   (AAAI-2006), 2006.

- Murthy Ganapathibhotla and Bing Liu. "Mining Opinions in Comparative Sentences".
    Proceedings of the 22nd International Conference on Computational Linguistics
    (Coling-2008), Manchester, 18-22 August, 2008.
 N/A re nltk.corpus.reader.api * nltk.tokenize * N/A STARS N/A N/A re compile ^\*+$ N/A COMPARISON N/A N/A re compile <cs-[1234]> N/A CLOSE_COMPARISON N/A N/A re compile </cs-[1234]> N/A GRAD_COMPARISON N/A N/A re compile <cs-[123]> N/A NON_GRAD_COMPARISON N/A N/A re compile <cs-4> N/A ENTITIES_FEATS N/A N/A re compile (\d)_((?:[\.\w\s/-](?!\d_))+) N/A KEYWORD N/A N/A re compile \((?!.*\()(.*)\)$ Comparison N/A object N/A N/A 
    A Comparison represents a comparative sentence and its constituents.
     __init__ N/A N/A self text comp_type entity_1 entity_2 feature keyword N/A None None None None None None N/A N/A 
        :param text: a string (optionally tokenized) containing a comparation.
        :param comp_type: an integer defining the type of comparison expressed.
            Values can be: 1 (Non-equal gradable), 2 (Equative), 3 (Superlative),
            4 (Non-gradable).
        :param entity_1: the first entity considered in the comparison relation.
        :param entity_2: the second entity considered in the comparison relation.
        :param feature: the feature considered in the comparison relation.
        :param keyword: the word or phrase which is used for that comparative relation.
         N/A N/A self text text N/A N/A self comp_type comp_type N/A N/A self entity_1 entity_1 N/A N/A self entity_2 entity_2 N/A N/A self feature feature N/A N/A self keyword keyword N/A __repr__ N/A N/A self N/A N/A N/A N/A N/A Comparison(text="{}", comp_type={}, entity_1="{}", entity_2="{}", feature="{}", keyword="{}") format N/A self text N/A self comp_type N/A self entity_1 N/A self entity_2 N/A self feature N/A self keyword N/A N/A ComparativeSentencesCorpusReader N/A CorpusReader N/A N/A 
    Reader for the Comparative Sentence Dataset by Jindal and Liu (2006).

        >>> from nltk.corpus import comparative_sentences
        >>> comparison = comparative_sentences.comparisons()[0]
        >>> comparison.text
        ['its', 'fast-forward', 'and', 'rewind', 'work', 'much', 'more', 'smoothly',
        'and', 'consistently', 'than', 'those', 'of', 'other', 'models', 'i', "'ve",
        'had', '.']
        >>> comparison.entity_2
        'models'
        >>> (comparison.feature, comparison.keyword)
        ('rewind', 'more')
        >>> len(comparative_sentences.comparisons())
        853
     N/A CorpusView StreamBackedCorpusView __init__ N/A N/A self root fileids word_tokenizer sent_tokenizer encoding N/A N/A WhitespaceTokenizer None utf8 N/A N/A 
        :param root: The root directory for this corpus.
        :param fileids: a list or regexp specifying the fileids in this corpus.
        :param word_tokenizer: tokenizer for breaking sentences or paragraphs
            into words. Default: `WhitespaceTokenizer`
        :param sent_tokenizer: tokenizer for breaking paragraphs into sentences.
        :param encoding: the encoding that should be used to read the corpus.
         N/A N/A N/A CorpusReader __init__ self root fileids encoding N/A N/A self _word_tokenizer word_tokenizer N/A N/A self _sent_tokenizer sent_tokenizer N/A comparisons N/A N/A self fileids N/A None N/A N/A 
        Return all comparisons in the corpus.

        :param fileids: a list or regexp specifying the ids of the files whose
            comparisons have to be returned.
        :return: the given file(s) as a list of Comparison objects.
        :rtype: list(Comparison)
         N/A N/A fileids None N/A N/A fileids N/A self _fileids N/A N/A N/A isinstance fileids N/A compat string_types N/A N/A fileids N/A fileids N/A N/A concat N/A N/A N/A self CorpusView path N/A self _read_comparison_block encoding enc N/A N/A path enc fileid N/A N/A self abspaths fileids True True N/A keywords N/A N/A self fileids N/A None N/A N/A 
        Return a set of all keywords used in the corpus.

        :param fileids: a list or regexp specifying the ids of the files whose
            keywords have to be returned.
        :return: the set of keywords and comparative phrases used in the corpus.
        :rtype: set(str)
         N/A all_keywords N/A concat N/A N/A N/A self CorpusView path N/A self _read_keyword_block encoding enc N/A N/A path enc fileid N/A N/A self abspaths fileids True True N/A keywords_set N/A set N/A N/A N/A keyword lower N/A keyword all_keywords keyword N/A keywords_set N/A keywords_readme N/A N/A self N/A N/A N/A 
        Return the list of words and constituents considered as clues of a
        comparison (from listOfkeywords.txt).
         N/A keywords N/A N/A raw_text N/A N/A N/A N/A self open listOfkeywords.txt read N/A line N/A N/A raw_text split N/A N/A N/A N/A line N/A N/A line startswith // N/A N/A N/A N/A N/A keywords append N/A N/A line strip N/A keywords N/A raw N/A N/A self fileids N/A None N/A N/A 
        :param fileids: a list or regexp specifying the fileids that have to be
            returned as a raw string.
        :return: the given file(s) as a single string.
        :rtype: str
         N/A N/A fileids None N/A N/A fileids N/A self _fileids N/A N/A N/A isinstance fileids string_types N/A N/A fileids N/A fileids N/A N/A concat N/A N/A N/A N/A N/A self open f read N/A f fileids N/A readme N/A N/A self N/A N/A N/A 
        Return the contents of the corpus readme file.
         N/A N/A N/A N/A N/A self open README.txt read N/A sents N/A N/A self fileids N/A None N/A N/A 
        Return all sentences in the corpus.

        :param fileids: a list or regexp specifying the ids of the files whose
            sentences have to be returned.
        :return: all sentences of the corpus as lists of tokens (or as plain
            strings, if no word tokenizer is specified).
        :rtype: list(list(str)) or list(str)
         N/A N/A concat N/A N/A N/A self CorpusView path N/A self _read_sent_block encoding enc N/A N/A path enc fileid N/A N/A self abspaths fileids True True N/A words N/A N/A self fileids N/A None N/A N/A 
        Return all words and punctuation symbols in the corpus.

        :param fileids: a list or regexp specifying the ids of the files whose
            words have to be returned.
        :return: the given file(s) as a list of words and punctuation symbols.
        :rtype: list(str)
         N/A N/A concat N/A N/A N/A self CorpusView path N/A self _read_word_block encoding enc N/A N/A path enc fileid N/A N/A self abspaths fileids True True N/A _read_comparison_block N/A N/A self stream N/A N/A N/A True N/A N/A line N/A N/A stream readline N/A N/A line N/A N/A N/A N/A comparison_tags N/A N/A re findall COMPARISON line N/A comparison_tags N/A N/A grad_comparisons N/A N/A re findall GRAD_COMPARISON line N/A non_grad_comparisons N/A N/A re findall NON_GRAD_COMPARISON line N/A comparison_text N/A N/A N/A N/A stream readline strip N/A N/A self _word_tokenizer N/A N/A comparison_text N/A N/A N/A self _word_tokenizer tokenize comparison_text N/A N/A N/A stream readline N/A comparison_bundle N/A N/A grad_comparisons N/A N/A comp grad_comparisons N/A N/A comp_type N/A int N/A N/A N/A N/A re match <cs-(\d)> comp group 1 N/A comparison N/A Comparison text comparison_text comp_type comp_type N/A line N/A N/A stream readline N/A entities_feats N/A N/A ENTITIES_FEATS findall line N/A entities_feats N/A N/A N/A code entity_feat entities_feats N/A N/A N/A code 1 N/A N/A N/A comparison entity_1 N/A N/A entity_feat strip N/A N/A N/A code 2 N/A N/A N/A comparison entity_2 N/A N/A entity_feat strip N/A N/A N/A code 3 N/A N/A N/A comparison feature N/A N/A entity_feat strip N/A keyword N/A N/A KEYWORD findall line N/A keyword N/A N/A N/A comparison keyword N/A keyword N/A 0 N/A N/A N/A comparison_bundle append comparison N/A non_grad_comparisons N/A N/A comp non_grad_comparisons N/A N/A comp_type N/A int N/A N/A N/A N/A re match <cs-(\d)> comp group 1 N/A comparison N/A Comparison text comparison_text comp_type comp_type N/A N/A N/A comparison_bundle append comparison N/A comparison_bundle N/A _read_keyword_block N/A N/A self stream N/A N/A N/A keywords N/A N/A comparison N/A N/A self _read_comparison_block stream N/A N/A N/A N/A keywords append N/A comparison keyword N/A keywords N/A _read_sent_block N/A N/A self stream N/A N/A N/A True N/A N/A line N/A N/A stream readline N/A N/A N/A re match STARS line N/A N/A True N/A N/A line N/A N/A stream readline N/A N/A N/A re match STARS line N/A N/A N/A N/A N/A N/A N/A N/A re findall COMPARISON line N/A N/A N/A ENTITIES_FEATS findall line N/A N/A N/A re findall CLOSE_COMPARISON line N/A N/A N/A self _sent_tokenizer N/A N/A N/A N/A N/A N/A self _word_tokenizer tokenize sent N/A sent N/A N/A N/A self _sent_tokenizer tokenize line N/A N/A N/A N/A N/A N/A self _word_tokenizer tokenize line N/A _read_word_block N/A N/A self stream N/A N/A N/A words N/A N/A sent N/A N/A self _read_sent_block stream N/A N/A N/A N/A words extend sent N/A words N/A N/A