SlideShare a Scribd company logo
An Introduction to
NLP4L
Natural Language Processing tool for
Apache Lucene
Koji Sekiguchi @kojisays
Founder & CEO, RONDHUIT
My contributions
• CharFilter framework & MappingCharFilter
• FastVectorHighlighter
2
Agenda
• What s NLP4L?
• How NLP improves search experience
• Calculate probabilities using ShingleFilter
• Transliteration (Application for HMM)
• NLP4L Framework (coming soon)
3
Agenda
• What s NLP4L?
• How NLP improves search experience
• Calculate probabilities using ShingleFilter
• Transliteration (Application for HMM)
• NLP4L Framework (coming soon)
4
What s NLP4L?
5
What s NLP4L?
• GOAL
• Improve Lucene users search experience
• FEATURES
• Use of Lucene index as a Corpus Database
• Lucene API Front-end written in Scala
• NLP4L provides
• Preprocessors for existing ML tools
• Provision of ML algorithms and Applications (e.g. Transliteration)
6
What s NLP4L?
• GOAL
• Improve Lucene users search experience
• FEATURES
• Use of Lucene index as a Corpus Database
• Lucene API Front-end written in Scala
• NLP4L provides
• Preprocessors for existing ML tools
• Provision of ML algorithms and Applications (e.g. Transliteration)
7
What s NLP4L?
• GOAL
• Improve Lucene users search experience
• FEATURES
• Use of Lucene index as a Corpus Database
• Lucene API Front-end written in Scala
• NLP4L provides
• Preprocessors for existing ML tools
• Provision of ML algorithms and Applications (e.g. Transliteration)
8
Agenda
• What s NLP4L?
• How NLP improves search experience
• Calculate probabilities using ShingleFilter
• Transliteration (Application for HMM)
• NLP4L Framework (coming soon)
9
Evaluation Measures
targetresult
tpfp fn
tn
precision = tp / (tp + fp)
recall = tp / (tp + fn)
10
Recall ,Precision
tpfp fn
tn
precision = tp / (tp + fp)
recall = tp / (tp + fn)
11
targetresult
tpfp fn
tn
precision = tp / (tp + fp)
recall = tp / (tp + fn)
Recall ,Precision
12
Solution
n-gram, synonym dictionary, etc.
facet (filter query)
Ranking Tuning
recall
precision
recall , precision
13
Solution
n-gram, synonym dictionary, etc.
facet (filter query)
Ranking Tuning
recall
precision
recall , precision
14
Solution
n-gram, synonym dictionary, etc.
e.g. Transliteration
facet (filter query)
recall
precision
recall , precision
Ranking Tuning
15
Solution
n-gram, synonym dictionary, etc.
e.g. Transliteration
facet (filter query)
e.g. Named Entity Extraction
recall
precision
recall , precision
Ranking Tuning
16
gradual precision improvement
q=watch
targetresult
17
filter by
Gender=Men s
targetresult
gradual precision improvement
18
targetresult
filter by
Gender=Men s
filter by
Price=100-150
gradual precision improvement
19
Structured Documents
ID product price gender
1
CURREN New Men s Date Stainless
Steel Military Sport Quartz Wrist Watch
8.92 Men s
2 Suiksilver The Gamer Watch 87.99 Men s
20
Unstructured Documents
ID article
1
David Cameron says he has a mandate to pursue EU reform following the
Conservatives' general election victory. The Prime Minister will be hoping his
majority government will give him extra leverage in Brussels.
2
He wants to renegotiate the terms of the UK's membership ahead of a
referendum by the end of 2017. He has said he will campaign for Britain to
remain in the EU if he gets the reforms he wants.
21
Make them Structured
I
D
article person org loc
1
David Cameron says he has a mandate to pursue EU reform following
the Conservatives' general election victory. The Prime Minister will be
hoping his majority government will give him extra leverage in Brussels.
David
Cameron
EU
Bruss
els
2
He wants to renegotiate the terms of the UK's membership ahead of a
referendum by the end of 2017. He has said he will campaign for
Britain to remain in the EU if he gets the reforms he wants.
EU
UK
Britai
n
NEE[1] extracts interesting words.
[1] Named Entity Extraction
22
Manual Tagging using brat
23
Agenda
• What s NLP4L?
• How NLP improves search experience
• Calculate probabilities using ShingleFilter
• Transliteration (Application for HMM)
• NLP4L Framework (coming soon)
24
Language Model
• LM represents the fluency of language
• N-gram model is the LM which is most widely
used
• Calculation example for 2-gram
totalTermFreq(”word2g”,”an apple”)
totalTermFreq(”word”,”an”)
25
Alice/NNP ate/VB an/AT apple/NNP ./.
Mike/NNP likes/VB an/AT orange/NNP ./.
An/AT apple/NNP is/VB red/JJ ./.
NNP Proper noun, singular
VB Verb
AT Article
JJ Adjective
. period
Part-of-Speech Tagging
Our Corpus for training
26
Hidden Markov Model
27
Hidden Markov Model
Series of Words
28
Hidden Markov Model
Series of Part-of-Speech
29
Hidden Markov Model
30
Hidden Markov Model
31
HMM state diagram
NNP
0.667
VB
0.0
.
0.0
JJ
0.0
AT
0.333
1.0
1.0
0.4 0.6
0.6670.333
alice 0.2
apple 0.4
mike 0.2
orange 0.2
ate 0.333
is 0.333
likes 0.333
an 1.0
red 1.0
. 1.0
32
Agenda
• What s NLP4L?
• How NLP improves search experience
• Calculate probabilities using ShingleFilter
• Transliteration (Application for HMM)
• NLP4L Framework (coming soon)
33
Transliteration
Transliteration is a process of transcribing letters or words from one
alphabet to another one to facilitate comprehension and pronunciation
for non-native speakers.
computer コンピューター
server サーバー
internet インターネット
mouse マウス
information インフォメーション
examples of transliteration from English to Japanese
34
It helps improve recall
you search English mouse
35
It helps improve recall
but you got マウス (=mouse)
highlighted in Japanese
36
Training data in NLP4L
アaカcaデdeミーmy
アaクcセceンnトt
アaクcセceスss
アaクcシciデdeンnトt
アaクcロroバッbaトt
アaクcショtioンn
アaダdaプpターter
アaフfリriカca
エaアirバbuスs
アaラlaスsカka
アaルlコーcohoルl
アaレlleルrギーgy
train_data/alpha_katakana.txt train_data/alpha_katakana_aligned.txt
academy,アカデミー
accent,アクセント
access,アクセス
accident,アクシデント
acrobat,アクロバット
action,アクション
adapter,アダプター
africa,アフリカ
airbus,エアバス
alaska,アラスカ
alcohol,アルコール
allergy,アレルギー
37
Demo: Transliteration
Input Prediction Right Answer
アルゴリズム algorism algorithm
プログラム program (OK)
ケミカル chaemmical chemical
ダイニング dining (OK)
コミッター committer (OK)
エントリー entree entry
nlp4l> :load examples/trans_katakana_alpha.scala
38
Gathering loan words
① crawl
gathering
Katakana-Alphabet
string pairs
アルゴリズム, algorithm
Transliteration
アルゴリズム
algorism
calculate
edit distance
synonyms.txt
store pair of strings
if edit distance
is small enough
②
③
④
⑤
⑥
39
Gathering loan words
① crawl
gathering
Katakana-Alphabet
string pairs
アルゴリズム, algorithm
Transliteration
アルゴリズム
algorism
calculate
edit distance
synonyms.txt
store pair of strings
if edit distance
is small enough
②
③
④
⑤
⑥
Got 1,800+ records of
synonym knowledge
from jawiki
40
Agenda
• What s NLP4L?
• How NLP improves search experience
• Calculate probabilities using ShingleFilter
• Transliteration (Application for HMM)
• NLP4L Framework (coming soon)
41
NLP4L Framework
• A framework that improves search experience (for mainly
Lucene-based search system). Pluggable.
• Reference implementation of plug-ins and corpora
provided.
• Uses NLP/ML technologies to output models, dictionaries
and indexes.
• Since NLP/ML are not perfect, an interface that enables
users to personally examine output dictionaries is
provided as well.
42
NLP4L Framework
• A framework that improves search experience (for mainly
Lucene-based search system). Pluggable.
• Reference implementation of plug-ins and corpora
provided.
• Uses NLP/ML technologies to output models, dictionaries
and indexes.
• Since NLP/ML are not perfect, an interface that enables
users to personally examine output dictionaries is
provided as well.
43
NLP4L Framework
• A framework that improves search experience (for mainly
Lucene-based search system). Pluggable.
• Reference implementation of plug-ins and corpora
provided.
• Uses NLP/ML technologies to output models, dictionaries
and indexes.
• Since NLP/ML are not perfect, an interface that enables
users to personally examine output dictionaries is
provided as well.
44
NLP4L Framework
• A framework that improves search experience (for mainly
Lucene-based search system). Pluggable.
• Reference implementation of plug-ins and corpora
provided.
• Uses NLP/ML technologies to output models, dictionaries
and indexes.
• Since NLP/ML are not perfect, an interface that enables
users to personally examine output dictionaries is
provided as well.
45
Solr
ES
Mahout Spark
Data Source
・Corpus (Text data, Lucene index)
・Query Log
・Access Log
Dictionaries
・Suggestion
(auto complete)
・Did you mean?
・synonyms.txt
・userdic.txt
・keyword attachment
maintenance
Model files
Tagged
Corpus
Document
Vectors
・TermExtractor
・Transliteration
・NEE
・Classification
・Document Vectors
・Language Detection
・Learning to Rank
・Personalized Search
46
Keyword Attachment
• Keyword attachment is a general format that enables the
following functions.
• Learning to Rank
• Personalized Search
• Named Entity Extraction
• Document Classification
Lucene
doc
Lucene
doc
keyword
↑
Increase boost
47
Before Learning to Rank
targetresult
1 2
3 …
50 100
500 …
48
After Learning to Rank
targetresult
1 2
3 …
50 100
500 …
49
Learning to Rank
• Program learns, from access log and other
sources, that the score of document d for a
query q should be larger than the normal
score(q,d)
Lucene
doc d
q, q, …
https://en.wikipedia.org/wiki/Learning_to_rank
50
Personalized Search
targetresult
1 2
3 …
50 100
500 …
q=apple
computer …
51
Personalized Search
target
result
50 100
500 …
1 2
3 …
q=applefruit …
52
Personalized Search
• Program learns, from access log and other sources, that
the score of document d for a query q by user u should
be larger than the normal score(q,d)
• Since you cannot specify score(q,d,u) as Lucene restricts
doing so, you have to specify score(qu,d).
• Limit the data to high-order queries or divide fields
depending on a user as the number of q-u combinations
can be enormous.
Lucene
doc d1
q1u1, q2u2
Lucene
doc d2
q2u1, q1u2
53
Join and Code with Us!
Contact us at
koji at apache dot org
for the details.
54
Demo or
Q & A
Thank you!
55

