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

PDF
An Introduction to NLP4L (Scala by the Bay / Big Data Scala 2015)
PDF
Learning to Rank in Solr: Presented by Michael Nilsson & Diego Ceccarelli, Bl...
PDF
Building a real time big data analytics platform with solr
PDF
Let's Build an Inverted Index: Introduction to Apache Lucene/Solr
PDF
Query Parsing - Tips and Tricks
PDF
Lucene And Solr Document Classification
PDF
Evolving The Optimal Relevancy Scoring Model at Dice.com: Presented by Simon ...
PDF
Solr Query Parsing
An Introduction to NLP4L (Scala by the Bay / Big Data Scala 2015)
Learning to Rank in Solr: Presented by Michael Nilsson & Diego Ceccarelli, Bl...
Building a real time big data analytics platform with solr
Let's Build an Inverted Index: Introduction to Apache Lucene/Solr
Query Parsing - Tips and Tricks
Lucene And Solr Document Classification
Evolving The Optimal Relevancy Scoring Model at Dice.com: Presented by Simon ...
Solr Query Parsing

What's hot (20)

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

Similar to An Introduction to NLP4L (20)

PDF
An Introduction to NLP4L - Natural Language Processing Tool for Apache Lucene...
PDF
Philippe Langlais - 2017 - Users and Data: The Two Neglected Children of Bili...
PPTX
Query Understanding
PDF
Natural Language Processing using Java
PDF
Relevance Improvements at Cengage - Ivan Provalov
PDF
Concepts and Challenges of Text Retrieval for Search Engine
PPTX
PDF
Natural language processing
PDF
From Linked Data to Semantic Applications
PDF
Information retrieval concept, practice and challenge
PPTX
Taming Text
PDF
NLP Project Full Circle
PDF
Training at AI Frontiers 2018 - Ni Lao: Weakly Supervised Natural Language Un...
PDF
Mini seminar presentation on context-based NED optimization
PPTX
Techniques For Deep Query Understanding
PPTX
Mining Web content for Enhanced Search
PPTX
NLP.pptx
PPTX
State of the art in Natural Language Processing (March 2019)
PDF
ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing.
An Introduction to NLP4L - Natural Language Processing Tool for Apache Lucene...
Philippe Langlais - 2017 - Users and Data: The Two Neglected Children of Bili...
Query Understanding
Natural Language Processing using Java
Relevance Improvements at Cengage - Ivan Provalov
Concepts and Challenges of Text Retrieval for Search Engine
Natural language processing
From Linked Data to Semantic Applications
Information retrieval concept, practice and challenge
Taming Text
NLP Project Full Circle
Training at AI Frontiers 2018 - Ni Lao: Weakly Supervised Natural Language Un...
Mini seminar presentation on context-based NED optimization
Techniques For Deep Query Understanding
Mining Web content for Enhanced Search
NLP.pptx
State of the art in Natural Language Processing (March 2019)
ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing.
Ad

More from Koji Sekiguchi (20)

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

Recently uploaded (20)

PPTX
Machine Learning_overview_presentation.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
A Presentation on Artificial Intelligence
PDF
Electronic commerce courselecture one. Pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
1. Introduction to Computer Programming.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
Teaching material agriculture food technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
Machine Learning_overview_presentation.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
Programs and apps: productivity, graphics, security and other tools
A Presentation on Artificial Intelligence
Electronic commerce courselecture one. Pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
1. Introduction to Computer Programming.pptx
Machine learning based COVID-19 study performance prediction
Advanced methodologies resolving dimensionality complications for autism neur...
Teaching material agriculture food technology
Digital-Transformation-Roadmap-for-Companies.pptx
SOPHOS-XG Firewall Administrator PPT.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Mobile App Security Testing_ A Comprehensive Guide.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Unlocking AI with Model Context Protocol (MCP)
20250228 LYD VKU AI Blended-Learning.pptx

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