public static void main(String[] args) {
		if (!validDirectory(args)) {
			System.out.println(args[0]);
			System.out
					.println("The argument should be a directory of annotated lyric files.");
			System.exit(1);
		}

		RCRhymeDictionary rhymeDict = new RCRhymeDictionary();
		RCLyricMap lyricMap = new RCLyricMap();
		RCSongStructure songStruct = new RCSongStructure();

		RCFileReader.setRhymeDictionary(rhymeDict);
		RCFileReader.setLyricMap(lyricMap);
		RCFileReader.setSongStructure(songStruct);

		File[] lyricFiles = new File(args[0]).listFiles();
		for (File file : lyricFiles) {
			if (file.isDirectory())
				continue;
			RCFileReader.setGeneration(file);
		}

		RCStructureGenerator.setRhymeDictionary(rhymeDict);
		RCStructureGenerator.setSongStructure(songStruct);
		List<LargeSongElement> songElements = null;
		try {
			songElements = RCStructureGenerator
					.generateSongSkeleton();
		} catch (Exception e) {
		}

		RCLineGenerator.setLyricMap(lyricMap);
		for (LargeSongElement el : songElements) {
			List<String> lines = el.getLines();
			if (!lines.isEmpty()) // repetition, probably chorus
				continue;

			List<String> lastWords = el.getLastWords();
			List<Integer> lineLengths = el.getLineLengths();
			for (int i = 0; i < lastWords.size(); i++) {
				lines.add(RCLineGenerator.generateLine(lastWords.get(i), lineLengths.get(i)));
			}
		}

		List<String> outputSong = new ArrayList<String>();
		for (LargeSongElement el : songElements) {
			outputSong.add(el.getSongElementTypeAsString());
			outputSong.addAll(el.getLines());
			outputSong.add("");
		}
		
		RCFileWriter.writeSong(OUTPUT_FILE_PATH, outputSong);
	}