def __init__(self, limit=10000, **options):
     Annotation.__init__(self, **options)
     self.limit = limit
    def __init__(self, description, attributes, inner_attributes=None,
            mode='split_workbooks', single_workbook_name=None,
            min_tokens=2, max_tokens=3000, **options):
        '''
        Classify sentences based on some of their attributes, and write
        them to XLS files. Lists of sentences will be taken from different
        users, distributed as evenly as possible (cf. MixUsers).

        sentences:
            list of sentences (same as Filter.sentences). [Inherited
            from Annotation base class]

        description:
            a textual description of the annotation. Will appear in a
            'meta' sheet of each workbook. Mandatory.

        attributes:
            a single attribute, or a tuple of attributes, by which
            the sentences will be classified into annotation files (the
            exact behavior depends on the mode)
            
        inner_attributes:
            only applicable for the split workbooks mode. Combinations of
            the inner attributes will form the names of sheets within
            each workbook

        mode:
            'single_workbook': one workbook with different sheet for each
                attribute combination
            'split_workbooks': separate workbook for each attribute combination
            'single_sheet': single workbook with a single sheet for all
                attribute combinations (but combination will appear in a
                dedicated spreadsheet column)

        single_workbook_name: 
            name of single workbook, if applicable

        min_tokens:
            if an attribute combination has less than this number of occurences
            discard this combination (do not write it to annotation files)

        max_tokens:
            stop writing sentences with any given attribute combination after
            this amount of tokens of this combination have been written

        Example:
        ByAttributeAnnotation("30 to 40 dative verbs, topicalized",
            sentences=sentences, attributes=['lemma', 'argument'])
        '''

        Annotation.__init__(self, description, **options)
        self.attributes = attributes

        if mode not in ('split_workbooks', 'single_workbook', 'single_sheet'):
            raise ValueError('unknown mode "%s"' % mode)

        if mode != 'split_workbooks' and inner_attributes:
            raise ValueError('inner_attributes can only be set when' \
                    'mode is "split_workbooks"')

        self.mode = mode
        self.inner_attributes = inner_attributes
        self.single_workbook_name = single_workbook_name
        self.min_tokens = min_tokens
        self.max_tokens = max_tokens
        self.workbooks = {}
 def __init__(self, description, subcat_filter, max_sentences=None):
     Annotation.__init__(self, description)
     self.subcat_filter = subcat_filter
     self.max_sentences = max_sentences