本文整理汇总了Java中eu.socialsensor.framework.common.domain.Item.getTitle方法的典型用法代码示例。如果您正苦于以下问题:Java Item.getTitle方法的具体用法?Java Item.getTitle怎么用?Java Item.getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eu.socialsensor.framework.common.domain.Item
的用法示例。
在下文中一共展示了Item.getTitle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import eu.socialsensor.framework.common.domain.Item; //导入方法依赖的package包/类
public void execute(Tuple input) {
try {
Item item = (Item)input.getValueByField("Item");
if(item == null)
return;
String title = item.getTitle();
if(title != null) {
List<Entity> entities = extract(title);
item.setEntities(entities);
}
_collector.emit(new Values(item));
}
catch(Exception e) {
_logger.error(e);
}
}
示例2: toString
import eu.socialsensor.framework.common.domain.Item; //导入方法依赖的package包/类
public String toString()
{
String repr = "Title: "+this.title+"\n";
repr = repr + "Keywords:";
for (Entry<String,Double> tmp_entry : this.keywords.entrySet())
{
repr = repr + " " + tmp_entry.getKey();
}
repr = repr + "\n";
repr = repr + "Representative Docs:";
for (Item i : this.representativeDocuments)
{
String txt = i.getTitle();
if (txt.length() > 140)
txt = txt.substring(0, 140);
repr = repr + i.getTitle() + " -- ";
}
return repr;
}
示例3: execute
import eu.socialsensor.framework.common.domain.Item; //导入方法依赖的package包/类
@Override
public void execute(Tuple input) {
Item item = (Item)input.getValueByField("Item");
if(item == null)
return;
String title = item.getTitle();
if(title != null) {
List<TaggedWord> taggedSentences = tag(title);
_collector.emit(new Values(item, taggedSentences));
}
}
示例4: toString
import eu.socialsensor.framework.common.domain.Item; //导入方法依赖的package包/类
public String toString() {
String dyscoString = "Id: " + id + "\n";
dyscoString += "Creation date: " + creationDate + "\n";
dyscoString += "Score: " + score + "\n";
dyscoString += "Items: \n";
for (Item item : items) {
dyscoString += item.getId() + ":" + item.getTitle() + "\n";
}
dyscoString += "Entities: \n";
for (Entity entity : entities) {
dyscoString += entity.getName() + "@@@" + entity.getType().toString() + ":" + entity.getCont() + "\n";
}
dyscoString += "Tags: \n";
Iterator<Entry<String, Double>> iteratorHashtags = hashtags.entrySet().iterator();
while (iteratorHashtags.hasNext()) {
Entry<String, Double> hashtag = iteratorHashtags.next();
dyscoString += hashtag.getKey() + ":" + hashtag.getValue() + "\n";
}
dyscoString += "Keywords: \n";
Iterator<Entry<String, Double>> iteratorKeywords = keywords.entrySet().iterator();
while (iteratorKeywords.hasNext()) {
Entry<String, Double> keyword = iteratorKeywords.next();
dyscoString += keyword.getKey() + ":" + keyword.getValue() + "\n";
}
dyscoString += "SolrQuery : " + solrQueryString + "\n";
dyscoString += "Trending : " + trending + "\n";
dyscoString += "DyscoType : " + dyscoType.toString() + "\n";
return dyscoString;
}
示例5: SolrNewsFeed
import eu.socialsensor.framework.common.domain.Item; //导入方法依赖的package包/类
public SolrNewsFeed(Item item){
id = item.getId();
title = item.getTitle();
description = item.getDescription();
publicationTime = item.getPublicationTime();
source = item.getUrl();
lists = item.getList();
}
示例6: SolrTopicDetectionItem
import eu.socialsensor.framework.common.domain.Item; //导入方法依赖的package包/类
public SolrTopicDetectionItem(Item item) {
id = item.getId();
title = item.getTitle();
tags = item.getTags();
if (item.getEntities()!=null && item.getEntities().size()!=0)
{
List<Entity> e = item.getEntities();
entities = new String[e.size()];
for(int i=0; i<e.size(); i++) {
entities[i] = e.get(i).getName();
}
}
else
entities = null;
if (item.getLinks()!=null && item.getLinks().length!=0)
{
URL[] links = item.getLinks();
urls = new String[links.length];
for(int i=0; i<links.length; i++)
urls[i] = links[i].toString();
}
else
urls = null;
publicationTime = item.getPublicationTime();
}
示例7: getTerms
import eu.socialsensor.framework.common.domain.Item; //导入方法依赖的package包/类
public Set<String> getTerms(Item item){
String tmp_item_text=item.getTitle();
Set<String> tmp_urls=getURLs(tmp_item_text);
Iterator it = tmp_urls.iterator();
while (it.hasNext()) {
String next_url=(String) it.next();
tmp_item_text=tmp_item_text.replaceAll(next_url, "");
}
Set<String> tmp_set=new HashSet<String>();
Scanner tokenize;
String tmp_word;
if(tmp_item_text!=null){
tokenize = new Scanner(tmp_item_text);
//Punctuation and white space is used for
//splitting the text in tokens.
tokenize.useDelimiter(delimiters);
while (tokenize.hasNext()) {
tmp_word=tokenize.next().toLowerCase();
tmp_word.replaceAll(delimiters, "");
//The following lines try to remove punctuation.
//Maybe it should be skipped or revised
String[] tmp_str=tmp_word.split(punctuation);
while((tmp_word.length()>0)&&((tmp_word.charAt(0)+"").matches(punctuation)))
tmp_word=tmp_word.substring(1);
while((tmp_word.length()>0)&&((tmp_word.charAt(tmp_word.length()-1)+"").matches(punctuation)))
tmp_word=tmp_word.substring(0,tmp_word.length()-1);
if(!isUserMention(tmp_word)){
// if((!StopWords.IsStopWord(tmp_word))&&(tmp_word.length()>=Constants.MIN_WORD_LENGTH))
if((tmp_word.length()>=3))
tmp_set.add(tmp_word);
}
// else if(Constants.TWEET_REMOVE_USER_MENTIONS==false)
// tmp_set.add(tmp_word);
}
}
return tmp_set;
}
示例8: main
import eu.socialsensor.framework.common.domain.Item; //导入方法依赖的package包/类
public static void main(String[] args) throws UnknownHostException, InterruptedException {
EntitiesExtractor extractor = new EntitiesExtractor();
ItemDAO itemDAO = new ItemDAOImpl("localhost", "loc", "Items");
while(true) {
List<Item> items = itemDAO.getItemsSince(0);
for(Item item : items) {
String title = item.getTitle();
try {
List<Entity> entities = extractor.getEntities(title);
item.setEntities(entities);
itemDAO.updateItem(item);
} catch (Exception e) {
continue;
}
}
Thread.sleep(5000);
}
//
// List<Entity> entities;
// try {
// entities = extractor.getEntities(items);
// for (Entity entity : entities) {
//// System.out.println(entity.getName() + " - " + entity.getType() +
//// " - " + entity.getCont());
// System.out.println(entity.toJSONString());
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
}
示例9: main
import eu.socialsensor.framework.common.domain.Item; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
EntitiesExtractor extractor = new EntitiesExtractor();
ItemDAO itemDAO = new ItemDAOImpl("localhost", "loc", "Items");
while(true) {
List<Item> items = itemDAO.getItemsSince(0);
for(Item item : items) {
String title = item.getTitle();
try {
List<Entity> entities = extractor.getEntities(title);
item.setEntities(entities);
itemDAO.updateItem(item);
} catch (Exception e) {
continue;
}
}
Thread.sleep(5000);
}
//
// List<Entity> entities;
// try {
// entities = extractor.getEntities(items);
// for (Entity entity : entities) {
//// System.out.println(entity.getName() + " - " + entity.getType() +
//// " - " + entity.getCont());
// System.out.println(entity.toJSONString());
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
}