/** * {@inheritDoc} */ @Override public TemporalDataModelIF<Long, Long> parseTemporalData(final File f) throws IOException { return parseData(f, "\t", true); }
/** * Parses a data file with a specific separator between fields. * * @param f The file to be parsed. * @param token The separator to be used. * @param isTemporal A flag indicating if the file contains temporal * information. * @return A dataset created from the file. * @throws IOException if the file cannot be read. */ public TemporalDataModelIF<Long, Long> parseData(final File f, final String token, final boolean isTemporal) throws IOException { TemporalDataModelIF<Long, Long> dataset = DataModelFactory.getDefaultTemporalModel(); BufferedReader br = SimpleParser.getBufferedReader(f); String line = br.readLine(); if ((line != null) && (!line.matches(".*[a-zA-Z].*"))) { parseLine(line, dataset, token, isTemporal); } while ((line = br.readLine()) != null) { parseLine(line, dataset, token, isTemporal); } br.close(); return dataset; }
DataModelIF<Long, Long> trainingModel = new SimpleParser().parseData(trainingFile); System.out.println("Parsing finished: training file"); System.out.println("Parsing started: test file"); File testFile = new File(properties.getProperty(TEST_FILE)); DataModelIF<Long, Long> testModel = new SimpleParser().parseData(testFile); System.out.println("Parsing finished: test file");
/** * Read a user/item mapping (user/item original value, user/item internal * id) from a file and return the maximum index number in that file. * * @param in The file with id mapping. * @param map The user/item mapping * @return The largest id number. * @throws IOException if file does not exist. */ public static long getIndexMap(final File in, final Map<String, Long> map) throws IOException { long id = 0; if (in.exists()) { BufferedReader br = SimpleParser.getBufferedReader(in); String line; while ((line = br.readLine()) != null) { String[] toks = line.split("\t"); long i = Long.parseLong(toks[1]); map.put(toks[0], i); id = Math.max(i, id); } br.close(); } return id + 1; }
DataModelIF<Long, Long> recModel; try { trainingModel = new SimpleParser().parseData(trainingFile); testModel = new SimpleParser().parseData(testFile); recModel = new SimpleParser().parseData(recFile); } catch (IOException e) { e.printStackTrace();
/** * {@inheritDoc} */ @Override public TemporalDataModelIF<Long, Long> parseTemporalData(final File f) throws IOException { TemporalDataModelIF<Long, Long> dataset = DataModelFactory.getDefaultTemporalModel(); BufferedReader br = SimpleParser.getBufferedReader(f); String line; while ((line = br.readLine()) != null) { parseLine(line, dataset); } br.close(); return dataset; }
DataModelIF<Long, Long> recModel; try { trainingModel = new SimpleParser().parseData(trainingFile); testModel = new SimpleParser().parseData(testFile); recModel = new SimpleParser().parseData(recFile); } catch (IOException e) { e.printStackTrace();
/** * {@inheritDoc} */ @Override public DataModelIF<Long, Long> parseData(final File f) throws IOException { return parseData(f, "\t", false); }
long curItem = getIndexMap(new File(mapIdsPrefix + "_itemId.txt"), mapItemIds); BufferedReader br = SimpleParser.getBufferedReader(f); String line; while ((line = br.readLine()) != null) {
DataModelIF<Long, Long> trainingModel = new SimpleParser().parseData(trainingFile); System.out.println("Parsing finished: training file"); System.out.println("Parsing started: test file"); File testFile = new File(properties.getProperty(TEST_FILE)); DataModelIF<Long, Long> testModel = new SimpleParser().parseData(testFile); System.out.println("Parsing finished: test file");
long curItem = getIndexMap(new File(mapIdsPrefix + "_itemId.txt"), mapItemIds); BufferedReader br = SimpleParser.getBufferedReader(f); String line; while ((line = br.readLine()) != null) {
DataModelIF<Long, Long> recModel; try { trainingModel = new SimpleParser().parseData(trainingFile); testModel = new SimpleParser().parseData(testFile); recModel = new SimpleParser().parseData(recFile); } catch (IOException e) { e.printStackTrace();
new SimpleParser().parseData(new File(inFile), delimiter, isTemporalData));
predictions = new SimpleParser().parseData(recommendationFile); break; case TRECEVAL: System.out.println("Parsing started: test file"); File testFile = new File(properties.getProperty(TEST_FILE)); DataModelIF<Long, Long> testModel = new SimpleParser().parseData(testFile); System.out.println("Parsing finished: test file");
DataModelIF<Long, Long> recModel; try { trainingModel = new SimpleParser().parseData(trainingFile); testModel = new SimpleParser().parseData(testFile); recModel = new SimpleParser().parseData(recFile); } catch (IOException e) { e.printStackTrace();
DataModelIF<Long, Long> recModel = null; try { trainingModel = new SimpleParser().parseData(trainingFile); testModel = new SimpleParser().parseData(testFile); recModel = new SimpleParser().parseData(recFile); } catch (IOException e) { e.printStackTrace();
DataModelIF<Long, Long> testModel = new SimpleParser().parseData(testFile); System.out.println("Parsing finished: test file"); switch (recFormat) { case SIMPLE: predictions = new SimpleParser().parseData(predictionFile); break; case TRECEVAL:
File trainingFile = new File(split + trainingSuffix); System.out.println("Parsing started: training file" + trainingFile); DataModelIF<Long, Long> trainingModel = new SimpleParser().parseData(trainingFile); System.out.println("Parsing finished: training file "); File testFile = new File(split + testSuffix); System.out.println("Parsing started: test file" + testFile); DataModelIF<Long, Long> testModel = new SimpleParser().parseData(testFile); System.out.println("Parsing finished: test file"); Set<String> recommendationFiles = new HashSet<String>();
DataModelIF<Long, Long> recModel = null; try { testModel = new SimpleParser().parseData(testFile); recModel = new SimpleParser().parseData(recFile); } catch (IOException e) { e.printStackTrace();
DataModelIF<Long, Long> recModel = null; try { testModel = new SimpleParser().parseData(testFile); recModel = new SimpleParser().parseData(recFile); } catch (IOException e) { e.printStackTrace();