#!/usr/bin/env python

try:
	from bs4 import BeautifulSoup
except ImportError:
	raise Exception("Cannot import BeautifulSoup. Please install it.")

import argparse

from pyrouge.utils.file_utils import DirectoryProcessor
from pyrouge.utils.argparsers import io_parser

def from_html(html):
	soup = BeautifulSoup(html)
	sentences = [elem.text for elem in soup.find_all("a") if 'id' in elem.attrs]
	text = "\n".join(sentences)
	return text

def get_args():
	parser = argparse.ArgumentParser(parents=[io_parser])
	return parser.parse_args()
 
def main():
	args = get_args()
	DirectoryProcessor.process(args.input_dir, args.output_dir, from_html)

if __name__ == "__main__":
	main()
