SlideShare una empresa de Scribd logo
1 de 45
Descargar para leer sin conexión
Practical NLP with Lisp

   Vsevolod Dyomkin
       Grammarly
Topics

*   Overview of NLP practice
*   Getting Data
*   Using Lisp: pros & cons
*   A couple of examples
A bit about Grammarly




        (c) xkcd
An example of what
   we deal with
NLP practice
R - research work:
set a goal →
devise an algorithm →
train the algorithm →
test its accuracy
NLP practice
R - research work:
set a goal →
devise an algorithm →
train the algorithm →
test its accuracy

D - development work:
implement the algorithm as an API with
sufficient performance and scaling
characteristics
Research
1. Set a goal
Business goal:

* Develop best/good enough/better than
Word/etc spellchecker

* Develop a set of grammar rules, that will
catch errors according to MLA Style

* Develop a thesaurus, that will produce
synonyms relevant to context
Translate it to measurable goal
* On a test corpus of 10000 sentences with
common errors achieve smaller number of FNs
(and FPs), that other spellcheckers/Word
spellchecker/etc

* On a corpus of examples of sentences with
each kind of error (and similar sentences
without this kind of error) find all
sentences with errors and do not find
errors in correct sentences

* On a test corpus of 1000 sentences
suggest synonyms for all meaningful words
that will be considered relevant by human
linguists in 90% of the cases
A Note on
       Terminology
FN and FP instead of
precision (P), recall (R)

FN = 1-R
FP = 1-P or ???
f1 = P*R/(P+R) =
(1-FN-FP+FN*FP)/(2-(FN+FP))
Research contd.
2. Devise an algorithm
3. Train & improve the
algorithm
Research contd.
2. Devise an algorithm
3. Train & improve the
algorithm

http://nlp-class.org
4. Test its performance
ML: one corpus, divided into
training,development,test
4. Test its performance
ML: one corpus, divided into
training,development,test

Often — different corpora:
* for training some part (not
whole) of the algorithm
* for testing the whole
system
Theoretical maxima
Theoretical maxima are rarely
achievable. Why?
Theoretical maxima
Theoretical maxima are rarely
achievable. Why?

* Because you need their
data. (And data is key)
Theoretical maxima
Theoretical maxima are rarely
achievable. Why?

* Because you need their
data. (And data is key)

* Domains might differ
Pre/post-processing
What ultimately matters is
not crude performance, but...
Pre/post-processing
What ultimately matters is
not crude performance, but...

Acceptance to users (much
harder to measure & depends
on domain).
Pre/post-processing
What ultimately matters is
not crude performance, but...

Acceptance to users (much
harder to measure & depends
on domain).

Real-world is messier, than
any lab set-up.
Examples of
    pre-processing
For spellcheck:

* some people tend to use
words, separated by slashes,
like: spell/grammar check

