每条推文中非重复词的总数 [英] Total number of non repeated words in each tweet

查看:19
本文介绍了每条推文中非重复词的总数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 java 和 Trident 的新手,我导入了获取推文的项目,但我想得到一些东西当我从 tuple.getValue(0);tuple.getValue(0); 仅表示第一条推文?!

I'm new to java and Trident , I imported project for getting tweets but i want to get something How this code get more than one tweet as i got form the code that tuple.getValue(0); means first tweet only ?!

我在获取哈希集或哈希图中的所有推文以获取每条推文中的特征词总数时遇到的问题

Problem with me to get all tweets in hashset or hashmap to get total number of distnictive words in each tweet

public void execute(TridentTuple tuple, TridentCollector collector) {

此方法用于在推文上执行方程

this method is used to execute equations on tweet

public Values getValues(Tweet tweet, String[] words){
 }

这段代码得到了第一条推文,然后得到它的正文,将其转换为字符串数组,我知道我需要解决什么问题,但写得不好

This code got first tweet then get body of it ,converting it to array of string , i know what i need to solve but couldn't write it well

我的想法:像

for (int i=0;i<10;i++)
{
 Tweet tweet = (Tweet) tuple.getValue(i);   
}

推荐答案

  1. 对于每条推文:
    • 对于推文中的每个词:
      • 尝试将每个单词添加到集合中.
        如果该词已存在于集合中,则将其从集合中删除.

这篇关于每条推文中非重复词的总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