'Construct a Feature which may apply at C{positions}.
#For instance, importing some concrete subclasses (Feature is abstract)
>>> from nltk.tag.brill import Word, Pos
#Feature Word, applying at one of [-2, -1]
>>> Word([-2,-1])
Word([-2, -1])
#Positions need not be contiguous
>>> Word([-2,-1, 1])
Word([-2, -1, 1])
#Contiguous ranges can alternatively be specified giving the
#two endpoints (inclusive)
>>> Pos(-3, -1)
Pos([-3, -2, -1])
#In two-arg form, start <= end is enforced
>>> Pos(2, 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "nltk/tbl/template.py", line 306, in __init__
raise TypeError
ValueError: illegal interval specification: (start=2, end=1)
:type positions: list of int
:param positions: the positions at which this features should apply
:raises ValueError: illegal position specifications
An alternative calling convention, for contiguous positions only,
is Feature(start, end):
:type start: int
:param start: start of range where this feature should apply
:type end: int
:param end: end of range (NOTE: inclusive!) where this feature should apply'

def __init__(self, positions, end=None):

    self.positions = None
    if (end is None):
        self.positions = tuple(sorted(set([int(i) for i in positions])))
    else:
        try:
            if (positions > end):
                raise TypeError
            self.positions = tuple(range(positions, (end + 1)))
        except TypeError:
            raise ValueError(u'illegal    interval    specification:    (start={0},    end={1})'.format(positions, end))
    self.PROPERTY_NAME = (self.__class__.PROPERTY_NAME or self.__class__.__name__)