More Related Content

What's hot (20)

PDF
10 Keys to Solr's Future: Presented by Grant Ingersoll, Lucidworks
Lucidworks
 
PPTX
Tutorial on developing a Solr search component plugin
searchbox-com
 
PDF
Search Quality Evaluation: a Developer Perspective
Andrea Gazzarini
 
PDF
Get the most out of Solr search with PHP
Paul Borgermans
 
PPT
Building Intelligent Search Applications with Apache Solr and PHP5
israelekpo
 
PDF
Solr Application Development Tutorial
Erik Hatcher
 
PDF
Rapid Prototyping with Solr
Erik Hatcher
 
PDF
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
Erik Hatcher
 
PDF
Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...
Lucidworks
 
PDF
Apache Solr/Lucene Internals by Anatoliy Sokolenko
Provectus
 
PDF
Interactive Questions and Answers - London Information Retrieval Meetup
Sease
 
PPTX
Apache Jena Elephas and Friends
Rob Vesse
 
PDF
Integrating the Solr search engine
th0masr
 
PPT
Boosting Documents in Solr by Recency, Popularity, and User Preferences
Lucidworks (Archived)
 
PDF
Customizing Ranking Models for Enterprise Search: Presented by Ammar Haris & ...
Lucidworks
 
PDF
Rapid Prototyping with Solr
Erik Hatcher
 
