The map-reduce framework is quite useful for creating inverted indices on a setof documents. An inverted index stores for each word a list of all documentIDs that it appears in (offsets in the documents are also normally stored, butwe shall ignore them in this question).For example, if the input document IDs and contents are as follows:1: data clean2: data base3: clean basethen the inverted lists woulddata: 1, 2clean: 1, 3base: 2, 3Give pseudocode for map and reduce functions to create inverted indices on agiven set of files (each file is a document).Assume the document IDis availableusing a function context.getDocumentID(), and the map function is invokedonce per line of the document. The output inverted list for each word should bea list of document IDs separated by commas. The document IDs are normallysorted, but for the purpose of this question you do not need to bother to sortthem.
The map-reduce framework is quite useful for creating inverted indices on a setof documents. An inverted index stores for each word a list of all documentIDs that it appears in (offsets in the documents are also normally stored, butwe shall ignore them in this question).For example, if the input document IDs and contents are as follows:1: data clean2: data base3: clean basethen the inverted lists woulddata: 1, 2clean: 1, 3base: 2, 3Give pseudocode for map and reduce functions to create inverted indices on agiven set of files (each file is a document).Assume the document IDis availableusing a function context.getDocumentID(), and the map function is invokedonce per line of the document. The output inverted list for each word should bea list of document IDs separated by commas. The document IDs are normallysorted, but for the purpose of this question you do not need to bother to sortthem.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
The map-reduce framework is quite useful for creating inverted indices on a set of documents. An inverted index stores for each word a list of all document IDs that it appears in (offsets in the documents are also normally stored, but we shall ignore them in this question). For example, if the input document IDs and contents are as follows: 1: data clean 2: data base 3: clean base then the inverted lists would data: 1, 2 clean: 1, 3 base: 2, 3 Give pseudocode for map and reduce functions to create inverted indices on a given set of files (each file is a document).Assume the document IDis available using a function context.getDocumentID(), and the map function is invoked once per line of the document. The output inverted list for each word should be a list of document IDs separated by commas. The document IDs are normally sorted, but for the purpose of this question you do not need to bother to sort them. |
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education