SlideShare a Scribd company logo
1 of 57
Download to read offline
Tomasz Korzeniowski
   tomek@polarrose.com
Information Retrieval
Retrieval strategies
• Vector Space Model
• Latent Semantic Indexing
• Probabilistic Retrieval Strategies
• Language Models
• Inference Networks
• Extended Boolean Retrieval
• Neural Networks
• Genetic Algorithms
• Fuzzy Set Retrieval
Vector space model
Text retrieval
Analysis
Tokenization
Stop-words
Stemming

Lemmatization
http://tartarus.org/~martin/
      PorterStemmer/
Document

 Term
Term frequency
r boost for a query on ferrari than the
 get from a query on insurance.
  entInversionof a term used to sca
      frequency df document
total number of documents in a corpu
             frequency follows:
 frequency (idf) of a term t as
                      N
           idft = log     .
                      dft
rare term is high, whereas the idf of a
ure 6.4 gives an example of idf’s in a co
g scheme assigns to term


 tf-idft,d = tft,d × idft .
ssigns to term t a weigh
Search
7 Vector space re

            6


                                      v(q)
                     
                      
                     
                          v(d2 )
                        B
                        ¨
                       ¨
                     ¨¨   v(d2 )
                         I
                    ¨   
                      
                   ¨
                 ¨¨ 
               ¨¨
              ¨
             ¨
                                             -
            ¨
            


             Cosine similarity illustrated.
igure 7.1
Q: “gold silver truck”

D1: “Shipment of gold damaged in a
fire”

D2: “Delivery of silver arrived in a
silver truck”

D3: “Shipment of gold arrived in a
truck”
TF

    a arrived damaged delivery   fire   gold   in of shipment silver truck

D1 1             1               1      1     11       1
         0               0                                     0     0


D2 1     1               1                    11               2
                 0               0      0              0             0


D3 1     1                              1     11       1             1
                 0       0       0                             0


                                        1                      1     1
Q   0    0       0       0       0            00       0
N
                 idft = log        .
                            dft
  •                        • of
area term is high, whereas 0the idf of
             0
    log 3/3 =                log 3/3 =



  • arrived                • silver
re 6.4 gives0.176 example of idf’s in a
                     an                0.477
            log 3/2 =            log 3/1 =



  • damaged                • shipment
ample logarithms are to the base 10.
                     0.477                0.176
                 log 3/1 =               log 3/2 =



  • delivery               • truck
                    0.477              0.176
                log 3/1 =        log 3/2 =



  • fire                    • gold
                0.477                 0.176
       log 3/1 =                log 3/2 =

 always finite?
  • in        0
     log 3/3 =
a arrived damaged delivery    fire   gold   in of shipment silver truck

                0.477            0.477 0.176 0 0      0.176
D1 0     0               0                                      0     0


        0.176           0.477                                 0.954 0.176
D2 0             0                0      0     00       0


        0.176                           0.176 0 0     0.176         0.176
D3 0             0       0        0                             0


                                        0.176 0 0             0.477 0.176
Q   0    0       0       0        0                     0
SC(Q,D1) = (0)(0)+(0)(0)+(0)(0.477)+(0)
(0)+(0)(0.477)+(0.176)(0.176)+(0)(0)+(0)
(0)+(0)(0.176)+(0.477)(0)+(0.176)(0)=
(0.176)(0.176) ⋲ 0.031
SC(Q,D2)=(0.954)(0.477)+(0.176)(0.176) ⋲ 0.486

SC(Q,D3)=(0.176)(0.176)+(0.176)(0.176) ⋲ 0.062
Inverted index
term - 1   (dn,1)    (d10,1)



term - 2   (dn,5)    (dn,3)



term - 3   (d2,11)   (d10,1)



term - 4   (dn,1)    (d2,1)



term - 5   (dn,2)    (d4,3)




term - n   (d6,1)    (d7,3)
Lucene
Analysis
Lucene includes several built-in analyzers. The primary ones are shown in table 4.2.
We’ll leave discussion of the two language-specific analyzers, RussianAnalyzer
and GermanAnalyzer, to section 4.8.2 and the special per-field analyzer wrapper,
PerFieldAnalyzerWrapper, to section 4.4.

Table 4.2   Primary analyzers available in Lucene

            Analyzer                                          Steps taken

                                Splits tokens at whitespace
  WhitespaceAnalyzer

                                Divides text at nonletter characters and lowercases
  SimpleAnalyzer

                                Divides text at nonletter characters, lowercases, and removes stop words
  StopAnalyzer

                                Tokenizes based on a sophisticated grammar that recognizes e-mail
  StandardAnalyzer
                                addresses, acronyms, Chinese-Japanese-Korean characters,
                                alphanumerics, and more; lowercases; and removes stop words