PDF
Lucene for Solr Developers
Erik Hatcher
 
PPTX
Apache Solr for eCommerce at Allopneus with France Labs - Lib'Day 2014
francelabs
 
PPTX
Practical SPARQL Benchmarking Revisited
Rob Vesse
 
PDF
Solr+Hadoop = Big Data Search
Cloudera, Inc.
 
10 Keys to Solr's Future: Presented by Grant Ingersoll, Lucidworks
Lucidworks
 
Tutorial on developing a Solr search component plugin
searchbox-com
 
Search Quality Evaluation: a Developer Perspective
Andrea Gazzarini
 
Get the most out of Solr search with PHP
Paul Borgermans
 
Building Intelligent Search Applications with Apache Solr and PHP5
israelekpo
 
Solr Application Development Tutorial
Erik Hatcher
 
Rapid Prototyping with Solr
Erik Hatcher
 
code4lib 2011 preconference: What's New in Solr (since 1.4.1)
Erik Hatcher
 
Semantic & Multilingual Strategies in Lucene/Solr: Presented by Trey Grainger...
Lucidworks
 
Apache Solr/Lucene Internals by Anatoliy Sokolenko
Provectus
 
Interactive Questions and Answers - London Information Retrieval Meetup
Sease
 
Apache Jena Elephas and Friends
Rob Vesse
 
