示例#1
0
 /**
  * Parses some String input without a supporting file, returning statements and comments.
  *
  * @param inputLines a list of lines of code
  */
 @VisibleForTesting
 Parser.ParseResult parseFileWithComments(String... inputLines) {
   ParserInputSource input = ParserInputSource.create(Joiner.on("\n").join(inputLines), null);
   return isSkylark
       ? Parser.parseFileForSkylark(input, eventHandler, new ValidationEnvironment(this))
       : Parser.parseFile(input, eventHandler, /*parsePython=*/ false);
 }
示例#2
0
  public void parseFile(String fileName) {
    if (GLOBAL.parseForWordMap) { // If we are parsing word map transcripts
      // remove last four characters from filename (".txt")
      int i = fileName.indexOf(".txt");
      fileName = fileName.substring(0, i);
      // add underscore & re-insert ".txt"
      fileName += "_.txt";
    }

    parseFile(fileName, GLOBAL.parseForWordMap);
  }
示例#3
0
  // Sends all Futurama transcripts through the method parseFile()
  public void parseAllTranscripts() {
    String path;

    // SEASON 1
    parseFile("transcripts/SEASON1/S1E1.txt"); // Series 1
    parseFile("transcripts/SEASON1/S1E2.txt");
    parseFile("transcripts/SEASON1/S1E3.txt");
    parseFile("transcripts/SEASON1/S1E4.txt");
    parseFile("transcripts/SEASON1/S1E5.txt");
    parseFile("transcripts/SEASON1/S1E6.txt");
    parseFile("transcripts/SEASON1/S1E7.txt");
    parseFile("transcripts/SEASON1/S1E8.txt");
    parseFile("transcripts/SEASON1/S1E9.txt");
    parseFile("transcripts/SEASON1/S2E1.txt"); // Series 2
    parseFile("transcripts/SEASON1/S2E2.txt");
    parseFile("transcripts/SEASON1/S2E3.txt");
    parseFile("transcripts/SEASON1/S2E4.txt");

    // SEASON 2
    path = "transcripts/SEASON2/S2E"; // Series 2, continued
    for (int x = 5; x < 10; ++x) { // Build path name dynamically.
      parseFile(path + x + ".txt");
    }
    parseFile("transcripts/SEASON2/S2E11.txt");
    parseFile("transcripts/SEASON2/S2E10.txt");
    parseFile("transcripts/SEASON2/S2E12.txt");
    parseFile("transcripts/SEASON2/S2E13.txt");
    parseFile("transcripts/SEASON2/S2E15.txt");
    parseFile("transcripts/SEASON2/S2E14.txt");
    parseFile("transcripts/SEASON2/S2E16.txt");
    parseFile("transcripts/SEASON2/S2E17.txt");
    parseFile("transcripts/SEASON2/S2E19.txt");
    parseFile("transcripts/SEASON2/S2E18.txt");
    parseFile("transcripts/SEASON2/S2E20.txt");

    parseFile("transcripts/SEASON2/S3E2.txt"); // Series 3
    parseFile("transcripts/SEASON2/S3E1.txt");
    parseFile("transcripts/SEASON2/S3E3.txt");

    // SEASON 3
    parseFile("transcripts/SEASON3/S3E5.txt");
    parseFile("transcripts/SEASON3/S3E4.txt");

    parseFile("transcripts/SEASON3/S4E2.txt");

    parseFile("transcripts/SEASON3/S3E10.txt");
    parseFile("transcripts/SEASON3/S3E9.txt");
    parseFile("transcripts/SEASON3/S3E6.txt");
    parseFile("transcripts/SEASON3/S3E7.txt");
    parseFile("transcripts/SEASON3/S3E8.txt");
    parseFile("transcripts/SEASON3/S3E11.txt");

    parseFile("transcripts/SEASON3/S4E6.txt");
    parseFile("transcripts/SEASON3/S3E12.txt");
    parseFile("transcripts/SEASON3/S5E3.txt");

    parseFile("transcripts/SEASON3/S3E13.txt");
    parseFile("transcripts/SEASON3/S3E14.txt");
    parseFile("transcripts/SEASON3/S3E15.txt");

    parseFile("transcripts/SEASON3/S4E10.txt");
    parseFile("transcripts/SEASON3/S4E7.txt");
    parseFile("transcripts/SEASON3/S4E3.txt");
    parseFile("transcripts/SEASON3/S4E1.txt");
    parseFile("transcripts/SEASON3/S4E8.txt");
    parseFile("transcripts/SEASON3/S4E9.txt");
    parseFile("transcripts/SEASON3/S4E11.txt");

    // SEASON 4
    parseFile("transcripts/SEASON4/S5E5.txt");
    parseFile("transcripts/SEASON4/S4E5.txt");
    parseFile("transcripts/SEASON4/S4E4.txt");

    parseFile("transcripts/SEASON4/S5E6.txt");
    parseFile("transcripts/SEASON4/S5E4.txt");
    parseFile("transcripts/SEASON4/S5E15.txt");
    parseFile("transcripts/SEASON4/S5E2.txt");
    parseFile("transcripts/SEASON4/S5E1.txt");
    parseFile("transcripts/SEASON4/S5E7.txt");
    parseFile("transcripts/SEASON4/S5E8.txt");

    parseFile("transcripts/SEASON4/S4E12.txt");

    parseFile("transcripts/SEASON4/S5E9.txt");
    parseFile("transcripts/SEASON4/S5E13.txt");
    parseFile("transcripts/SEASON4/S5E14.txt");
    parseFile("transcripts/SEASON4/S5E10.txt");
    parseFile("transcripts/SEASON4/S5E11.txt");
    parseFile("transcripts/SEASON4/S5E12.txt");
    parseFile("transcripts/SEASON4/S5E16.txt");

    // SEASON 5
    path = "transcripts/SEASON5/S6E";
    for (int b = 1; b < 17; ++b) {
      parseFile(path + b + ".txt");
    }

    // SEASON 6
    path = "transcripts/SEASON6/S7E";
    for (int c = 1; c < 14; ++c) {
      parseFile(path + c + ".txt");
    }

    parseFile("transcripts/SEASON6/S8E5.txt");
    parseFile("transcripts/SEASON6/S8E8.txt");
    parseFile("transcripts/SEASON6/S8E4.txt");
    parseFile("transcripts/SEASON6/S8E2.txt");
    parseFile("transcripts/SEASON6/S8E10.txt");
    parseFile("transcripts/SEASON6/S8E3.txt");
    parseFile("transcripts/SEASON6/S8E1.txt");
    parseFile("transcripts/SEASON6/S8E6.txt");
    parseFile("transcripts/SEASON6/S8E9.txt");
    parseFile("transcripts/SEASON6/S8E7.txt");
    parseFile("transcripts/SEASON6/S8E11.txt");
    parseFile("transcripts/SEASON6/S8E12.txt");
    parseFile("transcripts/SEASON6/S8E13.txt");

    if (!GLOBAL.parseForWordMap) {
      // Aggregate all seasons
      LIST_ALL.addAll(LIST_S1);
      LIST_ALL.addAll(LIST_S2);
      LIST_ALL.addAll(LIST_S3);
      LIST_ALL.addAll(LIST_S4);
      LIST_ALL.addAll(LIST_S5);
      LIST_ALL.addAll(LIST_S6);

      /*for(int n=0; n<LIST_ALL.size(); ++n) {
      	Episode temp = LIST_ALL.get(n);
      	System.out.println( temp.getSeason() + ": " + temp.getEpisode());
      }*/
    }
  }