diff options
author | github-classroom[bot] <66690702+github-classroom[bot]@users.noreply.github.com> | 2023-12-10 19:07:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-10 19:07:21 +0000 |
commit | cb491e82b5ce3dcb7e3c41973a46cb7dcbaa9008 (patch) | |
tree | c9c6a81111803facc4e3b677e394495cea696bc0 /InvertedIndex.java |
Initial commit
Diffstat (limited to 'InvertedIndex.java')
-rw-r--r-- | InvertedIndex.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/InvertedIndex.java b/InvertedIndex.java new file mode 100644 index 0000000..bc75ba6 --- /dev/null +++ b/InvertedIndex.java @@ -0,0 +1,56 @@ +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import mapreduce.MapReduce; + +public class InvertedIndex { + + public Map<String, List<String>> run(List<String> filenames) { + List<Document> inputs = new LinkedList<>(); + for (String filename : filenames) { + inputs.add(new Document(filename, FileParser.parse(filename))); + } + // TODO: instantiate a MapReduce object with correct input, key, value, and output types + + // TODO: set the mapper and reducer suppliers, and set the inputs + + // TODO: execute the MapReduce object and return the result + + throw new UnsupportedOperationException("InvertedIndex.run() not implemented yet."); + } + + class Document { + + String name; + List<String> words; + + public Document(String name, List<String> words) { + this.name = name; + this.words = words; + } + + } + + class Mapper + extends mapreduce.Mapper<Document, String, String> { + + @Override + public Map<String, String> compute() { + // TODO: implement the Map function for inverted index + throw new UnsupportedOperationException("InvertedIndex map function not implemented yet."); + } + + } + + class Reducer + extends mapreduce.Reducer<String, String, List<String>> { + + @Override + public List<String> compute() { + // TODO: implement the Reduce function for inverted index + throw new UnsupportedOperationException("InvertedIndex reduce function not implemented yet."); + } + } + +} |