Integrating the Solr search engine
th0masr
 
Boosting Documents in Solr by Recency, Popularity, and User Preferences
Lucidworks (Archived)
 
Customizing Ranking Models for Enterprise Search: Presented by Ammar Haris & ...
Lucidworks
 
Rapid Prototyping with Solr
Erik Hatcher
 
Lucene for Solr Developers
Erik Hatcher
 
Apache Solr for eCommerce at Allopneus with France Labs - Lib'Day 2014
francelabs
 
Practical SPARQL Benchmarking Revisited
Rob Vesse
 
Solr+Hadoop = Big Data Search
Cloudera, Inc.
 

Similar to An Introduction to NLP4L (20)

PDF
An Introduction to NLP4L - Natural Language Processing Tool for Apache Lucene...
Lucidworks
 
PDF
Philippe Langlais - 2017 - Users and Data: The Two Neglected Children of Bili...
Association for Computational Linguistics
 
PPTX
Query Understanding
Matt Corkum
 
PDF
Natural Language Processing using Java
Sangameswar Venkatraman
 
PDF
Relevance Improvements at Cengage - Ivan Provalov
lucenerevolution
 
PDF
Concepts and Challenges of Text Retrieval for Search Engine
Gan Keng Hoon
 
PPTX
NLP
Qi Zhang
 
PDF
Natural language processing
Aanchal Chaurasia
 
PDF
From Linked Data to Semantic Applications
Andre Freitas
 
PDF
Information retrieval concept, practice and challenge
Gan Keng Hoon
 
PPTX
Taming Text
Grant Ingersoll
 
PDF
NLP Project Full Circle
Vsevolod Dyomkin
 
PDF
Training at AI Frontiers 2018 - Ni Lao: Weakly Supervised Natural Language Un...
AI Frontiers
 
PDF
Mini seminar presentation on context-based NED optimization
Filip Ilievski
 
PPTX
Techniques For Deep Query Understanding
Abhay Prakash
 
PPTX
Mining Web content for Enhanced Search
Roi Blanco
 
PPTX
NLP.pptx
Rahul Borate
 
PPTX
State of the art in Natural Language Processing (March 2019)
Liad Magen
 
