def interactive_running(args):
    """
    This function provides an interactive environment for running the system.
    It receives text from the standard input, tokenizes it, and calls the function
    given as a parameter to produce an answer.
    
    :param task: 'pos', 'srl' or 'dependency'
    :param use_tokenizer: whether to use built-in tokenizer
    """
    use_tokenizer = not args.disable_tokenizer
    task_lower = args.task.lower()
    if task_lower == 'pos':
        tagger = nlpnet.taggers.POSTagger(language=args.lang)
    elif task_lower == 'srl':
        tagger = nlpnet.taggers.SRLTagger(language=args.lang)
    elif task_lower == 'dependency':
        tagger = nlpnet.taggers.DependencyParser(language=args.lang)
    else:
        raise ValueError('Unknown task: %s' % args.task)
    
    while True:
        try:
            text = raw_input()
        except KeyboardInterrupt:
            break
        except EOFError:
            break
        
        if type(text) is not unicode:
            text = unicode(text, 'utf-8')
        
        if use_tokenizer:
            result = tagger.tag(text)
        else:
            tokens = text.split()
            if task_lower != 'dependency':
                result = [tagger.tag_tokens(tokens, True)]
            else:
                result = [tagger.tag_tokens(tokens)]            
        
        _print_tagged(result, task_lower)
dataset/ETHPy150Open erickrf/nlpnet/bin/nlpnet-tag.py/interactive_running/original