本文整理了Java中twitter4j.Status.getHashtagEntities()
方法的一些代码示例,展示了Status.getHashtagEntities()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.getHashtagEntities()
方法的具体详情如下:
包路径:twitter4j.Status
类名称:Status
方法名:getHashtagEntities
暂无
代码示例来源:origin: apache/incubator-druid
HashtagEntity[] hts = status.getHashtagEntities();
String text = status.getText();
theMap.put("text", (null == text) ? "" : text);
代码示例来源:origin: pulsarIO/realtime-analytics
@Override
public void onStatus(Status status) {
HashtagEntity[] hashtagEntities = status.getHashtagEntities();
JetstreamEvent event = new JetstreamEvent();
event.setEventType("TwitterSample");
Place place = status.getPlace();
if (place != null) {
event.put("country", place.getCountry());
}
event.put("ct", status.getCreatedAt().getTime());
event.put("text", status.getText());
event.put("lang", status.getLang());
event.put("user", status.getUser().getName());
if (hashtagEntities != null && hashtagEntities.length > 0) {
StringBuilder s = new StringBuilder();
s.append(hashtagEntities[0].getText());
for (int i = 1; i < hashtagEntities.length; i++) {
s.append(",");
s.append(hashtagEntities[i].getText());
}
event.put("hashtag", s.toString());
}
fireSendEvent(event);
}
代码示例来源:origin: arcturus/android-live-storm
@Override
public List<Object> filter(Status status) {
if(status == null) {
return null;
}
List<HashtagEntity> hashtags = Arrays.asList(status.getHashtagEntities());
if(hashtags != null && hashtags.size() > 0) {
for(HashtagEntity tag: hashtags) {
if(!forbiddenTags.contains(tag.getText().toLowerCase())) {
publish(tag.getText().toLowerCase());
}
}
}
return null;
}
代码示例来源:origin: apache/apex-malhar
@Override
public void process(Status status)
{
HashtagEntity[] entities = status.getHashtagEntities();
if (entities != null) {
for (HashtagEntity he : entities) {
if (he != null) {
hashtags.emit(he.getText());
}
}
}
}
代码示例来源:origin: openimaj/openimaj
@Override
public List<Context> apply(Status in) {
HashtagEntity[] tags = in.getHashtagEntities();
List<Context> ret = new ArrayList<Context>();
for (HashtagEntity hashtagEntity : tags) {
String withHash = "#" + hashtagEntity.getText();
if(hashes.contains(withHash)){
Context ctx = new Context();
ctx.put(HASHTAG_KEY, withHash);
ctx.put("status", in);
ret.add(ctx);
}
}
return ret;
}
代码示例来源:origin: eshioji/trident-tutorial
private void extractHashtags(Status tweet, Set<Content> contents) {
for (HashtagEntity entity : tweet.getHashtagEntities()) {
Content hashtag = newBase(tweet);
String hashtag_normalized = entity.getText().toLowerCase();
hashtag.setContentName(hashtag_normalized);
hashtag.setContentType("hashtag");
contents.add(hashtag);
}
}
代码示例来源:origin: org.openimaj/sandbox
@Override
public List<Context> apply(Status in) {
HashtagEntity[] tags = in.getHashtagEntities();
List<Context> ret = new ArrayList<Context>();
for (HashtagEntity hashtagEntity : tags) {
String withHash = "#" + hashtagEntity.getText();
if(hashes.contains(withHash)){
Context ctx = new Context();
ctx.put(HASHTAG_KEY, withHash);
ctx.put("status", in);
ret.add(ctx);
}
}
return ret;
}
代码示例来源:origin: Tristan971/Lyrebird
@Override
public List<Token> extractTokens(final Status status) {
return Arrays.stream(status.getHashtagEntities()).map(hashtag -> new Token(
"#" + hashtag.getText(),
hashtag.getStart(),
hashtag.getEnd(),
Token.TokenType.CLICKABLE,
() -> browserSupport.openUrl(HASHTAG_SEARCH_BASE_URL + hashtag.getText())
)).collect(Collectors.toList());
}
代码示例来源:origin: yhegde/facebook-page-scraper
for(HashtagEntity hashtagEntity: status.getHashtagEntities())
代码示例来源:origin: arcturus/android-live-storm
@Override
public void execute(Tuple tuple) {
Status status = (Status)tuple.getValue(0);
HashtagEntity hashTags[] = status.getHashtagEntities();
if(hashTags != null && hashTags.length >=2) {
int count = 0;
/**
* Do simple filtering to remove spam tweets
*/
for(HashtagEntity hashtag: hashTags) {
if("android".equals(hashtag.getText().toLowerCase()) ||
"androidgames".equals(hashtag.getText().toLowerCase())) {
count++;
}
}
if(count == 2) {
return;
}
}
collector.emit(tuple, new Values(status));
collector.ack(tuple);
}
代码示例来源:origin: io.druid.extensions/druid-examples
HashtagEntity[] hts = status.getHashtagEntities();
String text = status.getText();
theMap.put("text", (null == text) ? "" : text);
代码示例来源:origin: twitter/GraphJet
long tweetId = status.getId();
long resolvedTweetId = status.isRetweet() ? status.getRetweetedStatus().getId() : status.getId();
HashtagEntity[] hashtagEntities = status.getHashtagEntities();
代码示例来源:origin: stackoverflow.com
HashtagEntity[] hashtagsEntities = tweetById.getHashtagEntities();
for (HashtagEntity hashtag : hashtagsEntities){
System.out.println(hashtag.getText());
代码示例来源:origin: org.apache.apex/malhar-contrib
@Override
public void emitTuples()
{
for (int size = statuses.size(); size-- > 0;) {
Status s = statuses.poll();
if (status.isConnected()) {
status.emit(s);
}
if (text.isConnected()) {
text.emit(s.getText());
}
if (url.isConnected()) {
URLEntity[] entities = s.getURLEntities();
if (entities != null) {
for (URLEntity ue : entities) {
url.emit((ue.getExpandedURL() == null ? ue.getURL() : ue.getExpandedURL()).toString());
}
}
}
if (hashtag.isConnected()) {
HashtagEntity[] hashtagEntities = s.getHashtagEntities();
if (hashtagEntities != null) {
for (HashtagEntity he : hashtagEntities) {
hashtag.emit(he.getText());
}
}
}
}
}
代码示例来源:origin: apache/apex-malhar
@Override
public void emitTuples()
{
for (int size = statuses.size(); size-- > 0;) {
Status s = statuses.poll();
if (status.isConnected()) {
status.emit(s);
}
if (text.isConnected()) {
text.emit(s.getText());
}
if (url.isConnected()) {
URLEntity[] entities = s.getURLEntities();
if (entities != null) {
for (URLEntity ue : entities) {
url.emit((ue.getExpandedURL() == null ? ue.getURL() : ue.getExpandedURL()).toString());
}
}
}
if (hashtag.isConnected()) {
HashtagEntity[] hashtagEntities = s.getHashtagEntities();
if (hashtagEntities != null) {
for (HashtagEntity he : hashtagEntities) {
hashtag.emit(he.getText());
}
}
}
}
}
代码示例来源:origin: eshioji/trident-tutorial
if (tweet.getHashtagEntities() != null) {
extractHashtags(tweet, contents);
代码示例来源:origin: org.openimaj/sandbox
for (final HashtagEntity tag : this.status.getHashtagEntities()) {
status.keywords.add(tag.getText());
代码示例来源:origin: openimaj/openimaj
for (final HashtagEntity tag : this.status.getHashtagEntities()) {
status.keywords.add(tag.getText());
代码示例来源:origin: jcustenborder/kafka-connect-twitter
struct.put("HashtagEntities", convert(status.getHashtagEntities()));
struct.put("UserMentionEntities", convert(status.getUserMentionEntities()));
struct.put("MediaEntities", convert(status.getMediaEntities()));
内容来源于网络,如有侵权,请联系作者删除!