public static void main(String args[]) {
        SrtProcessor processor = new SrtProcessor("in/subs/Lecture_1_The_Nature_of_Images.srt");
//        for (String p : processor.getParagraphedScript()) {
//            System.out.println("<p> " + p);
//        }
        System.out.println(processor.toXMLFile("lecture1.xml"));

        Map<Integer, List<SrtChunk>> sentencesMapping = processor.getSentencesMapping();
        System.out.println(sentencesMapping.size());

        SegmenterProcessor segProc = new SegmenterProcessor(processor.getFullScript());
        List<String> segmentsText = segProc.getSegmentsText();
        List<Integer> segmentsSentences = segProc.getSegmentSentences();

        int index = -1;
        for (String segmentText : segmentsText) {
            index++;

            // Get the block of sentences that will use this semantic info
            int startSentenceNo = segmentsSentences.get(index);
            int endSentenceNo = index < segmentsSentences.size() - 1 ?
                    segmentsSentences.get(index + 1) :
                    processor.getMaxSentenceNo();

            try {
                AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("api_key.txt");
                Document doc = alchemyObj.TextGetRankedNamedEntities(segmentText);

                String xmlDoc = getStringFromDocument(doc);
                System.out.println(xmlDoc);
                List<Entity> entities = Convertor.getEntities(xmlDoc);

                System.out.println("*****************");
                doc = alchemyObj.TextGetRankedConcepts(segmentText);
                xmlDoc = getStringFromDocument(doc);
                System.out.println(xmlDoc);
                List<Concept> concepts = Convertor.getConcepts(xmlDoc);

                // Add entities and concepts to srtChunks
                for (int sentenceNo = startSentenceNo ; sentenceNo < endSentenceNo ; sentenceNo++) {
                    processor.addEntitiesToSentence(entities, sentenceNo);
                    processor.addConceptsToSentence(concepts, sentenceNo);
                }

                System.out.println("-----------------");
            } catch (IOException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            } catch (SAXException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            } catch (ParserConfigurationException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            } catch (XPathExpressionException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }

        }
        processor.toSrtFile("in/lecture1.srt");
    }