/** * Creates an instance of the class. The generated data structures * will be saved in the given path. The of the data is given by the prefix * parameter. * @param _path String the path where the generated data structures will be saved. * @param _prefix String the filename that the data structures will have. */ public Indexer(String _path, String _prefix) { this.fileNameNoExtension = ApplicationSetup.makeAbsolute(_prefix, _path); this.prefix = _prefix; this.path = _path; }
/** * Construct a SimpleXMLCollection */ public SimpleXMLCollection() { this(ApplicationSetup.COLLECTION_SPEC, ApplicationSetup.makeAbsolute( ApplicationSetup.getProperty("xml.blacklist.docids", ""), ApplicationSetup.TERRIER_ETC)); }
public TRECCollection(String collSpec) { this( collSpec, TagSet.TREC_DOC_TAGS, ApplicationSetup.makeAbsolute( ApplicationSetup.getProperty("trec.blacklist.docids", ""), ApplicationSetup.TERRIER_ETC), ApplicationSetup.makeAbsolute( ApplicationSetup.getProperty("trec.collection.pointers", "docpointers.col"), ApplicationSetup.TERRIER_INDEX_PATH) ); }
/** * Construct a SimpleXMLCollection */ public SimpleXMLCollection() { this(ApplicationSetup.COLLECTION_SPEC, ApplicationSetup.makeAbsolute( ApplicationSetup.getProperty("xml.blacklist.docids", ""), ApplicationSetup.TERRIER_ETC)); }
/** * Returns true if it is likely that an index exists at the specified * location * * @param path * @param prefix * @return true if a .properties or a .log files exists */ public static boolean existsIndex(String path, String prefix) { if (!(new File(path)).isAbsolute()) path = ApplicationSetup.makeAbsolute(path, ApplicationSetup.TERRIER_VAR); return allExists(path + ApplicationSetup.FILE_SEPARATOR + prefix + PROPERTIES_SUFFIX) /* * || allExists(path + ApplicationSetup.FILE_SEPARATOR + prefix + * LOG_SUFFIX) */; }
/** * Returns true if it is likely that an index exists at the specified * location * * @param path * @param prefix * @return true if a .properties or a .log files exists */ public static boolean existsIndex(String path, String prefix) { if (!(new File(path)).isAbsolute()) path = ApplicationSetup.makeAbsolute(path, ApplicationSetup.TERRIER_VAR); return allExists(path + ApplicationSetup.FILE_SEPARATOR + prefix + PROPERTIES_SUFFIX) /* * || allExists(path + ApplicationSetup.FILE_SEPARATOR + prefix + * LOG_SUFFIX) */; }
protected static Collection loadCollection(List<String> files) { //load the appropriate collection final String collectionName = ApplicationSetup.getProperty("trec.collection.class", "TRECCollection"); Class<?>[] constructerClasses = {List.class,String.class,String.class,String.class}; Object[] constructorValues = {files,TagSet.TREC_DOC_TAGS, ApplicationSetup.makeAbsolute( ApplicationSetup.getProperty("trec.blacklist.docids", ""), ApplicationSetup.TERRIER_ETC), ApplicationSetup.makeAbsolute( ApplicationSetup.getProperty("trec.collection.pointers", "docpointers.col"), ApplicationSetup.TERRIER_INDEX_PATH) }; Collection rtr = CollectionFactory.loadCollection(collectionName, constructerClasses, constructorValues); if (rtr == null) { throw new IllegalArgumentException("Collection class named "+ collectionName + " not loaded, aborting"); } return rtr; }
protected Collection loadCollection(String collectionSpec) { //load the appropriate collection final String collectionName = ApplicationSetup.getProperty("trec.collection.class", "TRECCollection"); Class<?>[] constructerClasses = {String.class,String.class,String.class,String.class}; String[] constructorValues = {collectionSpec,TagSet.TREC_DOC_TAGS, ApplicationSetup.makeAbsolute( ApplicationSetup.getProperty("trec.blacklist.docids", ""), ApplicationSetup.TERRIER_ETC), ApplicationSetup.makeAbsolute( ApplicationSetup.getProperty("trec.collection.pointers", "docpointers.col"), ApplicationSetup.TERRIER_INDEX_PATH) }; Collection rtr = CollectionFactory.loadCollection(collectionName, constructerClasses, constructorValues); if (rtr == null) { throw new IllegalArgumentException("Collection class named "+ collectionName + " not loaded, aborting"); } return rtr; }
if (filename == null) throw new IllegalArgumentException("For "+FatFeaturedScoringMatching.class+", property "+property+"file is not set"); filename = ApplicationSetup.makeAbsolute(filename, ApplicationSetup.TERRIER_ETC); String line = null; final BufferedReader br = Files.openFileReader(filename);
if (filename == null) throw new IllegalArgumentException("For "+FatFeaturedScoringMatching.class+", property "+property+"file is not set"); filename = ApplicationSetup.makeAbsolute(filename, ApplicationSetup.TERRIER_ETC); String line = null; final BufferedReader br = Files.openFileReader(filename);
"trec.results.file", null); if (theFilename != null) { theFilename = ApplicationSetup.makeAbsolute(theFilename, ApplicationSetup.TREC_RESULTS); _resultFile = new PrintWriter(new BufferedWriter(
"trec.results.file", null); if (theFilename != null) { theFilename = ApplicationSetup.makeAbsolute(theFilename, ApplicationSetup.TREC_RESULTS); _resultFile = new PrintWriter(new BufferedWriter(
stopwordsFilename = ApplicationSetup.makeAbsolute(stopwordsFilename, ApplicationSetup.TERRIER_SHARE);
stopwordsFilename = ApplicationSetup.makeAbsolute(stopwordsFilename, ApplicationSetup.TERRIER_SHARE);
TERRIER_ETC = makeAbsolute( getProperty("terrier.etc","etc"), TERRIER_HOME); TERRIER_VAR = makeAbsolute( getProperty("terrier.var","var"), TERRIER_HOME); TERRIER_SHARE = makeAbsolute( getProperty("terrier.share", "share"), TERRIER_HOME); TERRIER_INDEX_PATH = makeAbsolute(getProperty("terrier.index.path", "index"), TERRIER_VAR); TERRIER_INDEX_PREFIX = getProperty("terrier.index.prefix", "data"); TREC_RESULTS = makeAbsolute(getProperty("trec.results", "results"), TERRIER_VAR); TREC_RESULTS_SUFFIX = getProperty("trec.results.suffix", ".res"); COLLECTION_SPEC = makeAbsolute(getProperty("collection.spec", "collection.spec"), TERRIER_ETC);
TERRIER_ETC = makeAbsolute( getProperty("terrier.etc","etc"), TERRIER_HOME); TERRIER_VAR = makeAbsolute( getProperty("terrier.var","var"), TERRIER_HOME); TERRIER_SHARE = makeAbsolute( getProperty("terrier.share", "share"), TERRIER_HOME); TERRIER_INDEX_PATH = makeAbsolute(getProperty("terrier.index.path", "index"), TERRIER_VAR); TERRIER_INDEX_PREFIX = getProperty("terrier.index.prefix", "data"); TREC_RESULTS = makeAbsolute(getProperty("trec.results", "results"), TERRIER_VAR); TREC_RESULTS_SUFFIX = getProperty("trec.results.suffix", ".res"); COLLECTION_SPEC = makeAbsolute(getProperty("collection.spec", "collection.spec"), TERRIER_ETC);
/** * A constructor that reads only the document in the specificed * InputStream. Also reads a list of blacklisted document numbers, specified by the * property <tt>trec.blacklist.docids</tt> and opens the * first collection file to process. */ public TRECCollection(InputStream input) { super(input instanceof CountingInputStream ? (CountingInputStream)input : new CountingInputStream(input)); loadDocumentClass(); setTags(TagSet.TREC_DOC_TAGS); readDocumentBlacklist(ApplicationSetup.makeAbsolute( ApplicationSetup.getProperty("trec.blacklist.docids", ""), ApplicationSetup.TERRIER_ETC)); documentsInThisFile = 0; } /**
super(0l, 0l, 0l); if (!(new File(_path)).isAbsolute()) _path = ApplicationSetup.makeAbsolute(_path, ApplicationSetup.TERRIER_VAR);
super(0l, 0l, 0l); if (!(new File(_path)).isAbsolute()) _path = ApplicationSetup.makeAbsolute(_path, ApplicationSetup.TERRIER_VAR);