Question: Any help please? I need to complete this class. public class Tweet { // TODO: Add appropriate data types public Tweet(String p, String i, String

Any help please?

I need to complete this class.

public class Tweet {

// TODO: Add appropriate data types public Tweet(String p, String i, String d, String u, String t) { // TODO } public void addNeighbour(String ID) { // PRE: - // POST: Adds a neighbour to the current tweet as part of graph structure // TODO } public Integer numNeighbours() { // PRE: - // POST: Returns the number of neighbours of this tweet // TODO return null; } public void deleteAllNeighbours() { // PRE: - // POST: Deletes all neighbours of this tweet // TODO } public Vector getNeighbourTweetIDs () { // PRE: - // POST: Returns IDs of neighbouring tweets as vector of strings // TODO return null; }

public Boolean isNeighbour(String ID) { // PRE: - // POST: Returns true if ID is neighbour of the current tweet, false otherwise // TODO

return null; } public Boolean correctlyPredictedPolarity () { // PRE: - // POST: Returns true if predicted polarity matches gold, false otherwise // TODO

return null; } public Polarity getGoldPolarity() { // PRE: - // POST: Returns the gold polarity of the tweet // TODO

return null; } public Polarity getPredictedPolarity() { // PRE: - // POST: Returns the predicted polarity of the tweet // TODO

return null; } public void setPredictedPolarity(Polarity p) { // PRE: - // POST: Sets the predicted polarity of the tweet

// TODO } public String getID() { // PRE: - // POST: Returns ID of tweet // TODO

return null; } public String getDate() { // PRE: - // POST: Returns date of tweet // TODO

return null; } public String getUser() { // PRE: - // POST: Returns identity of tweeter // TODO

return null; } public String getText() { // PRE: - // POST: Returns text of tweet as a single string // TODO

return null; } public String[] getWords() { // PRE: - // POST: Returns tokenised text of tweet as array of strings if (this.getText() == null) return null;

String[] words = null; String tmod = this.getText(); tmod = tmod.replaceAll("@.*?\\s", ""); tmod = tmod.replaceAll("http.*?\\s", ""); tmod = tmod.replaceAll("\\s+", " "); tmod = tmod.replaceAll("[\\W&&[^\\s]]+", ""); tmod = tmod.toLowerCase(); tmod = tmod.trim(); words = tmod.split("\\s"); return words; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!