The built-in analyzers we discuss in this section—WhitespaceAnalyzer, Simple-
Analyzer, StopAnalyzer, and StandardAnalyzer—are designed to work with text in
almost any Western (European-based) language. You can see the effect of each of
these analyzers in the output in section 4.2.3. WhitespaceAnalyzer and Simple-
Analyzer are both trivial and we don’t cover them in more detail here. We explore
the StopAnalyzer and StandardAnalyzer in more depth because they have non-
Index
Index

• IndexWriter
• Directory
• Analyzer
• Document
• Field
ex options: store
                         store
  Value         Description
  :no           Don’t store field
  :yes          Store field in its original format.
                Use this value if you want to highlight
                matches or print match excerpts a la Google
                search.
  :compressed   Store field in compressed format.
index
Index options: index

        Value                                   Description
        :no                                     Do not make this field searchable.
        :yes                                    Make this field searchable and tok-
                                                enize its contents.
        :untokenized                            Make this field searchable but do not
                                                tokenize its contents. Use this value
                                                for fields you wish to sort by.
        :omit norms                             Same as :yes except omit the norms
                                                file. The norms file can be omit-
                                                ted if you don’t boost any fields and
                                                you don’t need scoring based on field
                                                length.
        :untokenized omit norms                 Same as :untokenized except omit the
                                                norms file.
Ruby Day Kraków: Full Text Search with Ferret
term_vector
Index options: term vector



        Value                                   Description
        :no                                     Don’t store term-vectors
        :yes                                    Store term-vectors without storing positions
                                                or offsets.
        :with positions                         Store term-vectors with positions.
        :with offsets                            Store term-vectors with offsets.
        :with positions ofssets                 Store term-vectors with positions and off-
                                                sets.




Ruby Day Kraków: Full Text Search with Ferret
Search
Search

• IndexSearcher
• Term
• Query
• Hits
Query
Query

• API
 •   new TermQuery(new Term(“name”,”Tomek”));

• Lucene QueryParser
 •   queryParser.parse(“name:Tomekquot;);
TermQuery
 name:Tomek
BooleanQuery
    ramobo OR ninja

+rambo +ninja –name:rocky
PhraseQuery
“ninja java” –name:rocky
SloppyPhraseQuery
 “red-faced politicians”~3
RangeQuery
releaseDate:[2000 TO 2007]
WildcardQuery
 sup?r, su*r, super*
FuzzyQuery
      color~

 colour, collor, colro
http://en.wikipedia.org/wiki/Levenshtein_distance


                 color colour - 1

                  colour coller - 2
Equation 1. Levenstein Distance Score




This means that an exact match will h
corresponding letters will have a score
Boost
title:Spring^10
Information Retrieval with Open Source
Information Retrieval with Open Source

More Related Content

Viewers also liked

God Exists
God ExistsGod Exists
God Exists
antso
 
Powerpoint Salland 3,1
Powerpoint Salland 3,1Powerpoint Salland 3,1
Powerpoint Salland 3,1
Chin Min
 
Presentacion cracovia
Presentacion cracoviaPresentacion cracovia
Presentacion cracovia
rubenroa
 

Viewers also liked (20)

Board Meeting06.10.08
Board Meeting06.10.08Board Meeting06.10.08
Board Meeting06.10.08
 
Hnp Berritu Behar Zuzendariei Aurkezpena
Hnp Berritu Behar Zuzendariei AurkezpenaHnp Berritu Behar Zuzendariei Aurkezpena
Hnp Berritu Behar Zuzendariei Aurkezpena
 
HNPberritzekoLanakMintegietanAurkezteko
HNPberritzekoLanakMintegietanAurkeztekoHNPberritzekoLanakMintegietanAurkezteko
HNPberritzekoLanakMintegietanAurkezteko
 
Zorionak09
Zorionak09Zorionak09
Zorionak09
 
God Exists
God ExistsGod Exists
God Exists
 
D Mac P.Lessons Learned
D Mac P.Lessons LearnedD Mac P.Lessons Learned
D Mac P.Lessons Learned
 
Strijker, A. (2004 11 27). Lcmss
Strijker, A. (2004 11 27). LcmssStrijker, A. (2004 11 27). Lcmss
Strijker, A. (2004 11 27). Lcmss
 
In Memoriam
In MemoriamIn Memoriam
In Memoriam
 
Natuurrijke tuin
Natuurrijke tuinNatuurrijke tuin
Natuurrijke tuin
 
