Supervised and Unsupervised learning for Natural language processing Manaal Faruqui Language Technologies Institute SCS, CMU.

Download Report

Transcript Supervised and Unsupervised learning for Natural language processing Manaal Faruqui Language Technologies Institute SCS, CMU.

Supervised and Unsupervised learning for Natural language processing Manaal Faruqui

Language Technologies Institute SCS, CMU

Natural Language Processing

+ Linguistics Computer Science

But Why ?

Natural Language Processing

• Inability to handle large amount of data • Much much faster information access

Natural Language Processing

How can this be done ?

• Can you teach a computer ?

Natural Language Processing

=

Mathematics

Are you kidding me !

Using Maths to learn language ???

Machine Learning

Teaching computers make decisions like humans Computer vision Machine Translation Clustering

Machine Learning

Supervised Unsupervised Learning by examples Learning by patterns Semi supervised Learning by patterns + examples

Formal & Informal address

• Most languages distinguish formal (V) and informal (T) address in direct speech (Brown and Gilman, 1960) • Formal address: Neutrality, distance • Informal address: Friends, subordinates • Variety of realization in different languages • French: Pronoun usage (Vous/Tu) • German: Pronoun usage (Sie/Du) • Hindi: Pronoun usage (Aap/Tum) • Japanese: Verbal inflections • English: ???

Main goals of this work

• Goal 1 : Determine whether English distinguishes • between V & T consistently If yes, what are the indicators ?

• Goal 2: Develop a computational model that labels English sentences as T or V • Ideally without spending effort on annotation

Methodology

• Use a parallel corpus to analyze aligned sentences with

overt

(De) T/V choice and

covert

(En) T/V choice • For Goal 1: Compare De & En sentences • For Goal 2 : Project De labels onto En sentences

Digression: Creation of a parallel corpus

• Current parallel corpora not suitable • Europarl: Overwhelmingly formal (99%) • Newswire: No dialogue • Creation of a new corpus: De-En literary texts • 106 19 th century novels (Project Gutenberg) • Sentence-aligned: Gargantuan (Braune & Fraser 2010) • POS-tagged (Schmidt 1994) • • German sentence can be labeled as T, V or None Using orthographic rules • Corpus: http://cs.cmu.edu/~mfaruqui

Goal 1: Compare De and En address

• Give English monolingual text to human annotators • Ask for T/V judgment • Their annotation provides the following information • How well do annotators agree on English text?

• Does English monolingual text provide enough information to identify T/V? (1a) • How well do annotators agree with copied labels? • Is there a direct correspondence ? (1b) • Only if this is the case is the copying of labels appropriate

Experiment 1: Human Annotation

• 200 randomly drawn English sentences • Two annotators (“A1”, “A2”) • Two conditions: – No context: just one sentence – In context: three sentences pre- and post-context each

A1 vs. A2

Results: Reliability

No Context

.75 (k=.49)

In Context

.79 (k=.58) • • Context improves reliability – Many sentences can not be tagged with T/V in isolation

“And she is a sort of relation of your lordship’s,” said Dawson. “And perhaps sometime you may see her.”

Goal 1a

✓ Reliability in context is reasonable: • English does provide strong clues on T/V

Results: Correspondence

(A1 ∩ A2) vs. Projection

No Context

.67 (k=.34)

In Context

.79 (k=.58) • Agreement with German projected labels again reasonable, but not perfect Goal 1b ✓ • Error analysis showed strong influence of social norms • Example: Lovers in 19 th cent. novels use V (!)

[...] she covered her face with the other to conceal her tears. “Corinne!”, said Oswald, “Dear Corinne! My absence has then rendered you unhappy!”

Experiment 2: Prediction of T/V

• Copy German T/V labels onto English: No annotation • Learn L2-regularized logit classifier on train set; optimize on dev set; evaluate on test set • Feature candidates : – Lexical features (bag-of-words, χ² feature selection) – Distributional semantic word classes • 200 word classes clustered with the algorithm by Clark (2003) – Politeness theory (Brown & Levinson 2003) • Polite speech has specific features, which are inherited by V

Supervised Learning

