def evaluate_pos(gold_file=None, oov=None):
    """
    Tests the network for tagging a given sequence.
    
    :param gold_file: file with gold data to evaluate against
    :param oov: either None or a list of tokens, that should contain the oov words.
    """
    md = Metadata.load_from_file('pos')
    nn = taggers.load_network(md)
    pos_reader = taggers.create_reader(md, gold_file=gold_file)
    itd = pos_reader.get_inverse_tag_dictionary()
    
    logger = logging.getLogger("Logger")
    logger.debug('Loaded network')
    logger.debug(nn.description())
    logger.info('Starting test...')
    hits = 0
    total = 0
    
    for sent in pos_reader.sentences:
        
        tokens, tags = zip(*sent)
        sent_codified = pos_reader.codify_sentence(tokens)
        answer = nn.tag_sentence(sent_codified)
        if oov is not None:
            iter_sent = iter(tokens)
                
        for net_tag, gold_tag in zip(answer, tags):
            
            if oov in None:
                # only check oov words
                word = iter_sent.next()
                if word.lower() not in oov:
                    continue
            
            if itd[net_tag] == gold_tag:
                hits += 1
            
            total += 1
        
    print('%d hits out of %d' % (hits, total))
    accuracy = float(hits) / total
    print('Accuracy: %f%%' % (100 * accuracy))
dataset/ETHPy150Open erickrf/nlpnet/bin/nlpnet-test.py/evaluate_pos/operator `is not` -> `in`