Strijker, A. (2002 09 09). Learning Content Management Systems For Web Suppor...
Strijker, A. (2002 09 09). Learning Content Management Systems For Web Suppor...Strijker, A. (2002 09 09). Learning Content Management Systems For Web Suppor...
Strijker, A. (2002 09 09). Learning Content Management Systems For Web Suppor...
 
Strijker, A. (2002, April 03). Reuse And Metadata In Practice
Strijker, A. (2002, April 03). Reuse And Metadata In PracticeStrijker, A. (2002, April 03). Reuse And Metadata In Practice
Strijker, A. (2002, April 03). Reuse And Metadata In Practice
 
Kansengroepen en vrijetijdsparticipatie
Kansengroepen en vrijetijdsparticipatieKansengroepen en vrijetijdsparticipatie
Kansengroepen en vrijetijdsparticipatie
 
Strijker, A (2001). Teletop And Reuse
Strijker, A (2001). Teletop And ReuseStrijker, A (2001). Teletop And Reuse
Strijker, A (2001). Teletop And Reuse
 
Vormingplus Kempen
Vormingplus KempenVormingplus Kempen
Vormingplus Kempen
 
Sales Skill Develop In E Learning
Sales Skill Develop In E LearningSales Skill Develop In E Learning
Sales Skill Develop In E Learning
 
Powerpoint Salland 3,1
Powerpoint Salland 3,1Powerpoint Salland 3,1
Powerpoint Salland 3,1
 
Branka Mintzagrama Datuen Iakurketarako Azalpena
Branka Mintzagrama Datuen Iakurketarako AzalpenaBranka Mintzagrama Datuen Iakurketarako Azalpena
Branka Mintzagrama Datuen Iakurketarako Azalpena
 
Ejemplo
EjemploEjemplo
Ejemplo
 
Ncte GBN
Ncte GBNNcte GBN
Ncte GBN
 
Presentacion cracovia
Presentacion cracoviaPresentacion cracovia
Presentacion cracovia
 

Similar to Information Retrieval with Open Source

Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
Kevin Smith
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
Kevin Smith
 

Similar to Information Retrieval with Open Source (9)

Visualization of Traceability Models with Domain-specific Layouting
Visualization of Traceability Models with Domain-specific LayoutingVisualization of Traceability Models with Domain-specific Layouting
Visualization of Traceability Models with Domain-specific Layouting
 
BADCamp 2008 DB Sync
BADCamp 2008 DB SyncBADCamp 2008 DB Sync
BADCamp 2008 DB Sync
 
iOS Visual F/X Using GLSL
iOS Visual F/X Using GLSLiOS Visual F/X Using GLSL
iOS Visual F/X Using GLSL
 
資料視覺化 - D3 的第一堂課 | WeiYuan
資料視覺化 - D3 的第一堂課 | WeiYuan資料視覺化 - D3 的第一堂課 | WeiYuan
資料視覺化 - D3 的第一堂課 | WeiYuan
 
Obsidian Talk JP 資料 - 2021-10-15
Obsidian Talk JP 資料 - 2021-10-15Obsidian Talk JP 資料 - 2021-10-15
Obsidian Talk JP 資料 - 2021-10-15
 
Industry - Relating Developers' Concepts and Artefact Vocabulary in a Financ...
Industry -  Relating Developers' Concepts and Artefact Vocabulary in a Financ...Industry -  Relating Developers' Concepts and Artefact Vocabulary in a Financ...
Industry - Relating Developers' Concepts and Artefact Vocabulary in a Financ...
 
Design margin analysis & prediction 2005
Design margin analysis & prediction 2005Design margin analysis & prediction 2005
Design margin analysis & prediction 2005
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
 