Logistic regression classifier • Linear combination of features • Every feature assigned a weight acc. to its importance • higher weight = more importance • L2 regularization to avoid overfitting • Used “Weka” as the open-source toolkit

Context

• As shown by human annotation: Individual sentences often insufficient for classification • Simplest solution: Compute features over a window of context sentences – Problem: context typically includes non-speech sentences

“I am going to see his ghost!” Lorry quietly chafed the hands that held his arm.

Context

• Our solution: A simple “direct speech” recognizer CRF-based sequence tagger (Mallet) trained on 1000 sentences • Ideal results for

8 sentences of direct speech context

+5% accuracy over no context

B-SP:

“I am going to see his ghost!”

O:

Lorry quietly chafed the hands that held his arm.

Speech context Sentence context

Quantitative results

(Faruqui & Pado, 2011; 2012)

Model

Frequency BL (V) Lexical features Semantic class features Politeness features

Accuracy

59.1

67.0

57.5

59.6

• Only lexical features yield significant improvement over frequency baseline

Goal 2

Qualitative analysis: Lexical features

Top 10 lexical features

Conclusions

• Formal and informal language exists in English as well – Indicators more dispersed across context • Bootstrapping a T/V classifier for English possible • Results still fairly modest – Asymmetry: V more marked than T → better features – Difficult to operationalize features with high recall (sociolinguistic features, first names, …)

• • • • • • •

References

M. Faruqui & S. Pado, “I thou thee, thou traitor”: Predicting formal vs. informal address in English literature. ACL 2011.

M. Faruqui & S. Pado, Towards a model of formal and informal address in English. EACL 2012.

Roger Brown and Albert Gilman. 1960. The pronouns of power and solidarity. In Thomas A. Sebeok, editor, Style in Language, pages 253–277. MIT Press, Cambridge, MA.

Penelope Brown and Stephen C. Levinson. 1987. Politeness: Some Universals in Language Usage. Number 4 in Studies in Interactional Sociolinguistics. Cambridge University Press.

Fabienne Braune & Alexander Fraser. Improved unsupervised sentence alignment for symmetrical and asymmetrical parallel corpora. COLING 2010 Helmut Schmid. 1994. Probabilistic Part-of-Speech Tagging Using Decision Trees. In Proceedings of the International Conference on New Methods in Language Processing, pages 44–49, Manchester, UK.

Andrew Kachites McCallum. 2002. Mallet: A machine learning for language toolkit. http://mallet.cs.umass.edu.

Unsupervised Learning

Learning by finding patterns in data Clustering

Word clustering

Why ?

• • Feature reduction From words to word classes • • Generalization of unseen words Bangalore ~ Bengaluru • • Identification of words with similar meaning Word-sense disambiguation • Reduces the need for tagged data

Word clustering

How ?

• • Distributional similarity How similar is the occurrence pattern of two words in a given corpus ?

“You shall know a word by the company it keeps” – J. R. Firth

• • • • Morphological similarity How similar are two words orthographically ?

Madras ~ Chennai … NO B angalore ~ Bengaluru … YES

Word clustering

Language modeling approach

1. Ranjitha cooks Uttapam .

2. Ranjitha cooks Rava masala dosa .

3. Ranjitha cooks Facebook .

How do you know which one is wrong ??

Word clustering

Language modeling approach • Maximize the probability of occurrence of a sequence of words

S: Ranjitha cooks Facebook

• P(S) = P(Ranjitha) * P(cooks|Ranjitha) * P(Facebook|cooks) • P(Facebook|cooks) will be very near zero OR zero !

C 1

Word clustering

S: w 1 w 2 w 3 w 4 C 2 C 3 C 4 W 1 W 2 W 3 W 4 P(S) = P(C 1 ) * P(w 1 |C 1 ) * P(C 2 |C 1 ) * P(w 2 |C 2 ) * … (Och, 1999) This is called a Hidden-Markov Model (HMM)

Word clustering