PDF
ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing.
Lifeng (Aaron) Han
 
An Introduction to NLP4L - Natural Language Processing Tool for Apache Lucene...
Lucidworks
 
Philippe Langlais - 2017 - Users and Data: The Two Neglected Children of Bili...
Association for Computational Linguistics
 
Query Understanding
Matt Corkum
 
Natural Language Processing using Java
Sangameswar Venkatraman
 
Relevance Improvements at Cengage - Ivan Provalov
lucenerevolution
 
Concepts and Challenges of Text Retrieval for Search Engine
Gan Keng Hoon
 
Natural language processing
Aanchal Chaurasia
 
From Linked Data to Semantic Applications
Andre Freitas
 
Information retrieval concept, practice and challenge
Gan Keng Hoon
 
Taming Text
Grant Ingersoll
 
NLP Project Full Circle
Vsevolod Dyomkin
 
Training at AI Frontiers 2018 - Ni Lao: Weakly Supervised Natural Language Un...
AI Frontiers
 
Mini seminar presentation on context-based NED optimization
Filip Ilievski
 
Techniques For Deep Query Understanding
Abhay Prakash
 
Mining Web content for Enhanced Search
Roi Blanco
 
NLP.pptx
Rahul Borate
 
State of the art in Natural Language Processing (March 2019)
Liad Magen
 
ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing.
Lifeng (Aaron) Han
 
Ad

More from Koji Sekiguchi (20)

PDF
20221209-ApacheSolrによるはじめてのセマンティックサーチ.pdf
Koji Sekiguchi
 
PPTX
Solr から使う OpenNLP の日本語固有表現抽出
Koji Sekiguchi
 
PDF
Learning-to-Rank meetup Vol. 1
Koji Sekiguchi
 
PPTX
Lucene 6819-good-bye-index-time-boost
Koji Sekiguchi
 
PPTX
NLP4L - 情報検索における性能改善のためのコーパスの活用とランキング学習
Koji Sekiguchi
 
PDF
Nlp4 l intro-20150513
Koji Sekiguchi
 
PDF
コーパス学習による Apache Solr の徹底活用
Koji Sekiguchi
 
PDF
情報検索の基礎からデータの徹底活用まで
Koji Sekiguchi
 
PDF
LUCENE-5252 NGramSynonymTokenizer
Koji Sekiguchi
 
PDF
情報検索におけるランキング計算の紹介
Koji Sekiguchi
 
PPTX
系列パターンマイニングを用いた単語パターン学習とWikipediaからの組織名抽出
Koji Sekiguchi
 
PPTX
Luceneインデックスの共起単語分析とSolrによる共起単語サジェスチョン
Koji Sekiguchi
 
PPTX
Html noise reduction
Koji Sekiguchi
 
PPTX
Lucene terms extraction
Koji Sekiguchi
 
PPTX
Visualize terms network in Lucene index
Koji Sekiguchi
 
PPTX
WikipediaからのSolr用類義語辞書の自動生成
Koji Sekiguchi
 
PPTX
HMM viterbi
Koji Sekiguchi
 
PPTX
NLP x Lucene/Solr
Koji Sekiguchi
 
PPTX
OpenNLP - MEM and Perceptron
Koji Sekiguchi
 
PPTX
自然言語処理における機械学習による曖昧性解消入門
Koji Sekiguchi
 
20221209-ApacheSolrによるはじめてのセマンティックサーチ.pdf
Koji Sekiguchi
 
Solr から使う OpenNLP の日本語固有表現抽出
Koji Sekiguchi
 
Learning-to-Rank meetup Vol. 1
Koji Sekiguchi
 
Lucene 6819-good-bye-index-time-boost
Koji Sekiguchi
 
NLP4L - 情報検索における性能改善のためのコーパスの活用とランキング学習
Koji Sekiguchi
 
Nlp4 l intro-20150513
Koji Sekiguchi
 
コーパス学習による Apache Solr の徹底活用
Koji Sekiguchi
 
情報検索の基礎からデータの徹底活用まで
Koji Sekiguchi
 