Introducing Riak
Introducing RiakIntroducing Riak
Introducing Riak
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Information Retrieval with Open Source

  • 1.
  • 2. Tomasz Korzeniowski tomek@polarrose.com
  • 4.
  • 5.
  • 6.
  • 7. Retrieval strategies • Vector Space Model • Latent Semantic Indexing • Probabilistic Retrieval Strategies • Language Models • Inference Networks • Extended Boolean Retrieval • Neural Networks • Genetic Algorithms • Fuzzy Set Retrieval
  • 16.
  • 18. r boost for a query on ferrari than the get from a query on insurance. entInversionof a term used to sca frequency df document total number of documents in a corpu frequency follows: frequency (idf) of a term t as N idft = log . dft rare term is high, whereas the idf of a ure 6.4 gives an example of idf’s in a co
  • 19. g scheme assigns to term tf-idft,d = tft,d × idft . ssigns to term t a weigh
  • 21. 7 Vector space re 6 v(q)       v(d2 )   B ¨ ¨   ¨¨ v(d2 ) I   ¨ ¨   ¨¨  ¨¨  ¨ ¨   - ¨ Cosine similarity illustrated. igure 7.1
  • 22.
  • 23. Q: “gold silver truck” D1: “Shipment of gold damaged in a fire” D2: “Delivery of silver arrived in a silver truck” D3: “Shipment of gold arrived in a truck”
  • 24. TF a arrived damaged delivery fire gold in of shipment silver truck D1 1 1 1 1 11 1 0 0 0 0 D2 1 1 1 11 2 0 0 0 0 0 D3 1 1 1 11 1 1 0 0 0 0 1 1 1 Q 0 0 0 0 0 00 0
  • 25. N idft = log . dft • • of area term is high, whereas 0the idf of 0 log 3/3 = log 3/3 = • arrived • silver re 6.4 gives0.176 example of idf’s in a an 0.477 log 3/2 = log 3/1 = • damaged • shipment ample logarithms are to the base 10. 0.477 0.176 log 3/1 = log 3/2 = • delivery • truck 0.477 0.176 log 3/1 = log 3/2 = • fire • gold 0.477 0.176 log 3/1 = log 3/2 = always finite? • in 0 log 3/3 =
  • 26. a arrived damaged delivery fire gold in of shipment silver truck 0.477 0.477 0.176 0 0 0.176 D1 0 0 0 0 0 0.176 0.477 0.954 0.176 D2 0 0 0 0 00 0 0.176 0.176 0 0 0.176 0.176 D3 0 0 0 0 0 0.176 0 0 0.477 0.176 Q 0 0 0 0 0 0
  • 30. term - 1 (dn,1) (d10,1) term - 2 (dn,5) (dn,3) term - 3 (d2,11) (d10,1) term - 4 (dn,1) (d2,1) term - 5 (dn,2) (d4,3) term - n (d6,1) (d7,3)
  • 33.
  • 34.
  • 35. Lucene includes several built-in analyzers. The primary ones are shown in table 4.2. We’ll leave discussion of the two language-specific analyzers, RussianAnalyzer and GermanAnalyzer, to section 4.8.2 and the special per-field analyzer wrapper, PerFieldAnalyzerWrapper, to section 4.4. Table 4.2 Primary analyzers available in Lucene Analyzer Steps taken Splits tokens at whitespace WhitespaceAnalyzer Divides text at nonletter characters and lowercases SimpleAnalyzer Divides text at nonletter characters, lowercases, and removes stop words StopAnalyzer Tokenizes based on a sophisticated grammar that recognizes e-mail StandardAnalyzer addresses, acronyms, Chinese-Japanese-Korean characters, alphanumerics, and more; lowercases; and removes stop words The built-in analyzers we discuss in this section—WhitespaceAnalyzer, Simple- Analyzer, StopAnalyzer, and StandardAnalyzer—are designed to work with text in almost any Western (European-based) language. You can see the effect of each of these analyzers in the output in section 4.2.3. WhitespaceAnalyzer and Simple- Analyzer are both trivial and we don’t cover them in more detail here. We explore the StopAnalyzer and StandardAnalyzer in more depth because they have non-
  • 36. Index
  • 37. Index • IndexWriter • Directory • Analyzer • Document • Field
  • 38. ex options: store store Value Description :no Don’t store field :yes Store field in its original format. Use this value if you want to highlight matches or print match excerpts a la Google search. :compressed Store field in compressed format.
  • 39. index Index options: index Value Description :no Do not make this field searchable. :yes Make this field searchable and tok- enize its contents. :untokenized Make this field searchable but do not tokenize its contents. Use this value for fields you wish to sort by. :omit norms Same as :yes except omit the norms file. The norms file can be omit- ted if you don’t boost any fields and you don’t need scoring based on field length. :untokenized omit norms Same as :untokenized except omit the norms file. Ruby Day Kraków: Full Text Search with Ferret
  • 40. term_vector Index options: term vector Value Description :no Don’t store term-vectors :yes Store term-vectors without storing positions or offsets. :with positions Store term-vectors with positions. :with offsets Store term-vectors with offsets. :with positions ofssets Store term-vectors with positions and off- sets. Ruby Day Kraków: Full Text Search with Ferret
  • 41.
  • 44. Query
  • 45. Query • API • new TermQuery(new Term(“name”,”Tomek”)); • Lucene QueryParser • queryParser.parse(“name:Tomekquot;);
  • 47. BooleanQuery ramobo OR ninja +rambo +ninja –name:rocky
  • 52. FuzzyQuery color~ colour, collor, colro
  • 53. http://en.wikipedia.org/wiki/Levenshtein_distance color colour - 1 colour coller - 2
  • 54. Equation 1. Levenstein Distance Score This means that an exact match will h corresponding letters will have a score