Skip to content

Commit

Permalink
fix javadoc complain
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurChen189 committed May 7, 2023
1 parent cc73567 commit ca827a3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ protected TokenStreamComponents createComponents(String fieldName) {

/**
* Tokenizes a String Object
* @param reader
* @return
* @throws IOException
* @param reader String Object
* @return Reader
* @throws IOException IOException
*/
public Reader tokenizeReader(Reader reader) throws IOException {
String targetString = IOUtils.toString(reader);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/anserini/eval/RelevanceJudgments.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private static String getCacheDir() {
*
* @param qrelsPath path to qrels file
* @return qrels file as a string
* @throws IOException
* @throws IOException if qrels file is not found
*/
public static String getQrelsResource(Path qrelsPath) throws IOException {
Path resultPath = qrelsPath;
Expand Down Expand Up @@ -181,7 +181,7 @@ public static Path getNewQrelAbsPath(Path qrelsPath) {
*
* @param qrelsPath path to qrels file
* @return path to qrels file
* @throws IOException
* @throws IOException if qrels file is not found
*/
public static Path downloadQrels(Path qrelsPath) throws IOException {
String qrelsURL = CLOUD_PATH + qrelsPath.getFileName().toString().toString();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/anserini/search/SimpleImpactSearcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public SimpleImpactSearcher(String indexDir) throws IOException {
Path indexPath = Paths.get(indexDir);

if (!Files.exists(indexPath) || !Files.isDirectory(indexPath) || !Files.isReadable(indexPath)) {
throw new IllegalArgumentException(indexDir + " does not exist or is not a directory.");
throw new IOException(indexDir + " does not exist or is not a directory.");
}

this.reader = DirectoryReader.open(FSDirectory.open(indexPath));
Expand All @@ -126,9 +126,8 @@ public SimpleImpactSearcher(String indexDir) throws IOException {
/**
* Sets the query encoder
*
* @param queryEncoder the query encoder
* @param encoder the query encoder
* @throws IOException if errors encountered during initialization
* @return the query encoder
*/
public void set_onnxQueryEncoder(String encoder) {
if (empty_encoder()) {
Expand Down Expand Up @@ -235,6 +234,7 @@ public Map<String, Result[]> batch_search(List<Map<String, Float>> queries,
* Encodes the query using the onnx encoder
*
* @param queryString query string
* @throws OrtException if errors encountered during encoding
* @return encoded query
*/
public Map<String, Float> encode_with_onnx(String queryString) throws OrtException {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/io/anserini/search/SimpleSearcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ public void set_rocchio(String collectionClass) {
* @param beta weight to assign to the relevant document vectors
* @param gamma weight to assign to the nonrelevant document vectors
* @param outputQuery flag to print original and expanded queries
* @param useNegative flag to use negative feedback
*/
public void set_rocchio(String collectionClass, int topFbTerms, int topFbDocs, int bottomFbTerms, int bottomFbDocs, float alpha, float beta, float gamma, boolean outputQuery, boolean useNegative) {
Class clazz = null;
Expand Down Expand Up @@ -797,6 +798,7 @@ public Document doc(String docid) {
* Batch version of {@link #doc(String)}.
*
* @param docids list of docids
* @param threads number of threads to use
* @return a map of docid to corresponding Lucene {@link Document}
*/
public Map<String, Document> batch_get_docs(List<String> docids, int threads) {
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/io/anserini/search/topicreader/TopicReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public SortedMap<K, Map<String, String>> read(String str) throws IOException {
*
* @param topics topics
* @param <K> type of topic id
* @throws IOException if error encountered reading topics
* @return evaluation topics
*/
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -171,7 +172,7 @@ public static <K> SortedMap<K, Map<String, String>> getTopicsByFile(String file)
*
* @param topics topics
* @return evaluation topics, with strings as topic ids
* @throws IOException
* @throws IOException if error encountered reading topics
*/
public static Map<String, Map<String, String>> getTopicsWithStringIds(Topics topics) throws IOException {
SortedMap<?, Map<String, String>> originalTopics = getTopics(topics);
Expand Down Expand Up @@ -226,9 +227,9 @@ private static String getCacheDir() {

/**
* Downloads the topics from the cloud and returns the path to the local copy
* @param topicPath
* @param topicPath Path to the topics
* @return Path to the local copy of the topics
* @throws IOException
* @throws IOException if error encountered downloading topics
*/
public static Path getTopicsFromCloud(Path topicPath) throws IOException{
String topicURL = CLOUD_PATH + topicPath.getFileName().toString();
Expand All @@ -249,9 +250,9 @@ public static Path getNewTopicsAbsPath(Path topicPath){

/**
* Returns the path to the topic file. If the topic file is not in the list of known topics, we assume it is a local file.
* @param topicPath
* @return
* @throws IOException
* @param topicPath Path to the topic file
* @return Path to the topic file
* @throws IOException if error encountered reading topics
*/
public static Path getTopicPath(Path topicPath) throws IOException{
if (Files.exists(topicPath)) {
Expand Down

0 comments on commit ca827a3

Please # to comment.