* handling of abbreviations
Where to get data?
Well-known sources:
* Penn Tree Bank
* Wordnet
* Web1T Google N-gram Corpus
* Linguistic Data Consortium
  (http://www.ldc.upenn.edu/)
More data
Also well-known sources, but
with a twist:
* Wikipedia & Wiktionary,
DBPedia
* OpenWeb Common Crawl
(updated: 2010)
* Public APIs of some
services: Twitter, Wordnik
Obscure corpora
Academic resources:
* Stanford
* CoNLL
* Oxford (http://www.ota.ox.ac.uk/)
* CMU, MIT,...
* LingPipe, OpenNLP, NLTK,...
Human-powered?


http://goo.gl/hs4qB
Beyond corpora?

* Bootstrapping
* Seeding
And remember...
“Data is ten times more
powerful than algorithms.”
-- Peter Norvig, “The Unreasonable
Effectiveness of Data.”
http://youtu.be/yvDCzhbjYWs
Using Lisp for NLP




      (c) xkcd
Why Lisp?
Lisp is a carefully crafted
tool for:

*   Engineers
*   Practical researchers
*   Artists
*   Entrepreneurs
Some examples
*   Piano.aero
*   ITA Software
*   Secure Outcomes
*   Impromptu

* Land of Lisp
http://youtu.be/HM1Zb3xmvMc
Research
       requirements
*   Interactivity
*   Mathematical basis
*   Expressiveness
*   Agility Malleability
*   Advanced tools
Specific NLP
     requirements
* Good support for statistics
& number-crunching (matrices)
– Statistical AI

* Good support for working
with trees & symbols
– Symbolic AI
Production
       requirements
*   Scalability
*   Maintainability
*   Integrability
*   ...
...eventually

* Speed
...eventually

* Speed
* Speed
...eventually

* Speed
* Speed
* Speed
Heterogeneous
        systems
You have to split the system
and communicate:

“Java” way vs. “Unix” way

* Sockets, Redis, ZeroMQ, etc
for communication
* JSON, SEXPs, etc for data
Lisp drawbacks
There's no OpenNLP or SciPy &
generally there's fewer
libraries.
Lisp drawbacks
There's no OpenNLP or SciPy &
generally there's fewer
libraries.

But...
*   github: eslick/cl-langutils
*   github: mathematical-systems/clml
*   github: tpapp/lla
*   github: blindglobe/common-lisp-stat
*   … and http://quicklisp.org
But #2
Porter stemmer:
http://tartarus.org/~martin/PorterStemmer
& http://www.cliki.net/PorterStemmer

or Soundex:
http://www.cs.cmu.edu/afs/cs/project/ai-
repository/ai/lang/lisp/code/0.html

are irrelevant with good data
More drawbacks

Lisp is a fringe language

   Not special language
  (like R, J or Octave)
Example #1


API interaction
Example #2
Lisp FTW
* truly interactive
environment
* very flexible => DSLs
* native tree support
* fast and solid
Take-aways
* Take nlp-class

* Data is key, collect it, build tools
to work with it easily and efficiently

* A good language for R&D should be
first of all interactive & malleable,
with as few barriers as possible

* ... it also helps if you don't need to
port your code for production

* Lisp is one of the good examples
Thanks!

Vsevolod Dyomkin
    @vseloved

Más contenido relacionado

La actualidad más candente

Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
Yasir Khan
 
LangChain Intro by KeyMate.AI
LangChain Intro by KeyMate.AILangChain Intro by KeyMate.AI
LangChain Intro by KeyMate.AI
OzgurOscarOzkan
 
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
Mihai Criveti
 
Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.pdf
Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.pdfRetrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.pdf
Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.pdf
Po-Chuan Chen
 

La actualidad más candente (20)

Bert
BertBert
Bert
 
ChatGPT - AI.pdf
ChatGPT - AI.pdfChatGPT - AI.pdf
ChatGPT - AI.pdf
 
Machine learning applications nurturing growth of various business domains
Machine learning applications nurturing growth of various business domainsMachine learning applications nurturing growth of various business domains
Machine learning applications nurturing growth of various business domains
 
Sk t academy lecture note
Sk t academy lecture noteSk t academy lecture note
Sk t academy lecture note
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Artificial Intelligence (AI) Interview Questions and Answers | Edureka
Artificial Intelligence (AI) Interview Questions and Answers | EdurekaArtificial Intelligence (AI) Interview Questions and Answers | Edureka
Artificial Intelligence (AI) Interview Questions and Answers | Edureka
 
LangChain Intro by KeyMate.AI
LangChain Intro by KeyMate.AILangChain Intro by KeyMate.AI
LangChain Intro by KeyMate.AI
 
Introduction to LLMs
Introduction to LLMsIntroduction to LLMs
Introduction to LLMs
 
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
 
Deep Learning for Natural Language Processing
Deep Learning for Natural Language ProcessingDeep Learning for Natural Language Processing
Deep Learning for Natural Language Processing
 
Understanding LLM LLMOps & MLOps_open version.pdf
Understanding LLM LLMOps & MLOps_open version.pdfUnderstanding LLM LLMOps & MLOps_open version.pdf
Understanding LLM LLMOps & MLOps_open version.pdf
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Fin bert paper review !
Fin bert paper review !Fin bert paper review !
Fin bert paper review !
 
Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.pdf
Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.pdfRetrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.pdf
Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.pdf
 
Cos'è il Machine Learning?
Cos'è il Machine Learning?Cos'è il Machine Learning?
Cos'è il Machine Learning?
 
10 more lessons learned from building Machine Learning systems - MLConf
10 more lessons learned from building Machine Learning systems - MLConf10 more lessons learned from building Machine Learning systems - MLConf
10 more lessons learned from building Machine Learning systems - MLConf
 
Google's Pathways Language Model and Chain-of-Thought
Google's Pathways Language Model and Chain-of-ThoughtGoogle's Pathways Language Model and Chain-of-Thought
Google's Pathways Language Model and Chain-of-Thought
 
Intro to nlp
Intro to nlpIntro to nlp
Intro to nlp
 
고려대학교 컴퓨터학과 특강 - 대학생 때 알았더라면 좋았을 것들
고려대학교 컴퓨터학과 특강 - 대학생 때 알았더라면 좋았을 것들고려대학교 컴퓨터학과 특강 - 대학생 때 알았더라면 좋았을 것들
고려대학교 컴퓨터학과 특강 - 대학생 때 알았더라면 좋았을 것들
 
Generative Models and ChatGPT
Generative Models and ChatGPTGenerative Models and ChatGPT
Generative Models and ChatGPT
 

Destacado

Lisp for Python Programmers
Lisp for Python ProgrammersLisp for Python Programmers
Lisp for Python Programmers
Vsevolod Dyomkin
 
Чему мы можем научиться у Lisp'а?
Чему мы можем научиться у Lisp'а?Чему мы можем научиться у Lisp'а?
Чему мы можем научиться у Lisp'а?
Vsevolod Dyomkin
 
Новые нереляционные системы хранения данных
Новые нереляционные системы хранения данныхНовые нереляционные системы хранения данных
Новые нереляционные системы хранения данных
Vsevolod Dyomkin
 
Lisp как универсальная обертка
Lisp как универсальная оберткаLisp как универсальная обертка
Lisp как универсальная обертка
Vsevolod Dyomkin
 
Tedxkyiv communication guidelines
Tedxkyiv communication guidelinesTedxkyiv communication guidelines
Tedxkyiv communication guidelines
Vsevolod Dyomkin
 
Natural Language Processing in Practice
Natural Language Processing in PracticeNatural Language Processing in Practice
Natural Language Processing in Practice
Vsevolod Dyomkin
 

Destacado (19)

lisp (vs ruby) metaprogramming
lisp (vs ruby) metaprogramminglisp (vs ruby) metaprogramming
lisp (vs ruby) metaprogramming
 
NLP in the WILD or Building a System for Text Language Identification
NLP in the WILD or Building a System for Text Language IdentificationNLP in the WILD or Building a System for Text Language Identification
NLP in the WILD or Building a System for Text Language Identification
 
LISP: How I Learned To Stop Worrying And Love Parantheses
LISP: How I Learned To Stop Worrying And Love ParanthesesLISP: How I Learned To Stop Worrying And Love Parantheses
LISP: How I Learned To Stop Worrying And Love Parantheses
 
Aspects of NLP Practice
Aspects of NLP PracticeAspects of NLP Practice
Aspects of NLP Practice
 
Lisp for Python Programmers
Lisp for Python ProgrammersLisp for Python Programmers
Lisp for Python Programmers
 
Sugaring Lisp for the 21st Century
Sugaring Lisp for the 21st CenturySugaring Lisp for the 21st Century
Sugaring Lisp for the 21st Century
 
NLP Project Full Cycle
NLP Project Full CycleNLP Project Full Cycle
NLP Project Full Cycle
 
Crash-course in Natural Language Processing
Crash-course in Natural Language ProcessingCrash-course in Natural Language Processing
Crash-course in Natural Language Processing
 
Metaprogramming and Reflection in Common Lisp
Metaprogramming and Reflection in Common LispMetaprogramming and Reflection in Common Lisp
Metaprogramming and Reflection in Common Lisp
 
Lisp Machine Prunciples
Lisp Machine PrunciplesLisp Machine Prunciples
Lisp Machine Prunciples
 
Чему мы можем научиться у Lisp'а?
Чему мы можем научиться у Lisp'а?Чему мы можем научиться у Lisp'а?
Чему мы можем научиться у Lisp'а?
 
Новые нереляционные системы хранения данных
Новые нереляционные системы хранения данныхНовые нереляционные системы хранения данных
Новые нереляционные системы хранения данных
 
Lisp как универсальная обертка
Lisp как универсальная оберткаLisp как универсальная обертка
Lisp как универсальная обертка
 
Tedxkyiv communication guidelines
Tedxkyiv communication guidelinesTedxkyiv communication guidelines
Tedxkyiv communication guidelines
 
CL-NLP
CL-NLPCL-NLP
CL-NLP
 
Can functional programming be liberated from static typing?
Can functional programming be liberated from static typing?Can functional programming be liberated from static typing?
Can functional programming be liberated from static typing?
 
Экосистема Common Lisp
Экосистема Common LispЭкосистема Common Lisp
Экосистема Common Lisp
 
Crash Course in Natural Language Processing (2016)
Crash Course in Natural Language Processing (2016)Crash Course in Natural Language Processing (2016)
Crash Course in Natural Language Processing (2016)
 
Natural Language Processing in Practice
Natural Language Processing in PracticeNatural Language Processing in Practice
Natural Language Processing in Practice
 

Similar a Practical NLP with Lisp

Web data from R
Web data from RWeb data from R
Web data from R
schamber
 
Big Data Spain 2017 - Deriving Actionable Insights from High Volume Media St...
Big Data Spain 2017  - Deriving Actionable Insights from High Volume Media St...Big Data Spain 2017  - Deriving Actionable Insights from High Volume Media St...
Big Data Spain 2017 - Deriving Actionable Insights from High Volume Media St...
Apache OpenNLP
 
Sparklis exploration et interrogation de points d'accès sparql par interactio...
Sparklis exploration et interrogation de points d'accès sparql par interactio...Sparklis exploration et interrogation de points d'accès sparql par interactio...
Sparklis exploration et interrogation de points d'accès sparql par interactio...
SemWebPro
 

Similar a Practical NLP with Lisp (20)

Всеволод Демкин "Natural language processing на практике"
Всеволод Демкин "Natural language processing на практике"Всеволод Демкин "Natural language processing на практике"
Всеволод Демкин "Natural language processing на практике"
 
The State of #NLProc
The State of #NLProcThe State of #NLProc
The State of #NLProc
 
Web data from R
Web data from RWeb data from R
Web data from R
 
Survey of Program Transformation Technologies
Survey of Program Transformation TechnologiesSurvey of Program Transformation Technologies
Survey of Program Transformation Technologies
 
Nautral Langauge Processing - Basics / Non Technical
Nautral Langauge Processing - Basics / Non Technical Nautral Langauge Processing - Basics / Non Technical
Nautral Langauge Processing - Basics / Non Technical
 
Perl::Lint - Yet Another Perl Source Code Linter
Perl::Lint - Yet Another Perl Source Code LinterPerl::Lint - Yet Another Perl Source Code Linter
Perl::Lint - Yet Another Perl Source Code Linter
 
Perl Myths 200909
Perl Myths 200909Perl Myths 200909
Perl Myths 200909
 
What we can learn from Rebol?
What we can learn from Rebol?What we can learn from Rebol?
What we can learn from Rebol?
 
Python: The Programmer's Lingua Franca
Python: The Programmer's Lingua FrancaPython: The Programmer's Lingua Franca
Python: The Programmer's Lingua Franca
 
Php extensions
Php extensionsPhp extensions
Php extensions
 
An Introduction to NLP4L
An Introduction to NLP4LAn Introduction to NLP4L
An Introduction to NLP4L
 
Chris Brew - TR Discover: A Natural Language Interface for Exploring Linked D...
Chris Brew - TR Discover: A Natural Language Interface for Exploring Linked D...Chris Brew - TR Discover: A Natural Language Interface for Exploring Linked D...
Chris Brew - TR Discover: A Natural Language Interface for Exploring Linked D...
 
Docopt, beautiful command-line options for R, user2014
Docopt, beautiful command-line options for R,  user2014Docopt, beautiful command-line options for R,  user2014
Docopt, beautiful command-line options for R, user2014
 
Devfest kyoto2018 Lisp-Koans
Devfest kyoto2018 Lisp-KoansDevfest kyoto2018 Lisp-Koans
Devfest kyoto2018 Lisp-Koans
 
Big Data Spain 2017 - Deriving Actionable Insights from High Volume Media St...
Big Data Spain 2017  - Deriving Actionable Insights from High Volume Media St...Big Data Spain 2017  - Deriving Actionable Insights from High Volume Media St...
Big Data Spain 2017 - Deriving Actionable Insights from High Volume Media St...
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
Natural Language Processing using Java
Natural Language Processing using JavaNatural Language Processing using Java
Natural Language Processing using Java
 
NLP Data Cleansing Based on Linguistic Ontology Constraints
NLP Data Cleansing Based on Linguistic Ontology ConstraintsNLP Data Cleansing Based on Linguistic Ontology Constraints
NLP Data Cleansing Based on Linguistic Ontology Constraints
 
Sparklis exploration et interrogation de points d'accès sparql par interactio...
Sparklis exploration et interrogation de points d'accès sparql par interactio...Sparklis exploration et interrogation de points d'accès sparql par interactio...
Sparklis exploration et interrogation de points d'accès sparql par interactio...
 
Elasticsearch Basics
Elasticsearch BasicsElasticsearch Basics
Elasticsearch Basics
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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)
 
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
 
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...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Practical NLP with Lisp

  • 1. Practical NLP with Lisp Vsevolod Dyomkin Grammarly
  • 2. Topics * Overview of NLP practice * Getting Data * Using Lisp: pros & cons * A couple of examples
  • 3. A bit about Grammarly (c) xkcd
  • 4. An example of what we deal with
  • 5. NLP practice R - research work: set a goal → devise an algorithm → train the algorithm → test its accuracy
  • 6. NLP practice R - research work: set a goal → devise an algorithm → train the algorithm → test its accuracy D - development work: implement the algorithm as an API with sufficient performance and scaling characteristics
  • 7. Research 1. Set a goal Business goal: * Develop best/good enough/better than Word/etc spellchecker * Develop a set of grammar rules, that will catch errors according to MLA Style * Develop a thesaurus, that will produce synonyms relevant to context
  • 8. Translate it to measurable goal * On a test corpus of 10000 sentences with common errors achieve smaller number of FNs (and FPs), that other spellcheckers/Word spellchecker/etc * On a corpus of examples of sentences with each kind of error (and similar sentences without this kind of error) find all sentences with errors and do not find errors in correct sentences * On a test corpus of 1000 sentences suggest synonyms for all meaningful words that will be considered relevant by human linguists in 90% of the cases
  • 9. A Note on Terminology FN and FP instead of precision (P), recall (R) FN = 1-R FP = 1-P or ??? f1 = P*R/(P+R) = (1-FN-FP+FN*FP)/(2-(FN+FP))
  • 10. Research contd. 2. Devise an algorithm 3. Train & improve the algorithm
  • 11. Research contd. 2. Devise an algorithm 3. Train & improve the algorithm http://nlp-class.org
  • 12. 4. Test its performance ML: one corpus, divided into training,development,test
  • 13. 4. Test its performance ML: one corpus, divided into training,development,test Often — different corpora: * for training some part (not whole) of the algorithm * for testing the whole system
  • 14. Theoretical maxima Theoretical maxima are rarely achievable. Why?
  • 15. Theoretical maxima Theoretical maxima are rarely achievable. Why? * Because you need their data. (And data is key)
  • 16. Theoretical maxima Theoretical maxima are rarely achievable. Why? * Because you need their data. (And data is key) * Domains might differ
  • 17. Pre/post-processing What ultimately matters is not crude performance, but...
  • 18. Pre/post-processing What ultimately matters is not crude performance, but... Acceptance to users (much harder to measure & depends on domain).
  • 19. Pre/post-processing What ultimately matters is not crude performance, but... Acceptance to users (much harder to measure & depends on domain). Real-world is messier, than any lab set-up.
  • 20. Examples of pre-processing For spellcheck: * some people tend to use words, separated by slashes, like: spell/grammar check * handling of abbreviations
  • 21. Where to get data? Well-known sources: * Penn Tree Bank * Wordnet * Web1T Google N-gram Corpus * Linguistic Data Consortium (http://www.ldc.upenn.edu/)
  • 22. More data Also well-known sources, but with a twist: * Wikipedia & Wiktionary, DBPedia * OpenWeb Common Crawl (updated: 2010) * Public APIs of some services: Twitter, Wordnik
  • 23. Obscure corpora Academic resources: * Stanford * CoNLL * Oxford (http://www.ota.ox.ac.uk/) * CMU, MIT,... * LingPipe, OpenNLP, NLTK,...
  • 26. And remember... “Data is ten times more powerful than algorithms.” -- Peter Norvig, “The Unreasonable Effectiveness of Data.” http://youtu.be/yvDCzhbjYWs
  • 27. Using Lisp for NLP (c) xkcd
  • 28. Why Lisp? Lisp is a carefully crafted tool for: * Engineers * Practical researchers * Artists * Entrepreneurs
  • 29. Some examples * Piano.aero * ITA Software * Secure Outcomes * Impromptu * Land of Lisp http://youtu.be/HM1Zb3xmvMc
  • 30. Research requirements * Interactivity * Mathematical basis * Expressiveness * Agility Malleability * Advanced tools
  • 31. Specific NLP requirements * Good support for statistics & number-crunching (matrices) – Statistical AI * Good support for working with trees & symbols – Symbolic AI
  • 32. Production requirements * Scalability * Maintainability * Integrability * ...
  • 36. Heterogeneous systems You have to split the system and communicate: “Java” way vs. “Unix” way * Sockets, Redis, ZeroMQ, etc for communication * JSON, SEXPs, etc for data
  • 37. Lisp drawbacks There's no OpenNLP or SciPy & generally there's fewer libraries.
  • 38. Lisp drawbacks There's no OpenNLP or SciPy & generally there's fewer libraries. But... * github: eslick/cl-langutils * github: mathematical-systems/clml * github: tpapp/lla * github: blindglobe/common-lisp-stat * … and http://quicklisp.org
  • 39. But #2 Porter stemmer: http://tartarus.org/~martin/PorterStemmer & http://www.cliki.net/PorterStemmer or Soundex: http://www.cs.cmu.edu/afs/cs/project/ai- repository/ai/lang/lisp/code/0.html are irrelevant with good data
  • 40. More drawbacks Lisp is a fringe language Not special language (like R, J or Octave)
  • 43. Lisp FTW * truly interactive environment * very flexible => DSLs * native tree support * fast and solid
  • 44. Take-aways * Take nlp-class * Data is key, collect it, build tools to work with it easily and efficiently * A good language for R&D should be first of all interactive & malleable, with as few barriers as possible * ... it also helps if you don't need to port your code for production * Lisp is one of the good examples