예제 #1
0
파일: Plotter.java 프로젝트: justoy/cs61b
  /**
   * Creates overlaid category weight plots for each category label in CATEGORYLABELS from STARTYEAR
   * to ENDYEAR using NGM and WN as data sources.
   */
  public static void plotCategoryWeights(
      NGramMap ngm, WordNet wn, String[] categoryLabels, int startYear, int endYear) {

    Chart chart =
        new ChartBuilder().width(800).height(600).xAxisTitle("years").yAxisTitle("data").build();

    for (String categoryLabel : categoryLabels) {
      Set words = wn.hyponyms(categoryLabel);
      TimeSeries bundle = ngm.summedWeightHistory(words, startYear, endYear);
      chart.addSeries(categoryLabel, bundle.years(), bundle.data());
    }
    new SwingWrapper(chart).displayChart();
  }
예제 #2
0
파일: Plotter.java 프로젝트: justoy/cs61b
 /**
  * Creates a plot of the total normalized count of every word that is a hyponym of CATEGORYLABEL
  * from STARTYEAR to ENDYEAR using NGM and WN as data sources.
  */
 public static void plotCategoryWeights(
     NGramMap ngm, WordNet wn, String categoryLabel, int startYear, int endYear) {
   Set words = wn.hyponyms(categoryLabel);
   TimeSeries summedWeightHistory = ngm.summedWeightHistory(words, startYear, endYear);
   plotTS(summedWeightHistory, "Popularity", "year", "weight", categoryLabel);
 }