















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















The usual unit for indexing is the word
Remember Heaps Law : In 1 GB text collection the size of
a vocabulary is only 5 MB (Baeza-Yates and Ribeiro-Neto,
This size may be further reduced by Linguistic pre-
processing (like stemming & other normalization
methods).
Building Index file
An index file of a document is a file consisting of a list of index terms
and a link to one or more documents that have the index term
to a set of documents D i
that contain
the keyword
Index file usually has index terms in a sorted order.
For organizing index file for a collection of documents, there are
various options available:
inverted file, suffix array, signature file, etc.?
Our focus during IR system design:
The concern here is retrieving more relevant documents
for users query
Effectiveness of the system is measured in terms of
precision, recall, …
Main emphasis: Stemming, stopwords removal, weighting
schemes, matching algorithms
The concern here is reducing storage space requirement,
enhancing searching time, indexing time, access time…
Main emphasis: Compression, indexing structures, space
efficiency of the system can be
measured by(Index file Evaluation Metrics):
represent the text in fewer bits or bytes such that
the file size is reduced
Save storage space requirement.
Speed up document transmission time
Takes less time to search the compressed text
Consumes computational resources (both memory space
and processor running time)
on frequency of occurrence of letters in
text documents
each time two symbols (with the
smallest frequency) to combine
3
4
1
2
Codewor
d
D 1
D 2
D 3
Developed in 1950s by David Huffman, widely used for text
compression, multimedia codec and message transmission
The problem : Given a set of n symbols and their
weights (or frequencies), construct a tree structure (a
binary tree for binary code) with the objective of
reducing memory space & decoding time per symbol.
How to construct Huffman coding?
Step 1 : Create forest of trees for each symbol, t
1
, t
2
,… t
n
Step 2 : WHILE more than one tree exist DO
Sort forest of trees according to falling probabilities of symbol
occurrence
Merge two trees t 1
and t 2
with least probabilities p 1
and p 2
Label their root with sum p 1
Associate binary code: 1 with the right branch and 0 with the
left branch
Step 3 : Create a unique codeword for each symbol by
traversing the tree from the root to the leaf.
Concatenate all encountered 0s and 1s together during
traversal
symbols in its leaf node.
d f
g
1
c
a b
e
How it could be if I change the position of the term or symbol g or e?
an optimal binary code:
“for each rose, a rose is a rose”
Compress the above text at word level using Huffman
coding
Character: a b c d e
t
Frequency: 16 5 12 17 10 25
1
n-
n
.
The prefix of a pattern consists of all the pattern symbols
except the last: C
0
C
1
... C
n-
Lempel-Ziv Output: there are three options in assigning a
code to each symbol in the list:-
(dictionaryPrefixIndex, lastPatternSymbol)
asign (dictionaryPrefixIndex, )
Example: LZ Compression
Encode (i.e., compress) the string ABBCBCABABCAABCAAB
using the LZ algorithm.
The compressed message is: 0A0B2C3A2A4A6B
LZ77 algorithms achieve compression by replacing
repeated occurrences of data with references to a single
copy of that data existing earlier in the uncompressed
a : identifies how far back in the decoded text to look
for the upcoming text segment
b : tells how many characters to copy for the
upcoming segment
c : a new character to add to complete the next
segment
LZ77 compression example
peter_piper_pick
ed
<0,0,p>
p eter_piper_picke
d
<0,0,e>
pe ter_piper_picked <0,0,t>
pet er_piper_picked <2,1,r>
peter piper_picked <0,0,>
peter_ piper_picked <6,1,i>
peter_pi per_picked <8,2,r>
peter_piper _picked <6,3,c>
peter_piper_pic Ked <0,0,k>