public class DB extends Object
| Modifier and Type | Field and Description |
|---|---|
static HashSet<String> |
amenityTerms |
static HashMap<String,HashMap<String,String>> |
sentiment |
static HashSet<String> |
stopConcepts |
| Constructor and Description |
|---|
DB() |
| Modifier and Type | Method and Description |
|---|---|
static HashMap<String,Integer> |
addConceptSentimentScores(HashMap<String,Integer> scores,
String SUMOs,
int total)
Add new scores to existing scores.
|
static HashMap<String,Integer> |
computeConceptSentiment(String input)
Associate individual concepts with a sentiment score
|
static HashMap<String,Integer> |
computeConceptSentimentFromFile(String filename)
Associate individual concepts with a sentiment score
|
static int |
computeSentiment(String input)
Calculate an integer sentiment value for a string of words.
|
static int |
computeSentimentForWord(String word)
Find the sentiment value for a given word, after finding the root
form of the word.
|
static void |
DiningDBImport() |
static void |
disambigReviews(ArrayList<Hotel> hotels) |
static boolean |
emptyString(String input) |
void |
exportTable(KB kb)
Export a comma-delimited table of all the ground binary
statements in the knowledge base.
|
static ArrayList<String> |
fill(String value,
int count) |
void |
generateDB(KB kb)
Generate an SQL database from the knowledge base
Tables must be defined as instances of &%DatabaseTable and
must have &%localDocumentation and &%HasDatabaseColumn
relations.
|
static ArrayList<String> |
geocode(String address)
Call Google's geocode API to convert an address string into a
lat/lon, which is returned as an ArrayList of two String elements
containing a real-number format latitude and longitude.
|
static HashSet<String> |
getAllRest() |
static ArrayList<String> |
getFoodWordSenses(ArrayList<String> al) |
static ArrayList<String> |
getWordSenses(ArrayList<String> al) |
static void |
guessGender(String fname) |
static void |
main(String[] args)
A test method
|
static String |
parseCuisines(String cuisine,
String RST_RESTAURANTNAME,
String RST_RESTAURANTID) |
static HashSet<String> |
parseOneRestFile(String fname)
A test method.
|
static HashSet<String> |
parseRest(String menu,
String placename,
String price,
String address,
String latitude,
String longitude,
String phone) |
void |
printSpreadsheet(TreeMap rows,
ArrayList relations)
Print a comma-delimited matrix.
|
static String |
printTopSUMOInReviews(ArrayList<AVPair> topSUMO) |
HashMap |
printTPTPDataInCSV(HashMap byProver)
Print statistics in a summary form for TPTP test run
data
|
static String |
processTimeDate(String timeDate) |
HashMap |
processTPTPData()
Read statistics for TPTP test run data
|
static void |
readAmenities() |
static ArrayList<ArrayList> |
readDataInterchangeFormatFile(Reader inReader)
Parse an input stream Reader from a Data Interchange Format
(.dif) file into an ArrayList of ArrayLists.
|
static ArrayList<ArrayList> |
readDataInterchangeFormatFile(String fname)
Parse and load a Data Interchange Format (.dif) file into an
ArrayList of ArrayLists.
|
static void |
readSentimentArray()
Fill out from a CSV file a map of word keys, and values broken down by POS,
listing whether it's a positive or negative word interior hash map keys are
type, POS, stemmed, polarity
|
static ArrayList<ArrayList<String>> |
readSpreadsheet(Reader inReader,
List<String> lineStartTokens,
boolean quote,
char delimiter)
Parse the input from a Reader for a CSV file into an ArrayList
of ArrayLists.
|
static ArrayList<ArrayList<String>> |
readSpreadsheet(String fname,
List lineStartTokens,
boolean quote) |
static ArrayList<ArrayList<String>> |
readSpreadsheet(String fname,
List lineStartTokens,
boolean quote,
char delimiter)
Parse a CSV file into an ArrayList of ArrayLists.
|
static HashMap<String,String> |
readStateAbbrevs() |
static void |
readStopConceptArray()
Fill out from a CSV file a set of concepts that should be ignored
during content extraction
|
static void |
RearDBtoKIF() |
HashMap |
resortTPTPData(HashMap stats)
Reorganize statistics in a summary form for TPTP test run
data
|
static void |
SUMOReviews(ArrayList<Hotel> reviews) |
static void |
testSentiment() |
static void |
testSentimentCorpus() |
static void |
textFileSentiment(String fname,
boolean neg)
Compute sentiment for each line of a text file and output as CSV.
|
static void |
textSentiment() |
static void |
textSentimentByPeriod() |
static ArrayList<AVPair> |
topSUMOInReviews(ArrayList<Hotel> reviews)
Excludes cases of where the mapping is to multiple SUMO terms
|
static HashMap<String,Integer> |
wordSensesInReviews(ArrayList<Hotel> reviews) |
static String |
wordWrap(String input,
int length) |
static String |
writeSpreadsheet(ArrayList<ArrayList<String>> values,
boolean quote) |
static String |
writeSpreadsheetLine(ArrayList<String> al,
boolean quote) |
static int |
writeSuoKifStatements(KB kb,
String sourceFilePath)
Writes to sourceFilePath all Formulae in kb that have
sourceFilePath as source file.
|
static int |
writeSuoKifStatements(Set statements,
PrintWriter pw) |
public HashMap printTPTPDataInCSV(HashMap byProver) throws IOException
IOExceptionpublic HashMap resortTPTPData(HashMap stats) throws IOException
IOExceptionpublic HashMap processTPTPData() throws IOException
IOExceptionpublic void generateDB(KB kb)
public static ArrayList<ArrayList<String>> readSpreadsheet(Reader inReader, List<String> lineStartTokens, boolean quote, char delimiter)
inReader - A reader for the file to be processedlineStartTokens - If a List containing String tokens, all
lines not starting with one of the tokens will be concatenatedquote - signifies whether to retain quotes in elementspublic static ArrayList<ArrayList<String>> readSpreadsheet(String fname, List lineStartTokens, boolean quote, char delimiter)
fname - The pathname of the CSV file to be processedlineStartTokens - If a List containing String tokens, all
lines not starting with one of the tokens will be concatenatedquote - signifies whether to retain quotes in elementspublic static ArrayList<ArrayList<String>> readSpreadsheet(String fname, List lineStartTokens, boolean quote)
public static String writeSpreadsheetLine(ArrayList<String> al, boolean quote)
quote - signifies whether to quote entries from the spreadsheetpublic static String writeSpreadsheet(ArrayList<ArrayList<String>> values, boolean quote)
quote - signifies whether to quote entries from the spreadsheetpublic static ArrayList<ArrayList> readDataInterchangeFormatFile(Reader inReader)
inReader - A reader created from the .dif file to be processedpublic static ArrayList<ArrayList> readDataInterchangeFormatFile(String fname)
fname - The pathname of the file to be processedpublic static int writeSuoKifStatements(Set statements, PrintWriter pw)
public static int writeSuoKifStatements(KB kb, String sourceFilePath)
kb - The KB from which Formulae will be writtensourceFilePath - The canonical pathname of the file to
which Formulae will be writtenpublic void printSpreadsheet(TreeMap rows, ArrayList relations)
rows - - the matrixrelations - - the relations that form the column headerpublic void exportTable(KB kb)
The - knowledge base.public static boolean emptyString(String input)
public static void RearDBtoKIF()
public static String parseCuisines(String cuisine, String RST_RESTAURANTNAME, String RST_RESTAURANTID)
public static ArrayList<AVPair> topSUMOInReviews(ArrayList<Hotel> reviews)
public static HashMap<String,Integer> wordSensesInReviews(ArrayList<Hotel> reviews)
public static void disambigReviews(ArrayList<Hotel> hotels)
an - ArrayList of Hotel with reviews as textpublic static HashMap<String,String> readStateAbbrevs()
w - states whether to write SUMO statementspublic static void DiningDBImport()
public static ArrayList<String> getWordSenses(ArrayList<String> al)
public static ArrayList<String> getFoodWordSenses(ArrayList<String> al)
public static HashSet<String> parseRest(String menu, String placename, String price, String address, String latitude, String longitude, String phone)
public static ArrayList<String> geocode(String address)
public static HashSet<String> parseOneRestFile(String fname)
fname - has no file extension or directorypublic static void readStopConceptArray()
public static void readSentimentArray()
public static int computeSentiment(String input)
public static int computeSentimentForWord(String word)
public static HashMap<String,Integer> addConceptSentimentScores(HashMap<String,Integer> scores, String SUMOs, int total)
public static HashMap<String,Integer> computeConceptSentimentFromFile(String filename)
public static HashMap<String,Integer> computeConceptSentiment(String input)
public static void readAmenities()
public static void textSentimentByPeriod()
public static void textSentiment()
public static void textFileSentiment(String fname, boolean neg)
public static void testSentiment()
public static void testSentimentCorpus()
public static void guessGender(String fname)
public static void main(String[] args)
Copyright © 2015. All rights reserved.