/** * Creates the vocabulary related to the given category. This vocabulary is composed by the terms * that appears in the category articles and its frequency. * * @param category The category. * @return The vocabulary related to the category. * @throws WikiApiException */ public DomainVocabulary createCategoryVocabulary(Category category) throws WikiApiException { CHK.CHECK_NOT_NULL(category); Locale language = new Locale(wiki.getLanguage().name()); DomainVocabulary vocabulary = new DomainVocabulary(language); HashSet<Page> pages = null; pages = (HashSet<Page>) category.getArticles(); for (Page page : pages) { String text = wiki.getParsedArticle(page.getPageId()).getText(); vocabulary.addTerms(text); } return vocabulary; }
public Locale getLocale() { return new Locale(wiki.getLanguage().name()); }