Adding morphology (Clark, 2003) C 1 C 2 C 3 C 4 W 1 W 2 W 3 W 4 P(S) = P(C 1 ) * P(w 1 |C 1 ) * P m (w 1 |C 1 ) * P(C 2 |C 1 ) * P(w 2 |C 2 ) * P m (w 2 |C 2 ) …

Word clustering

Implementation • Initialization of clusters • Randomized • Heuristic-based • Optimization algorithm • Greedy as closed form solution not present • Transfer word to the cluster with highest improvement • Termination • Till no more words are exchanged • Till a specific no. of words are exchanged

Word clustering

Application / Evaluation • Named Entity Recognition • Identification and labeling of names of people, places, organization etc.

• Pre-processing task for many NLP applications • Tags from the CoNLL-03 shared-task on NER: • PERson, ORGanization, LOCation, MISCellaneous

(Sonia Gandhi) PER is an (Italian) MISC who lives in (India) LOC .

Named Entity Recognition

NER for German: Challenges Complex Morphology: Difficult lemmatization Sparse data: Only one NE tagged dataset (CoNLL 2003) Common noun capitalization: no easy entity detection Poor performance, in particular poor Recall

Named Entity Recognition

NER for German: Challenges English German

Recall

88.5%

63.7% Precision F-Score

89.0% 83.9% 88.8% 72.4% Recall is a problem !

• More amount of training data can help, but expensive !

• Semantic generalization ?

Named Entity Recognition

Word clustering • Provides a way to semantic generalization But how can it help ? Deutschland (70) Ostdeutschland(0) Westdeutschland(5) LOC

Named Entity Recognition

Experimental setup • Cluster German words with Clark’s clustering software on the basis of an untagged generalization corpus • HGC, deWac (Baroni et. al, 2009) • Stanford’s CRF-based NER system (Finkel and Manning 2009) • Training on an NER-tagged corpus (CoNLL 2003 German train set newswire) • Evaluate on CoNLL 2003 testb set (50M words, in-domain)

Named Entity Recognition

Results (Faruqui & Pado, 2010)

Recall

Florian et. al 2003 Baseline (0/0) HGC (175m/600) deWac (175m/400) 83.9% 84.5%

86.6%

86.4%

Precision

63.7% 63.1%

71.2%

68.5%

F-Score

72.4% 72.3%

78.2%

76.4%

Multilingual word clustering

• Clustering words from two languages together • If parallel data in two languages available • Word alignments can give additional information • Additional constraints may give better clustering I You We They She Ich Sie Uns Er

Language 1

Multilingual word clustering

Language 2

Language 1

Multilingual word clustering

Language 2

Multilingual word clustering

• Minimize the randomness of the clustering • Minimize the entropy of the clustering • If clustering of L 1 is represented by a random variable X • We want to minimize the entropy of one clustering given the other:

Multilingual word clustering

• We optimize both the monolingual and multilingual objective together: • Further edge filtering heuristics can be used • Words aligned with stop words generally noisy • Low frequency words are important • Finding out whether edge filtering is language dependent or not

References

• • • • • • M. Faruqui & S. Pado, Training and Evaluating a German Named Entity Recognizer with Semantic Generalization, KONVENS 2010.

Marco Baroni, Silvia Bernardini, Adriano Ferraresi, and Eros Zanchetta. 2009. The wacky wide web: A collection of very large linguistically processed web crawled corpora. JLRE, 43(3):209–226.

Alexander Clark. 2003. Combining distributional and morphological information for part of speech induction. Proc. EACL 59–66, Budapest, Hungary.

Jenny Rose Finkel and Christopher D. Manning. 2009. Nested named entity recognition. Proc. EMNLP, pages 141–150, Singapore.

Radu Florian, Abe Ittycheriah, Hongyan Jing, and Tong Zhang. 2003. Named entity recognition through classifier combination. Proc. CoNLL, pages 168– 171. Edmonton.

Erik F. Tjong Kim Sang and Fien De Meulder. 2003. Introduction to the CoNLL-2003 shared task: Language-independent named entity recognition. Proc. CoNLL, pages 142–147, Edmonton, AL

Thank you!

Questions?

Please write to: [email protected]

Or visit: http://cs.cmu.edu/~mfaruqui