Class Hotel

java.lang.Object
com.articulate.sigma.dataProc.Hotel

public class Hotel extends Object
  • Field Details

  • Constructor Details

    • Hotel

      public Hotel()
  • Method Details

    • asCSV

      public String asCSV()
    • asCSVHeader

      public static String asCSVHeader()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addConceptSentiment

      public void addConceptSentiment(Map<String,Integer> conceptSent)
    • printAllHotels

      public static String printAllHotels(List<Hotel> hotels)
    • printAllHotelAmenitySentiment

      public static void printAllHotelAmenitySentiment(List<Hotel> hotels)
    • setHotelWeights

      public static void setHotelWeights(List<Hotel> hotels)
      Read a list of lists of Strings which is the original input plus some extra columns for the weights of several "buckets", indicating fitness with respect to a particular criterion. Result is a side effect of setting the bucket weights for the hotels.
    • HotelDBImport

      public static List<Hotel> HotelDBImport(boolean w)
      Parameters:
      w - states whether to write SUMO statements
    • generateSUMOHeader

      public static List<String> generateSUMOHeader(List<Hotel> hotels)
      Collect all possible column names and assign them a number, then sort on that frequency.
    • generateSUMOColumns

      public static List<String> generateSUMOColumns(Hotel h, List<String> SUMOheader)
    • readXMLHotels

      public static List<Hotel> readXMLHotels(String fname)
      Convert a particular XML markup into an array of hotels
    • processOneXMLHotel

      public static Hotel processOneXMLHotel(Element e)
      Parameters:
      e - is a DOM element for one hotel
      Returns:
      a Hotel
    • readCSVHotels

      public static List<Hotel> readCSVHotels(String fname)
    • parseHTMLAddress

      public static void parseHTMLAddress(Hotel h, String addr)
      Set address fields in the hotel as a side effect. 1734 South Harbor Blvd., Anaheim, CA 92802
    • parseOneHotelReviewFile

      public static Hotel parseOneHotelReviewFile(String fname)
      Parameters:
      fname - has no file extension or directory
    • parseOneHotelPreviewFile

      public static Hotel parseOneHotelPreviewFile(String fname)
      Parameters:
      fname - has no file extension or directory
    • parseAllHotelReviewFiles

      public static ArrayList<Hotel> parseAllHotelReviewFiles(String fname)
      Read hotel review files
      Returns:
      an ArrayList of Hotel
    • parseOneTHotelReviewFile

      public static Hotel parseOneTHotelReviewFile(String fname)
    • parseAllTHotelReviewFiles

      public static ArrayList<Hotel> parseAllTHotelReviewFiles(String fname)
      Read hotel review files
      Parameters:
      fname - is the directory path where the reviews are
      Returns:
      an ArrayList of Hotel
    • matchHotels

      public static void matchHotels(Hotel feedHotel, Hotel reviewsHotel)
    • mergeHotels

      public static void mergeHotels(ArrayList<Hotel> feed, ArrayList<Hotel> reviews)
    • addAllSenses

      public void addAllSenses(Map<String,Integer> wnsenses)
    • hotelReviewSUMOasSparseMatrix

      public static ArrayList<ArrayList<String>> hotelReviewSUMOasSparseMatrix(ArrayList<Hotel> feed)
      Parameters:
      feed - is an ArrayList of Hotel containing the raw data about hotels
      Returns:
      a list of hotels expressed as a list of string values for several fields and then a count of SUMO terms appearing in the review for the given hotel
    • hotelReviewSUMOSentimentAsSparseMatrix

      public static ArrayList<ArrayList<String>> hotelReviewSUMOSentimentAsSparseMatrix(ArrayList<Hotel> feed, boolean write)
      Parameters:
      feed - is an ArrayList of Hotel containing the raw data about hotels
      Returns:
      a list of hotels expressed as a list of string values for several fields and then a count of SUMO terms appearing in the review for the given hotel
    • processOneOXMLHotel

      public static Hotel processOneOXMLHotel(Element h)
      Parameters:
      h - is a DOM element for one hotel
      Returns:
      a map of column name and column value
    • readOXMLhotels

      public static ArrayList<Hotel> readOXMLhotels(String fname)
    • parseJSONPair

      public static int parseJSONPair(String s, int ind, Hotel.JSONElement js)
      This routine adds keys and values to the parameter. There are three possibilities: - string key : string value - string key : integer value - string key : [list]
      Returns:
      the string index
    • parseJSONElement

      public static int parseJSONElement(String s, int ind, Hotel.JSONElement js)
      This routine adds elements to the parameter
      Returns:
      the string index
    • convertJSON2Hotel

      public static Hotel convertJSON2Hotel(Hotel.JSONElement js)
    • parseOneJSONReviewFile

      public static Hotel parseOneJSONReviewFile(String fname)
    • normalizeSentiment

      public static String normalizeSentiment(String value)
    • writeHotelAsXML

      public static void writeHotelAsXML(Hotel h, PrintWriter pw)
    • readJSONHotels

      public static ArrayList<Hotel> readJSONHotels(String dir, boolean writeIncremental)
      Parameters:
      writeIncremental - means that each hotel review will be processed and each spreadsheet line will be written after reading each hotel.
    • hotelSentiment

      public static void hotelSentiment(ArrayList<Hotel> hotels)
    • oneHotelAmenitySentiment

      public static void oneHotelAmenitySentiment(Hotel h)
      Compute concept sentiment and store as a side effect.
    • hotelAmenitySentiment

      public static void hotelAmenitySentiment(List<Hotel> hotels)
      Compute concept sentiment and store as a side effect.
    • execJSON

      public static void execJSON(String path)
    • main

      public static void main(String[] args)