def rte_classifier(trainer, features=rte_features):
 train = ((pair, pair.value) for pair in nltk.corpus.rte.pairs(['rte1_dev.xml', 'rte2_dev.xml', 'rte3_dev.xml']))
 test = ((pair, pair.value) for pair in nltk.corpus.rte.pairs(['rte1_test.xml', 'rte2_test.xml', 'rte3_test.xml']))
 print('Training classifier...')
 classifier = trainer([(features(pair), label) for (pair, label) in train])
 print('Testing classifier...')
 acc = accuracy(classifier, [(features(pair), label) for (pair, label) in test])
 print(('Accuracy: %6.4f' % acc))
 return classifier

def rte_classifier ( trainer , features = rte_features ) : train = ( ( pair , pair . value ) for pair in nltk . corpus . rte . pairs ( [ 'rte1_dev.xml' , 'rte2_dev.xml' , 'rte3_dev.xml' ] ) ) test = ( ( pair , pair . value ) for pair in nltk . corpus . rte . pairs ( [ 'rte1_test.xml' , 'rte2_test.xml' , 'rte3_test.xml' ] ) ) print ( 'Training classifier...' ) classifier = trainer ( [ ( features ( pair ) , label ) for ( pair , label ) in train ] ) print ( 'Testing classifier...' ) acc = accuracy ( classifier , [ ( features ( pair ) , label ) for ( pair , label ) in test ] ) print ( ( 'Accuracy: %6.4f' % acc ) ) return classifier
classify rtepairs .