TwitterSentimentFramework2021/.classpath TwitterSentimentFramework2021/.project TwitterSentimentFramework2021 org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature...

It is a java assignment shown in the files below


TwitterSentimentFramework2021/.classpath TwitterSentimentFramework2021/.project TwitterSentimentFramework2021 org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature TwitterSentimentFramework2021/.settings/org.eclipse.jdt.core.prefs eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.7 TwitterSentimentFramework2021/bin/student/Polarity.class package student; final synchronized enum Polarity { public static final Polarity POS; public static final Polarity NEG; public static final Polarity NEUT; public static final Polarity NONE; static void (); private void Polarity(String, int); public static Polarity[] values(); public static Polarity valueOf(String); } TwitterSentimentFramework2021/bin/student/Strength.class package student; final synchronized enum Strength { public static final Strength STRONG; public static final Strength WEAK; public static final Strength NONE; static void (); private void Strength(String, int); public static Strength[] values(); public static Strength valueOf(String); } TwitterSentimentFramework2021/bin/student/Tests.class package student; public synchronized class Tests { String SAMPLE_CSV_FILE_PATH; String BASIC_SENT_FILE_PATH; String INV_INDEX_FILE_PATH; String FINEGRAINED_SENT_FILE_PATH; public void Tests(); public void testNumTweets(); public void testTweetUser(); public void testTweetGoldPolarity(); public void testTweetPredictedPolarity(); public void testTweetText(); public void testTweetWords(); public void testTweetKeywordSentiment(); public void testTweetKeywordCorrectSentiment(); public void testTweetKeywordIncorrectSentiment(); public void testTweetKeywordAccuracy(); public void testTweetKeywordCoverage(); public void testAddNeighbour(); public void testDeleteNeighbour(); public void testImportInverseIndex(); public void testGraphConstruction(); public void testNumComponents(); public void testComponentLabelCountPos(); public void testComponentLabelCountNeg(); public void testComponentLabelCountNeut(); public void testComponentLabelCountNone(); public void testLabelPropagationOverComponent1(); public void testLabelPropagationOverComponent2(); public void testComponentMajorityLabel(); public void testTweetFinegrainedKeywordSentiment(); } TwitterSentimentFramework2021/bin/student/Tweet.class package student; public synchronized class Tweet { public void Tweet(String, String, String, String, String); public void addNeighbour(String); public Integer numNeighbours(); public void deleteAllNeighbours(); public java.util.Vector getNeighbourTweetIDs(); public Boolean isNeighbour(String); public Boolean correctlyPredictedPolarity(); public Polarity getGoldPolarity(); public Polarity getPredictedPolarity(); public void setPredictedPolarity(Polarity); public String getID(); public String getDate(); public String getUser(); public String getText(); public String[] getWords(); } TwitterSentimentFramework2021/bin/student/TweetCollection.class package student; public synchronized class TweetCollection { public void TweetCollection(); public Tweet getTweetByID(String); public Integer numTweets(); public Polarity getBasicSentimentWordPolarity(String); public Polarity getFinegrainedSentimentWordPolarity(String); public Strength getFinegrainedSentimentWordStrength(String); public void ingestTweetsFromFile(String) throws java.io.IOException, CsvException; public void importBasicSentimentWordsFromFile(String) throws java.io.IOException; public void importFinegrainedSentimentWordsFromFile(String) throws java.io.IOException; public Boolean isBasicSentWord(String); public Boolean isFinegrainedSentWord(String); public void predictTweetSentimentFromBasicWordlist(); public void predictTweetSentimentFromFinegrainedWordlist(Integer, Integer); public java.util.Map importInverseIndexFromFile(String) throws java.io.IOException; public void constructSharedWordGraph(java.util.Map); public Integer numConnectedComponents(); public void annotateConnectedComponents(); public Integer componentSentLabelCount(String, Polarity); public void propagateLabelAcrossComponent(String, Polarity, Boolean); public void propagateMajorityLabelAcrossComponents(Boolean); public Double accuracy(); public Double coverage(); public static void main(String[]); } TwitterSentimentFramework2021/src/student/Tests.java TwitterSentimentFramework2021/src/student/Tests.java package student; import static org.junit.Assert.*; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; import java.util.Map; import java.util.Vector; import org.junit.Test; import com.opencsv.exceptions.CsvException; public class Tests {     // change the below paths to where your own versions of the data are located          String SAMPLE_CSV_FILE_PATH = "/home/madras/teaching/21comp2010/ass/data/training-10.csv";     String BASIC_SENT_FILE_PATH = "/home/madras/teaching/21comp2010/ass/data/basic-sent-words.txt";     String INV_INDEX_FILE_PATH = "/home/madras/teaching/21comp2010/ass/data/inv-index-50.txt";     String FINEGRAINED_SENT_FILE_PATH = "/home/madras/teaching/21comp2010/ass/data/finegrained-sent-words.txt";          // SAMPLE PASS-LEVEL TESTS          @Test     public void testNumTweets() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Integer.valueOf(10), d.numTweets());     }          @Test     public void testTweetUser() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals("_TheSpecialOne_", d.getTweetByID("1467810369").getUser());     }     @Test     public void testTweetGoldPolarity() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Polarity.NEG, d.getTweetByID("1467810369").getGoldPolarity());     }     @Test     public void testTweetPredictedPolarity() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Polarity.NONE, d.getTweetByID("1467810369").getPredictedPolarity());     }     @Test     public void testTweetText() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals("@switchfoot http://twitpic.com/2y1zl - Awww, that's a bummer.  You shoulda got David Carr of Third Day to do it. ;D", d.getTweetByID("1467810369").getText());     }     @Test     public void testTweetWords() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         String w = d.getTweetByID("1467810369").getWords()[0];         assertEquals("awww", w);     }     @Test     public void testTweetKeywordSentiment() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Polarity.NEG, d.getTweetByID("1467810672").getPredictedPolarity());     }     @Test     public void testTweetKeywordCorrectSentiment() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Boolean.TRUE, d.getTweetByID("1467810672").correctlyPredictedPolarity());     }     @Test     public void testTweetKeywordIncorrectSentiment() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Boolean.FALSE, d.getTweetByID("1467811184").correctlyPredictedPolarity());     }     @Test     public void testTweetKeywordAccuracy() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Double.valueOf(0.4), d.accuracy());     }     @Test     public void testTweetKeywordCoverage() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Double.valueOf(0.5), d.coverage());     }     // SAMPLE CREDIT-LEVEL TESTS          @Test     public void testAddNeighbour() {         TweetCollection d = new TweetCollection();         try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             d.getTweetByID("1467810672").addNeighbour("1467811372");         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Boolean.TRUE, d.getTweetByID("1467810672").isNeighbour("1467811372"));     }     @Test     public void testDeleteNeighbour() {         TweetCollection d = new TweetCollection();         try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             d.getTweetByID("1467810672").addNeighbour("1467811372");             d.getTweetByID("1467810672").deleteAllNeighbours();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Boolean.FALSE, d.getTweetByID("1467810672").isNeighbour("1467811372"));     }     @Test     public void testImportInverseIndex() {         TweetCollection d = new TweetCollection();         String[] IDs = {"1467811184", "1467811372"};         Vector v = new Vector(Arrays.asList(IDs));         Map<>> invIndex = null;         try {             invIndex = d.importInverseIndexFromFile(INV_INDEX_FILE_PATH);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         assertEquals(v, invIndex.get("whole"));     }     @Test     public void testGraphConstruction() {         TweetCollection d = new TweetCollection();         Map<>> invIndex = null;                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             invIndex = d.importInverseIndexFromFile(INV_INDEX_FILE_PATH);             d.constructSharedWordGraph(invIndex);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Integer.valueOf(1), d.getTweetByID("1467810672").numNeighbours());     }     @Test     public void testNumComponents() {         TweetCollection d = new TweetCollection();         Map<>> invIndex = null;                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             invIndex = d.importInverseIndexFromFile(INV_INDEX_FILE_PATH);             d.constructSharedWordGraph(invIndex);             d.annotateConnectedComponents();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Integer.valueOf(7), d.numConnectedComponents());     }     @Test     public void testComponentLabelCountPos() {         TweetCollection d = new TweetCollection();         Map<>> invIndex = null;                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             invIndex = d.importInverseIndexFromFile(INV_INDEX_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();             d.constructSharedWordGraph(invIndex);             d.annotateConnectedComponents();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Integer.valueOf(1), d.componentSentLabelCount("1467811372", Polarity.POS));     }     @Test     public void testComponentLabelCountNeg() {         TweetCollection d = new TweetCollection();         Map<>> invIndex = null;                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             invIndex = d.importInverseIndexFromFile(INV_INDEX_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();             d.constructSharedWordGraph(invIndex);             d.annotateConnectedComponents();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Integer.valueOf(0), d.componentSentLabelCount("1467811372", Polarity.NEG));     }     @Test     public void testComponentLabelCountNeut() {         TweetCollection d = new TweetCollection();         Map<>> invIndex = null;                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             invIndex = d.importInverseIndexFromFile(INV_INDEX_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();             d.constructSharedWordGraph(invIndex);             d.annotateConnectedComponents();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Integer.valueOf(0), d.componentSentLabelCount("1467811372", Polarity.NEUT));     }     @Test     public void testComponentLabelCountNone() {         TweetCollection d = new TweetCollection();         Map<>> invIndex = null;                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             invIndex = d.importInverseIndexFromFile(INV_INDEX_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();             d.constructSharedWordGraph(invIndex);             d.annotateConnectedComponents();         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Integer.valueOf(1), d.componentSentLabelCount("1467811372", Polarity.NONE));     }          // SAMPLE DISTINCTION-LEVEL TESTS          @Test     public void testLabelPropagationOverComponent1() {         TweetCollection d = new TweetCollection();         Map<>> invIndex = null;                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             invIndex = d.importInverseIndexFromFile(INV_INDEX_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();             d.constructSharedWordGraph(invIndex);             d.annotateConnectedComponents();             d.propagateLabelAcrossComponent("1467811372", Polarity.NEUT, Boolean.TRUE);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Polarity.NEUT, d.getTweetByID("1467811372").getPredictedPolarity());     }     @Test     public void testLabelPropagationOverComponent2() {         TweetCollection d = new TweetCollection();         Map<>> invIndex = null;                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             invIndex = d.importInverseIndexFromFile(INV_INDEX_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();             d.constructSharedWordGraph(invIndex);             d.annotateConnectedComponents();             d.propagateLabelAcrossComponent("1467811372", Polarity.NEUT, Boolean.FALSE);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Polarity.NEUT, d.getTweetByID("1467811184").getPredictedPolarity());     }     @Test     public void testComponentMajorityLabel() {         TweetCollection d = new TweetCollection();         Map<>> invIndex = null;                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             invIndex = d.importInverseIndexFromFile(INV_INDEX_FILE_PATH);             d.importBasicSentimentWordsFromFile(BASIC_SENT_FILE_PATH);             d.predictTweetSentimentFromBasicWordlist();             d.constructSharedWordGraph(invIndex);             d.annotateConnectedComponents();             d.propagateMajorityLabelAcrossComponents(Boolean.FALSE);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Polarity.POS, d.getTweetByID("1467811372").getPredictedPolarity());     }     /*     */     @Test     public void testTweetFinegrainedKeywordSentiment() {         TweetCollection d = new TweetCollection();                  try {             d.ingestTweetsFromFile(SAMPLE_CSV_FILE_PATH);             d.importFinegrainedSentimentWordsFromFile(FINEGRAINED_SENT_FILE_PATH);             d.predictTweetSentimentFromFinegrainedWordlist(2, 1);         }         catch (IOException e) {             System.out.println("in exception: " + e);         }         catch (CsvException e) {             System.out.println("in exception: " + e);         }         assertEquals(Polarity.NEG, d.getTweetByID("1467811594").getPredictedPolarity());     } } TwitterSentimentFramework2021/src/student/Tweet.java TwitterSentimentFramework2021/src/student/Tweet.java package student; import java.util.*; enum Polarity {     POS, NEG, NEUT, NONE; } enum Strength {     STRONG, WEAK, NONE; } 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;              }      } TwitterSentimentFramework2021/src/student/TweetCollection.java TwitterSentimentFramework2021/src/student/TweetCollection.java package student; import java.io.IOException; import java.io.Reader; import java.io.BufferedReader; import java.io.FileReader; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; import com.opencsv.*; import com.opencsv.exceptions.CsvException; import org.junit.Test; public class TweetCollection {     // TODO: add appropriate data types          public TweetCollection() {         // Constructor         // TODO     }          /*      * functions for accessing individual tweets      */          public Tweet getTweetByID (String ID) {         // PRE: -         // POST: Returns the Tweet object that with tweet ID                  // TODO                  return null;     }     public Integer numTweets() {         // PRE: -         // POST: Returns the number of tweets in this collection                  // TODO                  return null;     }          /*      * functions for accessing sentiment words      */          public Polarity getBasicSentimentWordPolarity(String w) {         // PRE: w not null, basic sentiment words already read in from file         // POST: Returns polarity of w              // TODO         return null;     }          public Polarity getFinegrainedSentimentWordPolarity(String w) {         // PRE: w not null, finegrained sentiment words already read in from file         // POST: Returns polarity of w                  // TODO         return null;     }          public Strength getFinegrainedSentimentWordStrength(String w) {         // PRE: w not null, finegrained sentiment words already read in from file         // POST: Returns strength of w                  // TODO         return null;     }          /*      * functions for reading in tweets      *       */     public void ingestTweetsFromFile(String fInName) throws IOException, CsvException {         // PRE: -         // POST: Reads tweets from .csv file, stores in data structure                  // NOTES         // Data source, file format description at http://help.sentiment140.com/for-students         // Using opencsv reader: https://zetcode.com/java/opencsv/              try (CSVReader reader = new CSVReader(new FileReader(fInName))) {             String [] nextLine;             while ((nextLine = reader.readNext()) != null) {                // nextLine[] is an array of values from the line                 Tweet tw = new Tweet(nextLine[0], // gold polarity                         nextLine[1],                // ID                         nextLine[2],                // date                         nextLine[4],                // user                         nextLine[5]);               // text                 // TODO: insert tweet tw into appropriate data type            }         }             }          /*      * functions for sentiment words       */          public void importBasicSentimentWordsFromFile (String fInName) throws IOException {         // PRE: -         // POST: Read in and store basic sentiment words in appropriate data type         // TODO     }          public void importFinegrainedSentimentWordsFromFile (String fInName) throws IOException {         // PRE: -         // POST: Read in and store finegrained sentiment words in appropriate data type         // TODO     }               public Boolean isBasicSentWord (String w) {         // PRE: Basic sentiment words have been read in and stored         // POST: Returns true if w is a basic sentiment word, false otherwise                  // TODO                  return null;     }     public Boolean isFinegrainedSentWord (String w) {         // PRE: Finegrained sentiment words have been read in and stored         // POST: Returns true if w is a finegrained sentiment word, false otherwise                  // TODO                  return null;     }     public void predictTweetSentimentFromBasicWordlist () {         // PRE: Finegrained word sentiment already imported         // POST: For all tweets in collection, tweet annotated with predicted sentiment         //         based on count of sentiment words in sentWords         // TODO     }     public void predictTweetSentimentFromFinegrainedWordlist (Integer strongWeight, Integer weakWeight) {         // PRE: Finegrained word sentiment already imported         // POST: For all tweets in v, tweet annotated with predicted sentiment         //         based on count of sentiment words in sentWords         // TODO     }     /*      * functions for inverse index      *       */          public Map<>> importInverseIndexFromFile (String fInName) throws IOException {         // PRE: -         // POST: Read in and returned contents of file as inverse index         //         invIndex has words w as key, IDs of tweets that contain w as value         // TODO                  return null;     }     /*      * functions for graph construction       */          public void constructSharedWordGraph(Map<>> invIndex) {         // PRE: invIndex has words w as key, IDs of tweets that contain w as value         // POST: Graph constructed, with tweets as vertices,          //         and edges between them if they share a word         // TODO     }     public Integer numConnectedComponents() {         // PRE: -         // POST: Returns the number of connected components                  // TODO                  return null;     }          public void annotateConnectedComponents() {         // PRE: -         // POST: Annotates graph so that it is partitioned into components                  // TODO          }          public Integer componentSentLabelCount(String ID, Polarity p) {         // PRE: Graph components are identified, ID is a valid tweet         // POST: Returns count of labels corresponding to Polarity p in component containing ID         // TODO                  return null;     }     public void propagateLabelAcrossComponent(String ID
May 18, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here