'Test for bug https://github.com/nltk/nltk/issues/1597
Ensures that curly bracket quantifiers can be used inside a chunk rule.
This type of quantifier has been used for the supplementary example
in http://www.nltk.org/book/ch07.html#exploring-text-corpora.'

def test_tag_pattern2re_pattern_quantifier(self):

    sent = [(u'The', u'AT'), (u'September-October', u'NP'), (u'term', u'NN'), (u'jury', u'NN'), (u'had', u'HVD'), (u'been', u'BEN'), (u'charged', u'VBN'), (u'by', u'IN'), (u'Fulton', u'NP-TL'), (u'Superior', u'JJ-TL'), (u'Court', u'NN-TL'), (u'Judge', u'NN-TL'), (u'Durwood', u'NP'), (u'Pye', u'NP'), (u'to', u'TO'), (u'investigate', u'VB'), (u'reports', u'NNS'), (u'of', u'IN'), (u'possible', u'JJ'), (u'``', u'``'), (u'irregularities', u'NNS'), (u"''", u"''"), (u'in', u'IN'), (u'the', u'AT'), (u'hard-fought', u'JJ'), (u'primary', u'NN'), (u'which', u'WDT'), (u'was', u'BEDZ'), (u'won', u'VBN'), (u'by', u'IN'), (u'Mayor-nominate', u'NN-TL'), (u'Ivan', u'NP'), (u'Allen', u'NP'), (u'Jr.', u'NP'), (u'.', u'.')]
    cp = RegexpParser(u'CHUNK:    {<N.*>{4,}}')
    tree = cp.parse(sent)
    assert (tree.pformat() == u"(S\n        The/AT\n        September-October/NP\n        term/NN\n        jury/NN\n        had/HVD\n        been/BEN\n        charged/VBN\n        by/IN\n        Fulton/NP-TL\n        Superior/JJ-TL\n        (CHUNK    Court/NN-TL    Judge/NN-TL    Durwood/NP    Pye/NP)\n        to/TO\n        investigate/VB\n        reports/NNS\n        of/IN\n        possible/JJ\n        ``/``\n        irregularities/NNS\n        ''/''\n        in/IN\n        the/AT\n        hard-fought/JJ\n        primary/NN\n        which/WDT\n        was/BEDZ\n        won/VBN\n        by/IN\n        (CHUNK    Mayor-nominate/NN-TL    Ivan/NP    Allen/NP    Jr./NP)\n        ./.)")