LUCENE-5252 NGramSynonymTokenizer
Koji Sekiguchi
 
情報検索におけるランキング計算の紹介
Koji Sekiguchi
 
系列パターンマイニングを用いた単語パターン学習とWikipediaからの組織名抽出
Koji Sekiguchi
 
Luceneインデックスの共起単語分析とSolrによる共起単語サジェスチョン
Koji Sekiguchi
 
Html noise reduction
Koji Sekiguchi
 
Lucene terms extraction
Koji Sekiguchi
 
Visualize terms network in Lucene index
Koji Sekiguchi
 
WikipediaからのSolr用類義語辞書の自動生成
Koji Sekiguchi
 
HMM viterbi
Koji Sekiguchi
 
NLP x Lucene/Solr
Koji Sekiguchi
 
OpenNLP - MEM and Perceptron
Koji Sekiguchi
 
自然言語処理における機械学習による曖昧性解消入門
Koji Sekiguchi
 
Ad

Recently uploaded (20)

PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
Q2 Leading a Tableau User Group - Onboarding
lward7
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
July Patch Tuesday
Ivanti
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Learn Computer Forensics, Second Edition
AnuraShantha7
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Q2 Leading a Tableau User Group - Onboarding
lward7
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
July Patch Tuesday
Ivanti
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Learn Computer Forensics, Second Edition
AnuraShantha7
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 

