#!/usr/bin/python
# -*- coding: utf-8 -*-

from nlp_service import Service, create_service_option_parser
from iobber.chunker import Chunker


class IobberService(Service):
	def __init__(self, *args, **kwargs):
		super(IobberService, self).__init__(*args, **kwargs)
		self.chunker = Chunker(
                                self.config['iobber-config'],
                                self.config['model-dir'],
                                verbose = False)
                self.chunker.load_model()

	def process(self, inputFile, taskOptions, outputFile):
		self.chunker.tag_input(inputFile,outputFile, 'ccl,autogen_sent_id', 'ccl', False)

if __name__ == '__main__':
	parser = create_service_option_parser()
	args = parser.parse_args()
	config_path = args.config_path
	logfile_path = args.log_file
	logging_lvl = args.logging_lvl
	run_as_daemon = args.daemon

	service = IobberService(config_path, logfile_path, logging_lvl, run_as_daemon)
	service.run()
