Exemple #1
0
  /**
   * 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();
  }
Exemple #2
0
 /**
  * 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);
 }