An Introduction to NLP4L

  • 1. An Introduction to NLP4L Natural Language Processing tool for Apache Lucene Koji Sekiguchi @kojisays Founder & CEO, RONDHUIT
  • 2. My contributions • CharFilter framework & MappingCharFilter • FastVectorHighlighter 2
  • 3. Agenda • What s NLP4L? • How NLP improves search experience • Calculate probabilities using ShingleFilter • Transliteration (Application for HMM) • NLP4L Framework (coming soon) 3
  • 4. Agenda • What s NLP4L? • How NLP improves search experience • Calculate probabilities using ShingleFilter • Transliteration (Application for HMM) • NLP4L Framework (coming soon) 4
  • 6. What s NLP4L? • GOAL • Improve Lucene users search experience • FEATURES • Use of Lucene index as a Corpus Database • Lucene API Front-end written in Scala • NLP4L provides • Preprocessors for existing ML tools • Provision of ML algorithms and Applications (e.g. Transliteration) 6
  • 7. What s NLP4L? • GOAL • Improve Lucene users search experience • FEATURES • Use of Lucene index as a Corpus Database • Lucene API Front-end written in Scala • NLP4L provides • Preprocessors for existing ML tools • Provision of ML algorithms and Applications (e.g. Transliteration) 7
  • 8. What s NLP4L? • GOAL • Improve Lucene users search experience • FEATURES • Use of Lucene index as a Corpus Database • Lucene API Front-end written in Scala • NLP4L provides • Preprocessors for existing ML tools • Provision of ML algorithms and Applications (e.g. Transliteration) 8
  • 9. Agenda • What s NLP4L? • How NLP improves search experience • Calculate probabilities using ShingleFilter • Transliteration (Application for HMM) • NLP4L Framework (coming soon) 9
  • 10. Evaluation Measures targetresult tpfp fn tn precision = tp / (tp + fp) recall = tp / (tp + fn) 10
  • 11. Recall ,Precision tpfp fn tn precision = tp / (tp + fp) recall = tp / (tp + fn) 11
  • 12. targetresult tpfp fn tn precision = tp / (tp + fp) recall = tp / (tp + fn) Recall ,Precision 12
  • 13. Solution n-gram, synonym dictionary, etc. facet (filter query) Ranking Tuning recall precision recall , precision 13
  • 14. Solution n-gram, synonym dictionary, etc. facet (filter query) Ranking Tuning recall precision recall , precision 14
  • 15. Solution n-gram, synonym dictionary, etc. e.g. Transliteration facet (filter query) recall precision recall , precision Ranking Tuning 15
  • 16. Solution n-gram, synonym dictionary, etc. e.g. Transliteration facet (filter query) e.g. Named Entity Extraction recall precision recall , precision Ranking Tuning 16
  • 19. targetresult filter by Gender=Men s filter by Price=100-150 gradual precision improvement 19
  • 20. Structured Documents ID product price gender 1 CURREN New Men s Date Stainless Steel Military Sport Quartz Wrist Watch 8.92 Men s 2 Suiksilver The Gamer Watch 87.99 Men s 20
  • 21. Unstructured Documents ID article 1 David Cameron says he has a mandate to pursue EU reform following the Conservatives' general election victory. The Prime Minister will be hoping his majority government will give him extra leverage in Brussels. 2 He wants to renegotiate the terms of the UK's membership ahead of a referendum by the end of 2017. He has said he will campaign for Britain to remain in the EU if he gets the reforms he wants. 21
  • 22. Make them Structured I D article person org loc 1 David Cameron says he has a mandate to pursue EU reform following the Conservatives' general election victory. The Prime Minister will be hoping his majority government will give him extra leverage in Brussels. David Cameron EU Bruss els 2 He wants to renegotiate the terms of the UK's membership ahead of a referendum by the end of 2017. He has said he will campaign for Britain to remain in the EU if he gets the reforms he wants. EU UK Britai n NEE[1] extracts interesting words. [1] Named Entity Extraction 22
  • 24. Agenda • What s NLP4L? • How NLP improves search experience • Calculate probabilities using ShingleFilter • Transliteration (Application for HMM) • NLP4L Framework (coming soon) 24
  • 25. Language Model • LM represents the fluency of language • N-gram model is the LM which is most widely used • Calculation example for 2-gram totalTermFreq(”word2g”,”an apple”) totalTermFreq(”word”,”an”) 25
  • 26. Alice/NNP ate/VB an/AT apple/NNP ./. Mike/NNP likes/VB an/AT orange/NNP ./. An/AT apple/NNP is/VB red/JJ ./. NNP Proper noun, singular VB Verb AT Article JJ Adjective . period Part-of-Speech Tagging Our Corpus for training 26
  • 29. Hidden Markov Model Series of Part-of-Speech 29
  • 32. HMM state diagram NNP 0.667 VB 0.0 . 0.0 JJ 0.0 AT 0.333 1.0 1.0 0.4 0.6 0.6670.333 alice 0.2 apple 0.4 mike 0.2 orange 0.2 ate 0.333 is 0.333 likes 0.333 an 1.0 red 1.0 . 1.0 32
  • 33. Agenda • What s NLP4L? • How NLP improves search experience • Calculate probabilities using ShingleFilter • Transliteration (Application for HMM) • NLP4L Framework (coming soon) 33
  • 34. Transliteration Transliteration is a process of transcribing letters or words from one alphabet to another one to facilitate comprehension and pronunciation for non-native speakers. computer コンピューター server サーバー internet インターネット mouse マウス information インフォメーション examples of transliteration from English to Japanese 34
  • 35. It helps improve recall you search English mouse 35
  • 36. It helps improve recall but you got マウス (=mouse) highlighted in Japanese 36
  • 37. Training data in NLP4L アaカcaデdeミーmy アaクcセceンnトt アaクcセceスss アaクcシciデdeンnトt アaクcロroバッbaトt アaクcショtioンn アaダdaプpターter アaフfリriカca エaアirバbuスs アaラlaスsカka アaルlコーcohoルl アaレlleルrギーgy train_data/alpha_katakana.txt train_data/alpha_katakana_aligned.txt academy,アカデミー accent,アクセント access,アクセス accident,アクシデント acrobat,アクロバット action,アクション adapter,アダプター africa,アフリカ airbus,エアバス alaska,アラスカ alcohol,アルコール allergy,アレルギー 37
  • 38. Demo: Transliteration Input Prediction Right Answer アルゴリズム algorism algorithm プログラム program (OK) ケミカル chaemmical chemical ダイニング dining (OK) コミッター committer (OK) エントリー entree entry nlp4l> :load examples/trans_katakana_alpha.scala 38
  • 39. Gathering loan words ① crawl gathering Katakana-Alphabet string pairs アルゴリズム, algorithm Transliteration アルゴリズム algorism calculate edit distance synonyms.txt store pair of strings if edit distance is small enough ② ③ ④ ⑤ ⑥ 39
  • 40. Gathering loan words ① crawl gathering Katakana-Alphabet string pairs アルゴリズム, algorithm Transliteration アルゴリズム algorism calculate edit distance synonyms.txt store pair of strings if edit distance is small enough ② ③ ④ ⑤ ⑥ Got 1,800+ records of synonym knowledge from jawiki 40
  • 41. Agenda • What s NLP4L? • How NLP improves search experience • Calculate probabilities using ShingleFilter • Transliteration (Application for HMM) • NLP4L Framework (coming soon) 41
  • 42. NLP4L Framework • A framework that improves search experience (for mainly Lucene-based search system). Pluggable. • Reference implementation of plug-ins and corpora provided. • Uses NLP/ML technologies to output models, dictionaries and indexes. • Since NLP/ML are not perfect, an interface that enables users to personally examine output dictionaries is provided as well. 42
  • 43. NLP4L Framework • A framework that improves search experience (for mainly Lucene-based search system). Pluggable. • Reference implementation of plug-ins and corpora provided. • Uses NLP/ML technologies to output models, dictionaries and indexes. • Since NLP/ML are not perfect, an interface that enables users to personally examine output dictionaries is provided as well. 43
  • 44. NLP4L Framework • A framework that improves search experience (for mainly Lucene-based search system). Pluggable. • Reference implementation of plug-ins and corpora provided. • Uses NLP/ML technologies to output models, dictionaries and indexes. • Since NLP/ML are not perfect, an interface that enables users to personally examine output dictionaries is provided as well. 44
  • 45. NLP4L Framework • A framework that improves search experience (for mainly Lucene-based search system). Pluggable. • Reference implementation of plug-ins and corpora provided. • Uses NLP/ML technologies to output models, dictionaries and indexes. • Since NLP/ML are not perfect, an interface that enables users to personally examine output dictionaries is provided as well. 45
  • 46. Solr ES Mahout Spark Data Source ・Corpus (Text data, Lucene index) ・Query Log ・Access Log Dictionaries ・Suggestion (auto complete) ・Did you mean? ・synonyms.txt ・userdic.txt ・keyword attachment maintenance Model files Tagged Corpus Document Vectors ・TermExtractor ・Transliteration ・NEE ・Classification ・Document Vectors ・Language Detection ・Learning to Rank ・Personalized Search 46
  • 47. Keyword Attachment • Keyword attachment is a general format that enables the following functions. • Learning to Rank • Personalized Search • Named Entity Extraction • Document Classification Lucene doc Lucene doc keyword ↑ Increase boost 47
  • 48. Before Learning to Rank targetresult 1 2 3 … 50 100 500 … 48
  • 49. After Learning to Rank targetresult 1 2 3 … 50 100 500 … 49
  • 50. Learning to Rank • Program learns, from access log and other sources, that the score of document d for a query q should be larger than the normal score(q,d) Lucene doc d q, q, … https://en.wikipedia.org/wiki/Learning_to_rank 50
  • 51. Personalized Search targetresult 1 2 3 … 50 100 500 … q=apple computer … 51
  • 52. Personalized Search target result 50 100 500 … 1 2 3 … q=applefruit … 52
  • 53. Personalized Search • Program learns, from access log and other sources, that the score of document d for a query q by user u should be larger than the normal score(q,d) • Since you cannot specify score(q,d,u) as Lucene restricts doing so, you have to specify score(qu,d). • Limit the data to high-order queries or divide fields depending on a user as the number of q-u combinations can be enormous. Lucene doc d1 q1u1, q2u2 Lucene doc d2 q2u1, q1u2 53
  • 54. Join and Code with Us! Contact us at koji at apache dot org for the details. 54
  • 55. Demo or Q & A Thank you! 55