<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>https://wiki.cs.hse.ru/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Polidson</id>
	<title>Wiki - Факультет компьютерных наук - Вклад [ru]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.cs.hse.ru/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Polidson"/>
	<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/%D0%A1%D0%BB%D1%83%D0%B6%D0%B5%D0%B1%D0%BD%D0%B0%D1%8F:%D0%92%D0%BA%D0%BB%D0%B0%D0%B4/Polidson"/>
	<updated>2026-09-21T12:21:43Z</updated>
	<subtitle>Вклад</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_6._Synonyms_and_near-synonyms_detection&amp;diff=17082</id>
		<title>Lecture 6. Synonyms and near-synonyms detection</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_6._Synonyms_and_near-synonyms_detection&amp;diff=17082"/>
		<updated>2015-09-03T00:41:01Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Web or corpus search approach */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Examples ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Synonyms&#039;&#039;&#039;: Netherlands and Holland, buy and purchase&lt;br /&gt;
* &#039;&#039;&#039;Near synonyms&#039;&#039;&#039;: pants, trousers and slacks, mistake and error&lt;br /&gt;
&lt;br /&gt;
== Approaches to synonyms and near-synonyms detection ==&lt;br /&gt;
&lt;br /&gt;
* Thesaurus-based approach&lt;br /&gt;
* Distributional semantics&lt;br /&gt;
* Context-based approach&lt;br /&gt;
* word2vec&lt;br /&gt;
* Web search-based approach&lt;br /&gt;
&lt;br /&gt;
=== Synonyms in WordNet ===&lt;br /&gt;
&lt;br /&gt;
Given a word, look for synonyms in every synset.&lt;br /&gt;
&lt;br /&gt;
==== WordNet NLTK interface ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: for i,j in enumerate(wn.synsets(&#039;error&#039;)):&lt;br /&gt;
&lt;br /&gt;
In[2]: print &amp;quot;Meaning&amp;quot;,i, &amp;quot;NLTK ID:&amp;quot;, j.name()&lt;br /&gt;
&lt;br /&gt;
In[3]: print &amp;quot;Definition:&amp;quot;,j.definition()&lt;br /&gt;
&lt;br /&gt;
In[4]: print &amp;quot;Synonyms:&amp;quot;, &amp;quot;, &amp;quot;.join(j.lemma names())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wordnet Web interface: [http://wordnetweb.princeton.edu/perl/webwn|http://wordnetweb.princeton.edu/perl/webwn]&lt;br /&gt;
&lt;br /&gt;
=== Distributional semantics ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p1.jpg|500px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
 &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
==== Exercise 6.1 ==== &lt;br /&gt;
&lt;br /&gt;
Calculate PPMI for Table 1.&lt;br /&gt;
&lt;br /&gt;
==== Exercise 6.2 ==== &lt;br /&gt;
&lt;br /&gt;
Input: def.txt or your own text&lt;br /&gt;
&lt;br /&gt;
Output 1: term-context matrix&lt;br /&gt;
&lt;br /&gt;
Output 2: term-term similarity matrix (use cosine similarity)&lt;br /&gt;
&lt;br /&gt;
Output 3: 2D visualization by means of LSA&lt;br /&gt;
&lt;br /&gt;
Hint: use cfd = nltk.ConditionalFreqDist((term, context) for ...) for computing conditional frequency dictionary&lt;br /&gt;
&lt;br /&gt;
Hint: use R for SVD and visualization&lt;br /&gt;
&lt;br /&gt;
=== word2vec [Mikolov, Chen, Corrado, Dean, 2013] ===&lt;br /&gt;
&lt;br /&gt;
Very complex machine learning (deep learning) applied to term-context matrices. &lt;br /&gt;
&lt;br /&gt;
There are two regimes:&lt;br /&gt;
* CBOW predicts the current word based on the context&lt;br /&gt;
* Skip-gram predicts surrounding words given the current word&lt;br /&gt;
&lt;br /&gt;
word2vec project page: [https://code.google.com/p/word2vec/|https://code.google.com/p/word2vec/]&lt;br /&gt;
demo: [http://rare-technologies.com/word2vec-tutorial/|http://rare-technologies.com/word2vec-tutorial/]&lt;br /&gt;
&lt;br /&gt;
Example: vec(Madrid) - vec(Spain) + vec(France) = vec(Paris)&lt;br /&gt;
&lt;br /&gt;
=== Context-based approach (1) [Lin, 1998] ===&lt;br /&gt;
&lt;br /&gt;
==== Dependency triple [Lin, 1998] ====&lt;br /&gt;
&lt;br /&gt;
A dependency triple (w, r, w&#039;) consists of two words and the grammatical relationship between them in the input sentence. &lt;br /&gt;
&lt;br /&gt;
I have a brown dog: (have subj I), (I subj-of have), (dog obj-of have), (dog adj-mod brown), (brown adj-mod-of dog), (dog det a), (a det-of dog)&lt;br /&gt;
&lt;br /&gt;
||w, r, w&#039;|| — frequency of (w, r, w&#039;)&lt;br /&gt;
&lt;br /&gt;
||w, r, * || — total occurrences of w-r relationships&lt;br /&gt;
&lt;br /&gt;
|| *, *, *|| — total number of dependency triples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mutual information between w, w&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p2.jpg|300px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p3.jpg|450px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;   &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Results: &#039;&#039;&#039;brief(noun)&#039;&#039;&#039; — affidavit 0.13, petition 0.05, memo-randum 0.05, motion 0.05, lawsuit 0.05, depo-sition 0.05, slight 0.05, prospectus 0.04, docu-ment 0.04 paper 0.04 &lt;br /&gt;
* some sort of dependency parsing is required&lt;br /&gt;
* no difference between synonyms and antonyms (win / loose the game)&lt;br /&gt;
&lt;br /&gt;
=== Web or corpus search approach ===&lt;br /&gt;
&lt;br /&gt;
==== Hearst patterns [Hearst, 1998] ====&lt;br /&gt;
&lt;br /&gt;
Lexico-syntactic patterns to recognize hyponymy:&lt;br /&gt;
* such NP as NP, NP and / or NP;&lt;br /&gt;
* NP such as NP, NP and / or NP;&lt;br /&gt;
* NP, NP or other NP;&lt;br /&gt;
* NP, NP and other NP;&lt;br /&gt;
* NP, including NP, NP and / or NP;&lt;br /&gt;
* NP, especially NP, NP and / or NP;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Text &amp;amp;rArr; pattern &amp;amp;rArr; concordance&lt;br /&gt;
&lt;br /&gt;
To rank concordances: PatternSim [Panchenko, Morozova, Naets]&lt;br /&gt;
&lt;br /&gt;
Concordance ranking:&lt;br /&gt;
&lt;br /&gt;
Input: Terms C, Corpus D&lt;br /&gt;
&lt;br /&gt;
Output: Similarity matrix S(C x C)&lt;br /&gt;
 &lt;br /&gt;
K &amp;amp;#8592;  extract concord(D);&lt;br /&gt;
&lt;br /&gt;
K&amp;lt;sub&amp;gt;lem &amp;lt;/sub&amp;gt; &amp;amp;#8592; lemmatize concord(K);&lt;br /&gt;
&lt;br /&gt;
KC &amp;amp;#8592; filter concord(Klem; C);&lt;br /&gt;
&lt;br /&gt;
S &amp;amp;#8592; get extractionfreq(C;K);&lt;br /&gt;
&lt;br /&gt;
S &amp;amp;#8592; rerank(S; C;D);&lt;br /&gt;
&lt;br /&gt;
S &amp;amp;#8592; normalize(S);&lt;br /&gt;
&lt;br /&gt;
return S&lt;br /&gt;
&lt;br /&gt;
Example ranking &#039;&#039;&#039;Efreq-Cfreq&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p4.jpg|250px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
P(w&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;)  — frequency of (w&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;) P(w&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;, w&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt;) — extraction probability of (w&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;,w&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt;)&lt;br /&gt;
demo: [http://serelex.cental.be/|http://serelex.cental.be/]&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L6p4.jpg&amp;diff=17081</id>
		<title>Файл:L6p4.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L6p4.jpg&amp;diff=17081"/>
		<updated>2015-09-03T00:39:51Z</updated>

		<summary type="html">&lt;p&gt;Polidson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_6._Synonyms_and_near-synonyms_detection&amp;diff=17080</id>
		<title>Lecture 6. Synonyms and near-synonyms detection</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_6._Synonyms_and_near-synonyms_detection&amp;diff=17080"/>
		<updated>2015-09-03T00:32:36Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Dependency triple [Lin, 1998] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Examples ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Synonyms&#039;&#039;&#039;: Netherlands and Holland, buy and purchase&lt;br /&gt;
* &#039;&#039;&#039;Near synonyms&#039;&#039;&#039;: pants, trousers and slacks, mistake and error&lt;br /&gt;
&lt;br /&gt;
== Approaches to synonyms and near-synonyms detection ==&lt;br /&gt;
&lt;br /&gt;
* Thesaurus-based approach&lt;br /&gt;
* Distributional semantics&lt;br /&gt;
* Context-based approach&lt;br /&gt;
* word2vec&lt;br /&gt;
* Web search-based approach&lt;br /&gt;
&lt;br /&gt;
=== Synonyms in WordNet ===&lt;br /&gt;
&lt;br /&gt;
Given a word, look for synonyms in every synset.&lt;br /&gt;
&lt;br /&gt;
==== WordNet NLTK interface ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: for i,j in enumerate(wn.synsets(&#039;error&#039;)):&lt;br /&gt;
&lt;br /&gt;
In[2]: print &amp;quot;Meaning&amp;quot;,i, &amp;quot;NLTK ID:&amp;quot;, j.name()&lt;br /&gt;
&lt;br /&gt;
In[3]: print &amp;quot;Definition:&amp;quot;,j.definition()&lt;br /&gt;
&lt;br /&gt;
In[4]: print &amp;quot;Synonyms:&amp;quot;, &amp;quot;, &amp;quot;.join(j.lemma names())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wordnet Web interface: [http://wordnetweb.princeton.edu/perl/webwn|http://wordnetweb.princeton.edu/perl/webwn]&lt;br /&gt;
&lt;br /&gt;
=== Distributional semantics ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p1.jpg|500px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
 &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
==== Exercise 6.1 ==== &lt;br /&gt;
&lt;br /&gt;
Calculate PPMI for Table 1.&lt;br /&gt;
&lt;br /&gt;
==== Exercise 6.2 ==== &lt;br /&gt;
&lt;br /&gt;
Input: def.txt or your own text&lt;br /&gt;
&lt;br /&gt;
Output 1: term-context matrix&lt;br /&gt;
&lt;br /&gt;
Output 2: term-term similarity matrix (use cosine similarity)&lt;br /&gt;
&lt;br /&gt;
Output 3: 2D visualization by means of LSA&lt;br /&gt;
&lt;br /&gt;
Hint: use cfd = nltk.ConditionalFreqDist((term, context) for ...) for computing conditional frequency dictionary&lt;br /&gt;
&lt;br /&gt;
Hint: use R for SVD and visualization&lt;br /&gt;
&lt;br /&gt;
=== word2vec [Mikolov, Chen, Corrado, Dean, 2013] ===&lt;br /&gt;
&lt;br /&gt;
Very complex machine learning (deep learning) applied to term-context matrices. &lt;br /&gt;
&lt;br /&gt;
There are two regimes:&lt;br /&gt;
* CBOW predicts the current word based on the context&lt;br /&gt;
* Skip-gram predicts surrounding words given the current word&lt;br /&gt;
&lt;br /&gt;
word2vec project page: [https://code.google.com/p/word2vec/|https://code.google.com/p/word2vec/]&lt;br /&gt;
demo: [http://rare-technologies.com/word2vec-tutorial/|http://rare-technologies.com/word2vec-tutorial/]&lt;br /&gt;
&lt;br /&gt;
Example: vec(Madrid) - vec(Spain) + vec(France) = vec(Paris)&lt;br /&gt;
&lt;br /&gt;
=== Context-based approach (1) [Lin, 1998] ===&lt;br /&gt;
&lt;br /&gt;
==== Dependency triple [Lin, 1998] ====&lt;br /&gt;
&lt;br /&gt;
A dependency triple (w, r, w&#039;) consists of two words and the grammatical relationship between them in the input sentence. &lt;br /&gt;
&lt;br /&gt;
I have a brown dog: (have subj I), (I subj-of have), (dog obj-of have), (dog adj-mod brown), (brown adj-mod-of dog), (dog det a), (a det-of dog)&lt;br /&gt;
&lt;br /&gt;
||w, r, w&#039;|| — frequency of (w, r, w&#039;)&lt;br /&gt;
&lt;br /&gt;
||w, r, * || — total occurrences of w-r relationships&lt;br /&gt;
&lt;br /&gt;
|| *, *, *|| — total number of dependency triples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mutual information between w, w&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p2.jpg|300px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p3.jpg|450px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;   &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Results: &#039;&#039;&#039;brief(noun)&#039;&#039;&#039; — affidavit 0.13, petition 0.05, memo-randum 0.05, motion 0.05, lawsuit 0.05, depo-sition 0.05, slight 0.05, prospectus 0.04, docu-ment 0.04 paper 0.04 &lt;br /&gt;
* some sort of dependency parsing is required&lt;br /&gt;
* no difference between synonyms and antonyms (win / loose the game)&lt;br /&gt;
&lt;br /&gt;
=== Web or corpus search approach ===&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_6._Synonyms_and_near-synonyms_detection&amp;diff=17079</id>
		<title>Lecture 6. Synonyms and near-synonyms detection</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_6._Synonyms_and_near-synonyms_detection&amp;diff=17079"/>
		<updated>2015-09-03T00:31:58Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Context-based approach (1) [Lin, 1998] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Examples ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Synonyms&#039;&#039;&#039;: Netherlands and Holland, buy and purchase&lt;br /&gt;
* &#039;&#039;&#039;Near synonyms&#039;&#039;&#039;: pants, trousers and slacks, mistake and error&lt;br /&gt;
&lt;br /&gt;
== Approaches to synonyms and near-synonyms detection ==&lt;br /&gt;
&lt;br /&gt;
* Thesaurus-based approach&lt;br /&gt;
* Distributional semantics&lt;br /&gt;
* Context-based approach&lt;br /&gt;
* word2vec&lt;br /&gt;
* Web search-based approach&lt;br /&gt;
&lt;br /&gt;
=== Synonyms in WordNet ===&lt;br /&gt;
&lt;br /&gt;
Given a word, look for synonyms in every synset.&lt;br /&gt;
&lt;br /&gt;
==== WordNet NLTK interface ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: for i,j in enumerate(wn.synsets(&#039;error&#039;)):&lt;br /&gt;
&lt;br /&gt;
In[2]: print &amp;quot;Meaning&amp;quot;,i, &amp;quot;NLTK ID:&amp;quot;, j.name()&lt;br /&gt;
&lt;br /&gt;
In[3]: print &amp;quot;Definition:&amp;quot;,j.definition()&lt;br /&gt;
&lt;br /&gt;
In[4]: print &amp;quot;Synonyms:&amp;quot;, &amp;quot;, &amp;quot;.join(j.lemma names())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wordnet Web interface: [http://wordnetweb.princeton.edu/perl/webwn|http://wordnetweb.princeton.edu/perl/webwn]&lt;br /&gt;
&lt;br /&gt;
=== Distributional semantics ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p1.jpg|500px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
 &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
==== Exercise 6.1 ==== &lt;br /&gt;
&lt;br /&gt;
Calculate PPMI for Table 1.&lt;br /&gt;
&lt;br /&gt;
==== Exercise 6.2 ==== &lt;br /&gt;
&lt;br /&gt;
Input: def.txt or your own text&lt;br /&gt;
&lt;br /&gt;
Output 1: term-context matrix&lt;br /&gt;
&lt;br /&gt;
Output 2: term-term similarity matrix (use cosine similarity)&lt;br /&gt;
&lt;br /&gt;
Output 3: 2D visualization by means of LSA&lt;br /&gt;
&lt;br /&gt;
Hint: use cfd = nltk.ConditionalFreqDist((term, context) for ...) for computing conditional frequency dictionary&lt;br /&gt;
&lt;br /&gt;
Hint: use R for SVD and visualization&lt;br /&gt;
&lt;br /&gt;
=== word2vec [Mikolov, Chen, Corrado, Dean, 2013] ===&lt;br /&gt;
&lt;br /&gt;
Very complex machine learning (deep learning) applied to term-context matrices. &lt;br /&gt;
&lt;br /&gt;
There are two regimes:&lt;br /&gt;
* CBOW predicts the current word based on the context&lt;br /&gt;
* Skip-gram predicts surrounding words given the current word&lt;br /&gt;
&lt;br /&gt;
word2vec project page: [https://code.google.com/p/word2vec/|https://code.google.com/p/word2vec/]&lt;br /&gt;
demo: [http://rare-technologies.com/word2vec-tutorial/|http://rare-technologies.com/word2vec-tutorial/]&lt;br /&gt;
&lt;br /&gt;
Example: vec(Madrid) - vec(Spain) + vec(France) = vec(Paris)&lt;br /&gt;
&lt;br /&gt;
=== Context-based approach (1) [Lin, 1998] ===&lt;br /&gt;
&lt;br /&gt;
==== Dependency triple [Lin, 1998] ====&lt;br /&gt;
&lt;br /&gt;
A dependency triple (w, r, w&#039;) consists of two words and the grammatical relationship between them in the input sentence. &lt;br /&gt;
&lt;br /&gt;
I have a brown dog: (have subj I), (I subj-of have), (dog obj-of have), (dog adj-mod brown), (brown adj-mod-of dog), (dog det a), (a det-of dog)&lt;br /&gt;
&lt;br /&gt;
||w, r, w&#039;|| — frequency of (w, r, w&#039;)&lt;br /&gt;
&lt;br /&gt;
||w, r, * || — total occurrences of w-r relationships&lt;br /&gt;
&lt;br /&gt;
|| *, *, *|| — total number of dependency triples&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mutual information between w, w&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p2.jpg|300px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p3.jpg|300px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Results: &#039;&#039;&#039;brief(noun)&#039;&#039;&#039; — affidavit 0.13, petition 0.05, memo-randum 0.05, motion 0.05, lawsuit 0.05, depo-sition 0.05, slight 0.05, prospectus 0.04, docu-ment 0.04 paper 0.04 &lt;br /&gt;
* some sort of dependency parsing is required&lt;br /&gt;
* no difference between synonyms and antonyms (win / loose the game)&lt;br /&gt;
&lt;br /&gt;
=== Web or corpus search approach ===&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L6p3.jpg&amp;diff=17078</id>
		<title>Файл:L6p3.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L6p3.jpg&amp;diff=17078"/>
		<updated>2015-09-03T00:29:16Z</updated>

		<summary type="html">&lt;p&gt;Polidson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L6p2.jpg&amp;diff=17077</id>
		<title>Файл:L6p2.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L6p2.jpg&amp;diff=17077"/>
		<updated>2015-09-03T00:27:48Z</updated>

		<summary type="html">&lt;p&gt;Polidson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_6._Synonyms_and_near-synonyms_detection&amp;diff=17076</id>
		<title>Lecture 6. Synonyms and near-synonyms detection</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_6._Synonyms_and_near-synonyms_detection&amp;diff=17076"/>
		<updated>2015-09-03T00:23:14Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Distributional semantics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Examples ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Synonyms&#039;&#039;&#039;: Netherlands and Holland, buy and purchase&lt;br /&gt;
* &#039;&#039;&#039;Near synonyms&#039;&#039;&#039;: pants, trousers and slacks, mistake and error&lt;br /&gt;
&lt;br /&gt;
== Approaches to synonyms and near-synonyms detection ==&lt;br /&gt;
&lt;br /&gt;
* Thesaurus-based approach&lt;br /&gt;
* Distributional semantics&lt;br /&gt;
* Context-based approach&lt;br /&gt;
* word2vec&lt;br /&gt;
* Web search-based approach&lt;br /&gt;
&lt;br /&gt;
=== Synonyms in WordNet ===&lt;br /&gt;
&lt;br /&gt;
Given a word, look for synonyms in every synset.&lt;br /&gt;
&lt;br /&gt;
==== WordNet NLTK interface ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: for i,j in enumerate(wn.synsets(&#039;error&#039;)):&lt;br /&gt;
&lt;br /&gt;
In[2]: print &amp;quot;Meaning&amp;quot;,i, &amp;quot;NLTK ID:&amp;quot;, j.name()&lt;br /&gt;
&lt;br /&gt;
In[3]: print &amp;quot;Definition:&amp;quot;,j.definition()&lt;br /&gt;
&lt;br /&gt;
In[4]: print &amp;quot;Synonyms:&amp;quot;, &amp;quot;, &amp;quot;.join(j.lemma names())&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wordnet Web interface: [http://wordnetweb.princeton.edu/perl/webwn|http://wordnetweb.princeton.edu/perl/webwn]&lt;br /&gt;
&lt;br /&gt;
=== Distributional semantics ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L6p1.jpg|500px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
 &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
==== Exercise 6.1 ==== &lt;br /&gt;
&lt;br /&gt;
Calculate PPMI for Table 1.&lt;br /&gt;
&lt;br /&gt;
==== Exercise 6.2 ==== &lt;br /&gt;
&lt;br /&gt;
Input: def.txt or your own text&lt;br /&gt;
&lt;br /&gt;
Output 1: term-context matrix&lt;br /&gt;
&lt;br /&gt;
Output 2: term-term similarity matrix (use cosine similarity)&lt;br /&gt;
&lt;br /&gt;
Output 3: 2D visualization by means of LSA&lt;br /&gt;
&lt;br /&gt;
Hint: use cfd = nltk.ConditionalFreqDist((term, context) for ...) for computing conditional frequency dictionary&lt;br /&gt;
&lt;br /&gt;
Hint: use R for SVD and visualization&lt;br /&gt;
&lt;br /&gt;
=== word2vec [Mikolov, Chen, Corrado, Dean, 2013] ===&lt;br /&gt;
&lt;br /&gt;
Very complex machine learning (deep learning) applied to term-context matrices. &lt;br /&gt;
&lt;br /&gt;
There are two regimes:&lt;br /&gt;
* CBOW predicts the current word based on the context&lt;br /&gt;
* Skip-gram predicts surrounding words given the current word&lt;br /&gt;
&lt;br /&gt;
word2vec project page: [https://code.google.com/p/word2vec/|https://code.google.com/p/word2vec/]&lt;br /&gt;
demo: [http://rare-technologies.com/word2vec-tutorial/|http://rare-technologies.com/word2vec-tutorial/]&lt;br /&gt;
&lt;br /&gt;
Example: vec(Madrid) - vec(Spain) + vec(France) = vec(Paris)&lt;br /&gt;
&lt;br /&gt;
=== Context-based approach (1) [Lin, 1998] ===&lt;br /&gt;
&lt;br /&gt;
=== Web or corpus search approach ===&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L6p1.jpg&amp;diff=17075</id>
		<title>Файл:L6p1.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L6p1.jpg&amp;diff=17075"/>
		<updated>2015-09-03T00:20:50Z</updated>

		<summary type="html">&lt;p&gt;Polidson: Polidson загружена новая версия «Файл:L6p1.jpg»&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L6p1.jpg&amp;diff=17074</id>
		<title>Файл:L6p1.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L6p1.jpg&amp;diff=17074"/>
		<updated>2015-09-03T00:20:24Z</updated>

		<summary type="html">&lt;p&gt;Polidson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17073</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17073"/>
		<updated>2015-09-03T00:09:31Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Taxonomy refinement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|350px|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|600px|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|500px|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|600px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|600px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|450px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17072</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17072"/>
		<updated>2015-09-03T00:09:06Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Reference graph */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|350px|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|600px|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|600px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|600px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|450px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17071</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17071"/>
		<updated>2015-09-03T00:08:39Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Reference graph */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|350px|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|600px|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|600px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|600px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|400px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17070</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17070"/>
		<updated>2015-09-03T00:07:55Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Taxonomy refinement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|350px|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|600px|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|600px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|600px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17069</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17069"/>
		<updated>2015-09-03T00:05:52Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Taxonomy refinement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|350px|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|500px|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|500px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|500px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17068</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17068"/>
		<updated>2015-09-03T00:05:31Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Taxonomy refinement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|350px|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|400px|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|400px|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|400px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|400px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17067</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17067"/>
		<updated>2015-09-03T00:03:11Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Taxonomy refinement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|350px|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|350px|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|350px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|350px|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17066</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17066"/>
		<updated>2015-09-03T00:02:44Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Text summarization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|350px|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17065</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17065"/>
		<updated>2015-09-03T00:02:22Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Text summarization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|350px|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17064</id>
		<title>Lecture 3. POS tagging. Key word and phrase extraction</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17064"/>
		<updated>2015-09-02T23:59:54Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Using TF-IDF to measure text similarity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Part of speech (POS) ==&lt;br /&gt;
&lt;br /&gt;
Part of speech [Manning, Shuetze, 1999]&lt;br /&gt;
&lt;br /&gt;
Words of a language are grouped into classes which show similar syntactic behavior. These word classes are called parts of speech (POS). Three&lt;br /&gt;
important parts of speech are noun, verb, and adjective. The major types of morphological process are in ection, derivation, and compounding.&lt;br /&gt;
&lt;br /&gt;
There are around 9 POS according to different schools:&lt;br /&gt;
* Nouns (NN, NP), pronouns (PN, PRP), adjectives (JJ): number, gender, case&lt;br /&gt;
* Adjective (JJ): comparative, superlative, short form&lt;br /&gt;
* Verbs (VB): subject number, subject person, tense, aspect, modality, participles, voice&lt;br /&gt;
* Adverbs (RB), prepositions (IN), conjunctions (, CS), articles (AT)&lt;br /&gt;
and particles (RP): nothing&lt;br /&gt;
&lt;br /&gt;
== POS ambiguation ==&lt;br /&gt;
&lt;br /&gt;
Ship (noun or verb?)&lt;br /&gt;
&lt;br /&gt;
* a luxury cruise ship&lt;br /&gt;
* Both products are due to ship at the beginning of June&lt;br /&gt;
* A new engine was shipped over from the US&lt;br /&gt;
* The port is closed to all &#039;&#039;&#039;shipping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Contest (noun or verb?)&lt;br /&gt;
* Stone decided to hold a contest to see who could write the best song.&lt;br /&gt;
* She plans to contest a seat in Congress next year.&lt;br /&gt;
&lt;br /&gt;
== POS taggers ==&lt;br /&gt;
&lt;br /&gt;
* Corpus- or dictionary-based VS rule-based&lt;br /&gt;
* Ngram-based taggers:&lt;br /&gt;
** unigram tagging: assign the most frequent tag&lt;br /&gt;
** ngram tagging: look at the context of n previous words (requires a lot of training data)&lt;br /&gt;
* Trade-off between the accuracy and the coverage: combine different taggers&lt;br /&gt;
&lt;br /&gt;
===NLTK POS default tagger===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.tag import pos tag&lt;br /&gt;
&lt;br /&gt;
In[2]: print pos tag([&#039;ship&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[1]: [(&#039;ship&#039;, &#039;NN&#039;)]&lt;br /&gt;
&lt;br /&gt;
In[3]: print pos tag([&#039;shipping&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[2]: [(&#039;shipping&#039;, &#039;VBG&#039;)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/api/nltk.tag.html|http://www.nltk.org/api/nltk.tag.html] for more details on&lt;br /&gt;
learning taggers.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3.1 Genre comparison ==&lt;br /&gt;
&lt;br /&gt;
Text genre [Santini, Sharoff, 2009]&lt;br /&gt;
&lt;br /&gt;
The concept of genre is hard to agree upon. Many interpretations have been proposed since Aristotles Poetics without reaching any definite&lt;br /&gt;
conclusions about the inventory or even principles for classifying documents into genres. The lack of an agreed definition of what genre is causes the problem of the loose boundaries between the term \genre&amp;quot; with other neighbouring terms, such as &amp;quot;register&amp;quot;, &amp;quot;domain&amp;quot;, &amp;quot;topic&amp;quot;, and &amp;quot;style&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise 3.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Input: Two texts of different genre (for example, Wikipedia article and&lt;br /&gt;
blog post)&lt;br /&gt;
Output: rank all of POS tags for both texts&lt;br /&gt;
&lt;br /&gt;
How can you describe the difference between two genres?&lt;br /&gt;
&lt;br /&gt;
== Key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
There are many definitions of key word and phrase. Thus there are many methods for their extraction:&lt;br /&gt;
&lt;br /&gt;
* supervised VS unsupervised&lt;br /&gt;
* frequency-based VS more complex&lt;br /&gt;
* from individual text VS from text collection&lt;br /&gt;
* word (unigram) VS bigram VS ngram&lt;br /&gt;
* term VS named entity VS collocation&lt;br /&gt;
* sequential words VS using window&lt;br /&gt;
&lt;br /&gt;
== Supervised methods for key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
I am a word. Am I a key word? Let us build a classifier.&lt;br /&gt;
&lt;br /&gt;
* Am I in the beginning or in the end of the sentence?&lt;br /&gt;
* Am I capitalized?&lt;br /&gt;
* How many times do I occur?&lt;br /&gt;
* Am I used in Wikipedia as a title of a category or an article?&lt;br /&gt;
* Am I a term?&lt;br /&gt;
* Am I a NE?&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
But we need a collection of marked up texts!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase extraction from a single text ==&lt;br /&gt;
&lt;br /&gt;
* POS patterns&lt;br /&gt;
* Association measures: PMI, T-Score, LLR&lt;br /&gt;
* Graph methods: TextRank [Mihalcea, Tarau, 2004]&lt;br /&gt;
* Syntactic patterns&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.2 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif1.txt (or your own text)&lt;br /&gt;
&lt;br /&gt;
Key word: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; NN&lt;br /&gt;
&lt;br /&gt;
Key phrase: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; phrases, that satisfy the following patterns: JJ + NN, NN + NN, NN + IN + NN&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases&lt;br /&gt;
&lt;br /&gt;
Hint: use nltk.ngrams to get ngrams.&lt;br /&gt;
&lt;br /&gt;
== Bigram association measures ==&lt;br /&gt;
&lt;br /&gt;
==== Pointwise Mutual Information [Manning, Shuetze, 1999] ==== &lt;br /&gt;
&lt;br /&gt;
PMI measures the reduction of uncertainty about the occurrence of one&lt;br /&gt;
word when we are told about the occurrence of the other one.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p1.jpg|350px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== T-Score [Manning, Shuetze, 1999] ====&lt;br /&gt;
&lt;br /&gt;
T-Score is a statistical t-test applied to finding collocations. The t-test&lt;br /&gt;
looks at the difference between the observed and expected means, scaled&lt;br /&gt;
by the variance of the data. The T-score is most useful as a method for&lt;br /&gt;
ranking collocations. The level of significance itself is less useful.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p2.jpg|300px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p3.jpg|400px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
But Chi-squared has many other interesting applications.&lt;br /&gt;
&lt;br /&gt;
==== Chi-squared [Manning, Shuetze, 1999] ====&lt;br /&gt;
In general, for the problem of finding collocation, the difference between the T-score and the Chi-squared does not seem to be large.&lt;br /&gt;
&lt;br /&gt;
=== Bigram association measures in NLTK ===&lt;br /&gt;
&lt;br /&gt;
==== NLTK BigramCollocationFinder ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.collocations import *&lt;br /&gt;
&lt;br /&gt;
In[2]: bigram measures = nltk.collocations.BigramAssocMeasures()&lt;br /&gt;
&lt;br /&gt;
In[3]: finder = BigramCollocationFinder.from words(tokens)&lt;br /&gt;
&lt;br /&gt;
In[4]: finder.apply freq filter(3)&lt;br /&gt;
&lt;br /&gt;
In[5]: for i in finder.nbest(bigram measures.pmi, 20):&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bigram measures:&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.pmi &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.student_t &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.chi_sq &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; igram measures.likelihood_ratio &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/_modules/nltk/metrics/association.html|http://www.nltk.org/_modules/nltk/metrics/association.html] for more more bigram association measures.&lt;br /&gt;
&lt;br /&gt;
== TextRank: using graph centrality measures for key word and phrase extraction [Mihalcea, Tarau, 2004] ==&lt;br /&gt;
&lt;br /&gt;
# Add words as vertices in the graph.&lt;br /&gt;
# Identify relations that connect words:&lt;br /&gt;
## consequent words;&lt;br /&gt;
## words inside (left or right) the window (2-5 words); and use these relations to draw edges between vertices in the graph. Edges can be directed or undirected, weighted or unweighted.&lt;br /&gt;
# Iterate the graph-based ranking algorithm until convergence (for example, PageRank).&lt;br /&gt;
# Sort vertices based on their final score. Use the values attached to each vertex for ranking/selection decisions.&lt;br /&gt;
# If two adjacent words are selected as potential keywords by TextRank, collapse them into one single key phrase.&lt;br /&gt;
&lt;br /&gt;
See original paper: [http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf|http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf]&lt;br /&gt;
&lt;br /&gt;
Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types systems and systems of mixed types.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p4.jpg|обрамить|TextRank]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
G = (V, E) — a graph, V — vertices, E — edges&lt;br /&gt;
&#039;&#039;In(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that point to it&lt;br /&gt;
&#039;&#039;Out(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that &#039;&#039;V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;&#039;&#039; points to&lt;br /&gt;
Graph centrality measures:&lt;br /&gt;
&lt;br /&gt;
==== PageRank [Brin, Page, 1998] ====&lt;br /&gt;
[[Файл:L3 p5.jpg|250px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== HITS [Kleinberg, 1999] ==== &lt;br /&gt;
[[Файл:L3 p6.jpg|250px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Key words and phrases, assigned by TextRank using PageRank centrality measure: linear constraints; linear diophantine equations; natural numbers; nonstrict inequations; strict inequations; upper bounds&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.3 ====&lt;br /&gt;
&lt;br /&gt;
Input: sif.txt (or your own text) &lt;br /&gt;
Output: key words and phrases computed by PageRank (using PR(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;),HITS&amp;lt;small&amp;gt;A&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) and HITS&amp;lt;small&amp;gt;H&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) as centrality measures)&lt;br /&gt;
&lt;br /&gt;
Hint: use NetworkX for PageRank and HITS [http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html|http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html]&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase selection from a text in a collection ==&lt;br /&gt;
&lt;br /&gt;
The problem: given a collection of texts find those words and phrases (terms) that occur in this text significant frequently than in other texts.&lt;br /&gt;
&lt;br /&gt;
=== Term frequency [Luhn, 1957] === &lt;br /&gt;
&lt;br /&gt;
The weight of a term that occurs in a document is simply proportional to the term frequency.&lt;br /&gt;
&lt;br /&gt;
=== Inverse document frequency [Spaerck Jones, 1972] ===&lt;br /&gt;
&lt;br /&gt;
The specificity of a term can be quantified as an inverse function of the number of documents in which it occurs.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;tfidf (term, text, collection) = tf (term, document) × idf (term, collection)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Variants of TF and IDF weights ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p7.jpg|400px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF in NLTK ==&lt;br /&gt;
&lt;br /&gt;
===NLTK TextCollection class ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.text import TextCollection&lt;br /&gt;
&lt;br /&gt;
In[2]: collection = [WhitespaceTokenizer().tokenize(text) for text in collection]&lt;br /&gt;
&lt;br /&gt;
In[3]: corpus = TextCollection(collection)&lt;br /&gt;
&lt;br /&gt;
In[4]: for i in collection[0]: print i, corpus.tf idf(i,collection[0])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.4 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif2.txt (or your own collection of texts)&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases according to TF-IDF for one text&lt;br /&gt;
&lt;br /&gt;
Hint: &amp;lt;code&amp;gt; use sorted(mylist,key=lambda l:l[1], reverse=True) to sort mylist in descending order based on the second parameter &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF alternatives ==&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.5 ====&lt;br /&gt;
&lt;br /&gt;
Write MI and Chi-squared as an alternative for TF-IDF for measuring significance of a term in a text in a collection.&lt;br /&gt;
Check your ideas in Sebastiani[http://arxiv.org/pdf/cs/0110053.pdf|], 2001&lt;br /&gt;
&lt;br /&gt;
== Using TF-IDF to measure text similarity ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3p8.jpg|450px|слева]]&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L3p8.jpg&amp;diff=17063</id>
		<title>Файл:L3p8.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L3p8.jpg&amp;diff=17063"/>
		<updated>2015-09-02T23:59:05Z</updated>

		<summary type="html">&lt;p&gt;Polidson: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17062</id>
		<title>Lecture 3. POS tagging. Key word and phrase extraction</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17062"/>
		<updated>2015-09-02T23:57:20Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Variants of TF and IDF weights */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Part of speech (POS) ==&lt;br /&gt;
&lt;br /&gt;
Part of speech [Manning, Shuetze, 1999]&lt;br /&gt;
&lt;br /&gt;
Words of a language are grouped into classes which show similar syntactic behavior. These word classes are called parts of speech (POS). Three&lt;br /&gt;
important parts of speech are noun, verb, and adjective. The major types of morphological process are in ection, derivation, and compounding.&lt;br /&gt;
&lt;br /&gt;
There are around 9 POS according to different schools:&lt;br /&gt;
* Nouns (NN, NP), pronouns (PN, PRP), adjectives (JJ): number, gender, case&lt;br /&gt;
* Adjective (JJ): comparative, superlative, short form&lt;br /&gt;
* Verbs (VB): subject number, subject person, tense, aspect, modality, participles, voice&lt;br /&gt;
* Adverbs (RB), prepositions (IN), conjunctions (, CS), articles (AT)&lt;br /&gt;
and particles (RP): nothing&lt;br /&gt;
&lt;br /&gt;
== POS ambiguation ==&lt;br /&gt;
&lt;br /&gt;
Ship (noun or verb?)&lt;br /&gt;
&lt;br /&gt;
* a luxury cruise ship&lt;br /&gt;
* Both products are due to ship at the beginning of June&lt;br /&gt;
* A new engine was shipped over from the US&lt;br /&gt;
* The port is closed to all &#039;&#039;&#039;shipping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Contest (noun or verb?)&lt;br /&gt;
* Stone decided to hold a contest to see who could write the best song.&lt;br /&gt;
* She plans to contest a seat in Congress next year.&lt;br /&gt;
&lt;br /&gt;
== POS taggers ==&lt;br /&gt;
&lt;br /&gt;
* Corpus- or dictionary-based VS rule-based&lt;br /&gt;
* Ngram-based taggers:&lt;br /&gt;
** unigram tagging: assign the most frequent tag&lt;br /&gt;
** ngram tagging: look at the context of n previous words (requires a lot of training data)&lt;br /&gt;
* Trade-off between the accuracy and the coverage: combine different taggers&lt;br /&gt;
&lt;br /&gt;
===NLTK POS default tagger===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.tag import pos tag&lt;br /&gt;
&lt;br /&gt;
In[2]: print pos tag([&#039;ship&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[1]: [(&#039;ship&#039;, &#039;NN&#039;)]&lt;br /&gt;
&lt;br /&gt;
In[3]: print pos tag([&#039;shipping&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[2]: [(&#039;shipping&#039;, &#039;VBG&#039;)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/api/nltk.tag.html|http://www.nltk.org/api/nltk.tag.html] for more details on&lt;br /&gt;
learning taggers.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3.1 Genre comparison ==&lt;br /&gt;
&lt;br /&gt;
Text genre [Santini, Sharoff, 2009]&lt;br /&gt;
&lt;br /&gt;
The concept of genre is hard to agree upon. Many interpretations have been proposed since Aristotles Poetics without reaching any definite&lt;br /&gt;
conclusions about the inventory or even principles for classifying documents into genres. The lack of an agreed definition of what genre is causes the problem of the loose boundaries between the term \genre&amp;quot; with other neighbouring terms, such as &amp;quot;register&amp;quot;, &amp;quot;domain&amp;quot;, &amp;quot;topic&amp;quot;, and &amp;quot;style&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise 3.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Input: Two texts of different genre (for example, Wikipedia article and&lt;br /&gt;
blog post)&lt;br /&gt;
Output: rank all of POS tags for both texts&lt;br /&gt;
&lt;br /&gt;
How can you describe the difference between two genres?&lt;br /&gt;
&lt;br /&gt;
== Key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
There are many definitions of key word and phrase. Thus there are many methods for their extraction:&lt;br /&gt;
&lt;br /&gt;
* supervised VS unsupervised&lt;br /&gt;
* frequency-based VS more complex&lt;br /&gt;
* from individual text VS from text collection&lt;br /&gt;
* word (unigram) VS bigram VS ngram&lt;br /&gt;
* term VS named entity VS collocation&lt;br /&gt;
* sequential words VS using window&lt;br /&gt;
&lt;br /&gt;
== Supervised methods for key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
I am a word. Am I a key word? Let us build a classifier.&lt;br /&gt;
&lt;br /&gt;
* Am I in the beginning or in the end of the sentence?&lt;br /&gt;
* Am I capitalized?&lt;br /&gt;
* How many times do I occur?&lt;br /&gt;
* Am I used in Wikipedia as a title of a category or an article?&lt;br /&gt;
* Am I a term?&lt;br /&gt;
* Am I a NE?&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
But we need a collection of marked up texts!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase extraction from a single text ==&lt;br /&gt;
&lt;br /&gt;
* POS patterns&lt;br /&gt;
* Association measures: PMI, T-Score, LLR&lt;br /&gt;
* Graph methods: TextRank [Mihalcea, Tarau, 2004]&lt;br /&gt;
* Syntactic patterns&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.2 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif1.txt (or your own text)&lt;br /&gt;
&lt;br /&gt;
Key word: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; NN&lt;br /&gt;
&lt;br /&gt;
Key phrase: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; phrases, that satisfy the following patterns: JJ + NN, NN + NN, NN + IN + NN&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases&lt;br /&gt;
&lt;br /&gt;
Hint: use nltk.ngrams to get ngrams.&lt;br /&gt;
&lt;br /&gt;
== Bigram association measures ==&lt;br /&gt;
&lt;br /&gt;
==== Pointwise Mutual Information [Manning, Shuetze, 1999] ==== &lt;br /&gt;
&lt;br /&gt;
PMI measures the reduction of uncertainty about the occurrence of one&lt;br /&gt;
word when we are told about the occurrence of the other one.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p1.jpg|350px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== T-Score [Manning, Shuetze, 1999] ====&lt;br /&gt;
&lt;br /&gt;
T-Score is a statistical t-test applied to finding collocations. The t-test&lt;br /&gt;
looks at the difference between the observed and expected means, scaled&lt;br /&gt;
by the variance of the data. The T-score is most useful as a method for&lt;br /&gt;
ranking collocations. The level of significance itself is less useful.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p2.jpg|300px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p3.jpg|400px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
But Chi-squared has many other interesting applications.&lt;br /&gt;
&lt;br /&gt;
==== Chi-squared [Manning, Shuetze, 1999] ====&lt;br /&gt;
In general, for the problem of finding collocation, the difference between the T-score and the Chi-squared does not seem to be large.&lt;br /&gt;
&lt;br /&gt;
=== Bigram association measures in NLTK ===&lt;br /&gt;
&lt;br /&gt;
==== NLTK BigramCollocationFinder ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.collocations import *&lt;br /&gt;
&lt;br /&gt;
In[2]: bigram measures = nltk.collocations.BigramAssocMeasures()&lt;br /&gt;
&lt;br /&gt;
In[3]: finder = BigramCollocationFinder.from words(tokens)&lt;br /&gt;
&lt;br /&gt;
In[4]: finder.apply freq filter(3)&lt;br /&gt;
&lt;br /&gt;
In[5]: for i in finder.nbest(bigram measures.pmi, 20):&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bigram measures:&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.pmi &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.student_t &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.chi_sq &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; igram measures.likelihood_ratio &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/_modules/nltk/metrics/association.html|http://www.nltk.org/_modules/nltk/metrics/association.html] for more more bigram association measures.&lt;br /&gt;
&lt;br /&gt;
== TextRank: using graph centrality measures for key word and phrase extraction [Mihalcea, Tarau, 2004] ==&lt;br /&gt;
&lt;br /&gt;
# Add words as vertices in the graph.&lt;br /&gt;
# Identify relations that connect words:&lt;br /&gt;
## consequent words;&lt;br /&gt;
## words inside (left or right) the window (2-5 words); and use these relations to draw edges between vertices in the graph. Edges can be directed or undirected, weighted or unweighted.&lt;br /&gt;
# Iterate the graph-based ranking algorithm until convergence (for example, PageRank).&lt;br /&gt;
# Sort vertices based on their final score. Use the values attached to each vertex for ranking/selection decisions.&lt;br /&gt;
# If two adjacent words are selected as potential keywords by TextRank, collapse them into one single key phrase.&lt;br /&gt;
&lt;br /&gt;
See original paper: [http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf|http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf]&lt;br /&gt;
&lt;br /&gt;
Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types systems and systems of mixed types.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p4.jpg|обрамить|TextRank]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
G = (V, E) — a graph, V — vertices, E — edges&lt;br /&gt;
&#039;&#039;In(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that point to it&lt;br /&gt;
&#039;&#039;Out(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that &#039;&#039;V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;&#039;&#039; points to&lt;br /&gt;
Graph centrality measures:&lt;br /&gt;
&lt;br /&gt;
==== PageRank [Brin, Page, 1998] ====&lt;br /&gt;
[[Файл:L3 p5.jpg|250px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== HITS [Kleinberg, 1999] ==== &lt;br /&gt;
[[Файл:L3 p6.jpg|250px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Key words and phrases, assigned by TextRank using PageRank centrality measure: linear constraints; linear diophantine equations; natural numbers; nonstrict inequations; strict inequations; upper bounds&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.3 ====&lt;br /&gt;
&lt;br /&gt;
Input: sif.txt (or your own text) &lt;br /&gt;
Output: key words and phrases computed by PageRank (using PR(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;),HITS&amp;lt;small&amp;gt;A&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) and HITS&amp;lt;small&amp;gt;H&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) as centrality measures)&lt;br /&gt;
&lt;br /&gt;
Hint: use NetworkX for PageRank and HITS [http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html|http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html]&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase selection from a text in a collection ==&lt;br /&gt;
&lt;br /&gt;
The problem: given a collection of texts find those words and phrases (terms) that occur in this text significant frequently than in other texts.&lt;br /&gt;
&lt;br /&gt;
=== Term frequency [Luhn, 1957] === &lt;br /&gt;
&lt;br /&gt;
The weight of a term that occurs in a document is simply proportional to the term frequency.&lt;br /&gt;
&lt;br /&gt;
=== Inverse document frequency [Spaerck Jones, 1972] ===&lt;br /&gt;
&lt;br /&gt;
The specificity of a term can be quantified as an inverse function of the number of documents in which it occurs.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;tfidf (term, text, collection) = tf (term, document) × idf (term, collection)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Variants of TF and IDF weights ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p7.jpg|400px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF in NLTK ==&lt;br /&gt;
&lt;br /&gt;
===NLTK TextCollection class ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.text import TextCollection&lt;br /&gt;
&lt;br /&gt;
In[2]: collection = [WhitespaceTokenizer().tokenize(text) for text in collection]&lt;br /&gt;
&lt;br /&gt;
In[3]: corpus = TextCollection(collection)&lt;br /&gt;
&lt;br /&gt;
In[4]: for i in collection[0]: print i, corpus.tf idf(i,collection[0])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.4 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif2.txt (or your own collection of texts)&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases according to TF-IDF for one text&lt;br /&gt;
&lt;br /&gt;
Hint: &amp;lt;code&amp;gt; use sorted(mylist,key=lambda l:l[1], reverse=True) to sort mylist in descending order based on the second parameter &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF alternatives ==&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.5 ====&lt;br /&gt;
&lt;br /&gt;
Write MI and Chi-squared as an alternative for TF-IDF for measuring significance of a term in a text in a collection.&lt;br /&gt;
Check your ideas in Sebastiani[http://arxiv.org/pdf/cs/0110053.pdf|], 2001&lt;br /&gt;
&lt;br /&gt;
== Using TF-IDF to measure text similarity ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17061</id>
		<title>Lecture 3. POS tagging. Key word and phrase extraction</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17061"/>
		<updated>2015-09-02T23:56:31Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* HITS [Kleinberg, 1999] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Part of speech (POS) ==&lt;br /&gt;
&lt;br /&gt;
Part of speech [Manning, Shuetze, 1999]&lt;br /&gt;
&lt;br /&gt;
Words of a language are grouped into classes which show similar syntactic behavior. These word classes are called parts of speech (POS). Three&lt;br /&gt;
important parts of speech are noun, verb, and adjective. The major types of morphological process are in ection, derivation, and compounding.&lt;br /&gt;
&lt;br /&gt;
There are around 9 POS according to different schools:&lt;br /&gt;
* Nouns (NN, NP), pronouns (PN, PRP), adjectives (JJ): number, gender, case&lt;br /&gt;
* Adjective (JJ): comparative, superlative, short form&lt;br /&gt;
* Verbs (VB): subject number, subject person, tense, aspect, modality, participles, voice&lt;br /&gt;
* Adverbs (RB), prepositions (IN), conjunctions (, CS), articles (AT)&lt;br /&gt;
and particles (RP): nothing&lt;br /&gt;
&lt;br /&gt;
== POS ambiguation ==&lt;br /&gt;
&lt;br /&gt;
Ship (noun or verb?)&lt;br /&gt;
&lt;br /&gt;
* a luxury cruise ship&lt;br /&gt;
* Both products are due to ship at the beginning of June&lt;br /&gt;
* A new engine was shipped over from the US&lt;br /&gt;
* The port is closed to all &#039;&#039;&#039;shipping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Contest (noun or verb?)&lt;br /&gt;
* Stone decided to hold a contest to see who could write the best song.&lt;br /&gt;
* She plans to contest a seat in Congress next year.&lt;br /&gt;
&lt;br /&gt;
== POS taggers ==&lt;br /&gt;
&lt;br /&gt;
* Corpus- or dictionary-based VS rule-based&lt;br /&gt;
* Ngram-based taggers:&lt;br /&gt;
** unigram tagging: assign the most frequent tag&lt;br /&gt;
** ngram tagging: look at the context of n previous words (requires a lot of training data)&lt;br /&gt;
* Trade-off between the accuracy and the coverage: combine different taggers&lt;br /&gt;
&lt;br /&gt;
===NLTK POS default tagger===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.tag import pos tag&lt;br /&gt;
&lt;br /&gt;
In[2]: print pos tag([&#039;ship&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[1]: [(&#039;ship&#039;, &#039;NN&#039;)]&lt;br /&gt;
&lt;br /&gt;
In[3]: print pos tag([&#039;shipping&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[2]: [(&#039;shipping&#039;, &#039;VBG&#039;)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/api/nltk.tag.html|http://www.nltk.org/api/nltk.tag.html] for more details on&lt;br /&gt;
learning taggers.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3.1 Genre comparison ==&lt;br /&gt;
&lt;br /&gt;
Text genre [Santini, Sharoff, 2009]&lt;br /&gt;
&lt;br /&gt;
The concept of genre is hard to agree upon. Many interpretations have been proposed since Aristotles Poetics without reaching any definite&lt;br /&gt;
conclusions about the inventory or even principles for classifying documents into genres. The lack of an agreed definition of what genre is causes the problem of the loose boundaries between the term \genre&amp;quot; with other neighbouring terms, such as &amp;quot;register&amp;quot;, &amp;quot;domain&amp;quot;, &amp;quot;topic&amp;quot;, and &amp;quot;style&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise 3.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Input: Two texts of different genre (for example, Wikipedia article and&lt;br /&gt;
blog post)&lt;br /&gt;
Output: rank all of POS tags for both texts&lt;br /&gt;
&lt;br /&gt;
How can you describe the difference between two genres?&lt;br /&gt;
&lt;br /&gt;
== Key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
There are many definitions of key word and phrase. Thus there are many methods for their extraction:&lt;br /&gt;
&lt;br /&gt;
* supervised VS unsupervised&lt;br /&gt;
* frequency-based VS more complex&lt;br /&gt;
* from individual text VS from text collection&lt;br /&gt;
* word (unigram) VS bigram VS ngram&lt;br /&gt;
* term VS named entity VS collocation&lt;br /&gt;
* sequential words VS using window&lt;br /&gt;
&lt;br /&gt;
== Supervised methods for key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
I am a word. Am I a key word? Let us build a classifier.&lt;br /&gt;
&lt;br /&gt;
* Am I in the beginning or in the end of the sentence?&lt;br /&gt;
* Am I capitalized?&lt;br /&gt;
* How many times do I occur?&lt;br /&gt;
* Am I used in Wikipedia as a title of a category or an article?&lt;br /&gt;
* Am I a term?&lt;br /&gt;
* Am I a NE?&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
But we need a collection of marked up texts!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase extraction from a single text ==&lt;br /&gt;
&lt;br /&gt;
* POS patterns&lt;br /&gt;
* Association measures: PMI, T-Score, LLR&lt;br /&gt;
* Graph methods: TextRank [Mihalcea, Tarau, 2004]&lt;br /&gt;
* Syntactic patterns&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.2 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif1.txt (or your own text)&lt;br /&gt;
&lt;br /&gt;
Key word: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; NN&lt;br /&gt;
&lt;br /&gt;
Key phrase: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; phrases, that satisfy the following patterns: JJ + NN, NN + NN, NN + IN + NN&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases&lt;br /&gt;
&lt;br /&gt;
Hint: use nltk.ngrams to get ngrams.&lt;br /&gt;
&lt;br /&gt;
== Bigram association measures ==&lt;br /&gt;
&lt;br /&gt;
==== Pointwise Mutual Information [Manning, Shuetze, 1999] ==== &lt;br /&gt;
&lt;br /&gt;
PMI measures the reduction of uncertainty about the occurrence of one&lt;br /&gt;
word when we are told about the occurrence of the other one.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p1.jpg|350px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== T-Score [Manning, Shuetze, 1999] ====&lt;br /&gt;
&lt;br /&gt;
T-Score is a statistical t-test applied to finding collocations. The t-test&lt;br /&gt;
looks at the difference between the observed and expected means, scaled&lt;br /&gt;
by the variance of the data. The T-score is most useful as a method for&lt;br /&gt;
ranking collocations. The level of significance itself is less useful.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p2.jpg|300px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p3.jpg|400px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
But Chi-squared has many other interesting applications.&lt;br /&gt;
&lt;br /&gt;
==== Chi-squared [Manning, Shuetze, 1999] ====&lt;br /&gt;
In general, for the problem of finding collocation, the difference between the T-score and the Chi-squared does not seem to be large.&lt;br /&gt;
&lt;br /&gt;
=== Bigram association measures in NLTK ===&lt;br /&gt;
&lt;br /&gt;
==== NLTK BigramCollocationFinder ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.collocations import *&lt;br /&gt;
&lt;br /&gt;
In[2]: bigram measures = nltk.collocations.BigramAssocMeasures()&lt;br /&gt;
&lt;br /&gt;
In[3]: finder = BigramCollocationFinder.from words(tokens)&lt;br /&gt;
&lt;br /&gt;
In[4]: finder.apply freq filter(3)&lt;br /&gt;
&lt;br /&gt;
In[5]: for i in finder.nbest(bigram measures.pmi, 20):&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bigram measures:&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.pmi &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.student_t &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.chi_sq &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; igram measures.likelihood_ratio &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/_modules/nltk/metrics/association.html|http://www.nltk.org/_modules/nltk/metrics/association.html] for more more bigram association measures.&lt;br /&gt;
&lt;br /&gt;
== TextRank: using graph centrality measures for key word and phrase extraction [Mihalcea, Tarau, 2004] ==&lt;br /&gt;
&lt;br /&gt;
# Add words as vertices in the graph.&lt;br /&gt;
# Identify relations that connect words:&lt;br /&gt;
## consequent words;&lt;br /&gt;
## words inside (left or right) the window (2-5 words); and use these relations to draw edges between vertices in the graph. Edges can be directed or undirected, weighted or unweighted.&lt;br /&gt;
# Iterate the graph-based ranking algorithm until convergence (for example, PageRank).&lt;br /&gt;
# Sort vertices based on their final score. Use the values attached to each vertex for ranking/selection decisions.&lt;br /&gt;
# If two adjacent words are selected as potential keywords by TextRank, collapse them into one single key phrase.&lt;br /&gt;
&lt;br /&gt;
See original paper: [http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf|http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf]&lt;br /&gt;
&lt;br /&gt;
Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types systems and systems of mixed types.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p4.jpg|обрамить|TextRank]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
G = (V, E) — a graph, V — vertices, E — edges&lt;br /&gt;
&#039;&#039;In(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that point to it&lt;br /&gt;
&#039;&#039;Out(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that &#039;&#039;V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;&#039;&#039; points to&lt;br /&gt;
Graph centrality measures:&lt;br /&gt;
&lt;br /&gt;
==== PageRank [Brin, Page, 1998] ====&lt;br /&gt;
[[Файл:L3 p5.jpg|250px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== HITS [Kleinberg, 1999] ==== &lt;br /&gt;
[[Файл:L3 p6.jpg|250px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Key words and phrases, assigned by TextRank using PageRank centrality measure: linear constraints; linear diophantine equations; natural numbers; nonstrict inequations; strict inequations; upper bounds&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.3 ====&lt;br /&gt;
&lt;br /&gt;
Input: sif.txt (or your own text) &lt;br /&gt;
Output: key words and phrases computed by PageRank (using PR(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;),HITS&amp;lt;small&amp;gt;A&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) and HITS&amp;lt;small&amp;gt;H&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) as centrality measures)&lt;br /&gt;
&lt;br /&gt;
Hint: use NetworkX for PageRank and HITS [http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html|http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html]&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase selection from a text in a collection ==&lt;br /&gt;
&lt;br /&gt;
The problem: given a collection of texts find those words and phrases (terms) that occur in this text significant frequently than in other texts.&lt;br /&gt;
&lt;br /&gt;
=== Term frequency [Luhn, 1957] === &lt;br /&gt;
&lt;br /&gt;
The weight of a term that occurs in a document is simply proportional to the term frequency.&lt;br /&gt;
&lt;br /&gt;
=== Inverse document frequency [Spaerck Jones, 1972] ===&lt;br /&gt;
&lt;br /&gt;
The specificity of a term can be quantified as an inverse function of the number of documents in which it occurs.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;tfidf (term, text, collection) = tf (term, document) × idf (term, collection)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Variants of TF and IDF weights ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p7.jpg|обрамить|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF in NLTK ==&lt;br /&gt;
&lt;br /&gt;
===NLTK TextCollection class ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.text import TextCollection&lt;br /&gt;
&lt;br /&gt;
In[2]: collection = [WhitespaceTokenizer().tokenize(text) for text in collection]&lt;br /&gt;
&lt;br /&gt;
In[3]: corpus = TextCollection(collection)&lt;br /&gt;
&lt;br /&gt;
In[4]: for i in collection[0]: print i, corpus.tf idf(i,collection[0])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.4 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif2.txt (or your own collection of texts)&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases according to TF-IDF for one text&lt;br /&gt;
&lt;br /&gt;
Hint: &amp;lt;code&amp;gt; use sorted(mylist,key=lambda l:l[1], reverse=True) to sort mylist in descending order based on the second parameter &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF alternatives ==&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.5 ====&lt;br /&gt;
&lt;br /&gt;
Write MI and Chi-squared as an alternative for TF-IDF for measuring significance of a term in a text in a collection.&lt;br /&gt;
Check your ideas in Sebastiani[http://arxiv.org/pdf/cs/0110053.pdf|], 2001&lt;br /&gt;
&lt;br /&gt;
== Using TF-IDF to measure text similarity ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17060</id>
		<title>Lecture 3. POS tagging. Key word and phrase extraction</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17060"/>
		<updated>2015-09-02T23:55:56Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* PageRank [Brin, Page, 1998] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Part of speech (POS) ==&lt;br /&gt;
&lt;br /&gt;
Part of speech [Manning, Shuetze, 1999]&lt;br /&gt;
&lt;br /&gt;
Words of a language are grouped into classes which show similar syntactic behavior. These word classes are called parts of speech (POS). Three&lt;br /&gt;
important parts of speech are noun, verb, and adjective. The major types of morphological process are in ection, derivation, and compounding.&lt;br /&gt;
&lt;br /&gt;
There are around 9 POS according to different schools:&lt;br /&gt;
* Nouns (NN, NP), pronouns (PN, PRP), adjectives (JJ): number, gender, case&lt;br /&gt;
* Adjective (JJ): comparative, superlative, short form&lt;br /&gt;
* Verbs (VB): subject number, subject person, tense, aspect, modality, participles, voice&lt;br /&gt;
* Adverbs (RB), prepositions (IN), conjunctions (, CS), articles (AT)&lt;br /&gt;
and particles (RP): nothing&lt;br /&gt;
&lt;br /&gt;
== POS ambiguation ==&lt;br /&gt;
&lt;br /&gt;
Ship (noun or verb?)&lt;br /&gt;
&lt;br /&gt;
* a luxury cruise ship&lt;br /&gt;
* Both products are due to ship at the beginning of June&lt;br /&gt;
* A new engine was shipped over from the US&lt;br /&gt;
* The port is closed to all &#039;&#039;&#039;shipping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Contest (noun or verb?)&lt;br /&gt;
* Stone decided to hold a contest to see who could write the best song.&lt;br /&gt;
* She plans to contest a seat in Congress next year.&lt;br /&gt;
&lt;br /&gt;
== POS taggers ==&lt;br /&gt;
&lt;br /&gt;
* Corpus- or dictionary-based VS rule-based&lt;br /&gt;
* Ngram-based taggers:&lt;br /&gt;
** unigram tagging: assign the most frequent tag&lt;br /&gt;
** ngram tagging: look at the context of n previous words (requires a lot of training data)&lt;br /&gt;
* Trade-off between the accuracy and the coverage: combine different taggers&lt;br /&gt;
&lt;br /&gt;
===NLTK POS default tagger===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.tag import pos tag&lt;br /&gt;
&lt;br /&gt;
In[2]: print pos tag([&#039;ship&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[1]: [(&#039;ship&#039;, &#039;NN&#039;)]&lt;br /&gt;
&lt;br /&gt;
In[3]: print pos tag([&#039;shipping&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[2]: [(&#039;shipping&#039;, &#039;VBG&#039;)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/api/nltk.tag.html|http://www.nltk.org/api/nltk.tag.html] for more details on&lt;br /&gt;
learning taggers.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3.1 Genre comparison ==&lt;br /&gt;
&lt;br /&gt;
Text genre [Santini, Sharoff, 2009]&lt;br /&gt;
&lt;br /&gt;
The concept of genre is hard to agree upon. Many interpretations have been proposed since Aristotles Poetics without reaching any definite&lt;br /&gt;
conclusions about the inventory or even principles for classifying documents into genres. The lack of an agreed definition of what genre is causes the problem of the loose boundaries between the term \genre&amp;quot; with other neighbouring terms, such as &amp;quot;register&amp;quot;, &amp;quot;domain&amp;quot;, &amp;quot;topic&amp;quot;, and &amp;quot;style&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise 3.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Input: Two texts of different genre (for example, Wikipedia article and&lt;br /&gt;
blog post)&lt;br /&gt;
Output: rank all of POS tags for both texts&lt;br /&gt;
&lt;br /&gt;
How can you describe the difference between two genres?&lt;br /&gt;
&lt;br /&gt;
== Key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
There are many definitions of key word and phrase. Thus there are many methods for their extraction:&lt;br /&gt;
&lt;br /&gt;
* supervised VS unsupervised&lt;br /&gt;
* frequency-based VS more complex&lt;br /&gt;
* from individual text VS from text collection&lt;br /&gt;
* word (unigram) VS bigram VS ngram&lt;br /&gt;
* term VS named entity VS collocation&lt;br /&gt;
* sequential words VS using window&lt;br /&gt;
&lt;br /&gt;
== Supervised methods for key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
I am a word. Am I a key word? Let us build a classifier.&lt;br /&gt;
&lt;br /&gt;
* Am I in the beginning or in the end of the sentence?&lt;br /&gt;
* Am I capitalized?&lt;br /&gt;
* How many times do I occur?&lt;br /&gt;
* Am I used in Wikipedia as a title of a category or an article?&lt;br /&gt;
* Am I a term?&lt;br /&gt;
* Am I a NE?&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
But we need a collection of marked up texts!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase extraction from a single text ==&lt;br /&gt;
&lt;br /&gt;
* POS patterns&lt;br /&gt;
* Association measures: PMI, T-Score, LLR&lt;br /&gt;
* Graph methods: TextRank [Mihalcea, Tarau, 2004]&lt;br /&gt;
* Syntactic patterns&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.2 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif1.txt (or your own text)&lt;br /&gt;
&lt;br /&gt;
Key word: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; NN&lt;br /&gt;
&lt;br /&gt;
Key phrase: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; phrases, that satisfy the following patterns: JJ + NN, NN + NN, NN + IN + NN&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases&lt;br /&gt;
&lt;br /&gt;
Hint: use nltk.ngrams to get ngrams.&lt;br /&gt;
&lt;br /&gt;
== Bigram association measures ==&lt;br /&gt;
&lt;br /&gt;
==== Pointwise Mutual Information [Manning, Shuetze, 1999] ==== &lt;br /&gt;
&lt;br /&gt;
PMI measures the reduction of uncertainty about the occurrence of one&lt;br /&gt;
word when we are told about the occurrence of the other one.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p1.jpg|350px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== T-Score [Manning, Shuetze, 1999] ====&lt;br /&gt;
&lt;br /&gt;
T-Score is a statistical t-test applied to finding collocations. The t-test&lt;br /&gt;
looks at the difference between the observed and expected means, scaled&lt;br /&gt;
by the variance of the data. The T-score is most useful as a method for&lt;br /&gt;
ranking collocations. The level of significance itself is less useful.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p2.jpg|300px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p3.jpg|400px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
But Chi-squared has many other interesting applications.&lt;br /&gt;
&lt;br /&gt;
==== Chi-squared [Manning, Shuetze, 1999] ====&lt;br /&gt;
In general, for the problem of finding collocation, the difference between the T-score and the Chi-squared does not seem to be large.&lt;br /&gt;
&lt;br /&gt;
=== Bigram association measures in NLTK ===&lt;br /&gt;
&lt;br /&gt;
==== NLTK BigramCollocationFinder ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.collocations import *&lt;br /&gt;
&lt;br /&gt;
In[2]: bigram measures = nltk.collocations.BigramAssocMeasures()&lt;br /&gt;
&lt;br /&gt;
In[3]: finder = BigramCollocationFinder.from words(tokens)&lt;br /&gt;
&lt;br /&gt;
In[4]: finder.apply freq filter(3)&lt;br /&gt;
&lt;br /&gt;
In[5]: for i in finder.nbest(bigram measures.pmi, 20):&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bigram measures:&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.pmi &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.student_t &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.chi_sq &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; igram measures.likelihood_ratio &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/_modules/nltk/metrics/association.html|http://www.nltk.org/_modules/nltk/metrics/association.html] for more more bigram association measures.&lt;br /&gt;
&lt;br /&gt;
== TextRank: using graph centrality measures for key word and phrase extraction [Mihalcea, Tarau, 2004] ==&lt;br /&gt;
&lt;br /&gt;
# Add words as vertices in the graph.&lt;br /&gt;
# Identify relations that connect words:&lt;br /&gt;
## consequent words;&lt;br /&gt;
## words inside (left or right) the window (2-5 words); and use these relations to draw edges between vertices in the graph. Edges can be directed or undirected, weighted or unweighted.&lt;br /&gt;
# Iterate the graph-based ranking algorithm until convergence (for example, PageRank).&lt;br /&gt;
# Sort vertices based on their final score. Use the values attached to each vertex for ranking/selection decisions.&lt;br /&gt;
# If two adjacent words are selected as potential keywords by TextRank, collapse them into one single key phrase.&lt;br /&gt;
&lt;br /&gt;
See original paper: [http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf|http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf]&lt;br /&gt;
&lt;br /&gt;
Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types systems and systems of mixed types.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p4.jpg|обрамить|TextRank]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
G = (V, E) — a graph, V — vertices, E — edges&lt;br /&gt;
&#039;&#039;In(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that point to it&lt;br /&gt;
&#039;&#039;Out(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that &#039;&#039;V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;&#039;&#039; points to&lt;br /&gt;
Graph centrality measures:&lt;br /&gt;
&lt;br /&gt;
==== PageRank [Brin, Page, 1998] ====&lt;br /&gt;
[[Файл:L3 p5.jpg|250px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== HITS [Kleinberg, 1999] ==== &lt;br /&gt;
[[Файл:L3 p6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Key words and phrases, assigned by TextRank using PageRank centrality measure: linear constraints; linear diophantine equations; natural numbers; nonstrict inequations; strict inequations; upper bounds&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.3 ====&lt;br /&gt;
&lt;br /&gt;
Input: sif.txt (or your own text) &lt;br /&gt;
Output: key words and phrases computed by PageRank (using PR(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;),HITS&amp;lt;small&amp;gt;A&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) and HITS&amp;lt;small&amp;gt;H&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) as centrality measures)&lt;br /&gt;
&lt;br /&gt;
Hint: use NetworkX for PageRank and HITS [http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html|http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html]&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase selection from a text in a collection ==&lt;br /&gt;
&lt;br /&gt;
The problem: given a collection of texts find those words and phrases (terms) that occur in this text significant frequently than in other texts.&lt;br /&gt;
&lt;br /&gt;
=== Term frequency [Luhn, 1957] === &lt;br /&gt;
&lt;br /&gt;
The weight of a term that occurs in a document is simply proportional to the term frequency.&lt;br /&gt;
&lt;br /&gt;
=== Inverse document frequency [Spaerck Jones, 1972] ===&lt;br /&gt;
&lt;br /&gt;
The specificity of a term can be quantified as an inverse function of the number of documents in which it occurs.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;tfidf (term, text, collection) = tf (term, document) × idf (term, collection)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Variants of TF and IDF weights ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p7.jpg|обрамить|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF in NLTK ==&lt;br /&gt;
&lt;br /&gt;
===NLTK TextCollection class ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.text import TextCollection&lt;br /&gt;
&lt;br /&gt;
In[2]: collection = [WhitespaceTokenizer().tokenize(text) for text in collection]&lt;br /&gt;
&lt;br /&gt;
In[3]: corpus = TextCollection(collection)&lt;br /&gt;
&lt;br /&gt;
In[4]: for i in collection[0]: print i, corpus.tf idf(i,collection[0])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.4 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif2.txt (or your own collection of texts)&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases according to TF-IDF for one text&lt;br /&gt;
&lt;br /&gt;
Hint: &amp;lt;code&amp;gt; use sorted(mylist,key=lambda l:l[1], reverse=True) to sort mylist in descending order based on the second parameter &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF alternatives ==&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.5 ====&lt;br /&gt;
&lt;br /&gt;
Write MI and Chi-squared as an alternative for TF-IDF for measuring significance of a term in a text in a collection.&lt;br /&gt;
Check your ideas in Sebastiani[http://arxiv.org/pdf/cs/0110053.pdf|], 2001&lt;br /&gt;
&lt;br /&gt;
== Using TF-IDF to measure text similarity ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17059</id>
		<title>Lecture 3. POS tagging. Key word and phrase extraction</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17059"/>
		<updated>2015-09-02T23:55:31Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* T-Score [Manning, Shuetze, 1999] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Part of speech (POS) ==&lt;br /&gt;
&lt;br /&gt;
Part of speech [Manning, Shuetze, 1999]&lt;br /&gt;
&lt;br /&gt;
Words of a language are grouped into classes which show similar syntactic behavior. These word classes are called parts of speech (POS). Three&lt;br /&gt;
important parts of speech are noun, verb, and adjective. The major types of morphological process are in ection, derivation, and compounding.&lt;br /&gt;
&lt;br /&gt;
There are around 9 POS according to different schools:&lt;br /&gt;
* Nouns (NN, NP), pronouns (PN, PRP), adjectives (JJ): number, gender, case&lt;br /&gt;
* Adjective (JJ): comparative, superlative, short form&lt;br /&gt;
* Verbs (VB): subject number, subject person, tense, aspect, modality, participles, voice&lt;br /&gt;
* Adverbs (RB), prepositions (IN), conjunctions (, CS), articles (AT)&lt;br /&gt;
and particles (RP): nothing&lt;br /&gt;
&lt;br /&gt;
== POS ambiguation ==&lt;br /&gt;
&lt;br /&gt;
Ship (noun or verb?)&lt;br /&gt;
&lt;br /&gt;
* a luxury cruise ship&lt;br /&gt;
* Both products are due to ship at the beginning of June&lt;br /&gt;
* A new engine was shipped over from the US&lt;br /&gt;
* The port is closed to all &#039;&#039;&#039;shipping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Contest (noun or verb?)&lt;br /&gt;
* Stone decided to hold a contest to see who could write the best song.&lt;br /&gt;
* She plans to contest a seat in Congress next year.&lt;br /&gt;
&lt;br /&gt;
== POS taggers ==&lt;br /&gt;
&lt;br /&gt;
* Corpus- or dictionary-based VS rule-based&lt;br /&gt;
* Ngram-based taggers:&lt;br /&gt;
** unigram tagging: assign the most frequent tag&lt;br /&gt;
** ngram tagging: look at the context of n previous words (requires a lot of training data)&lt;br /&gt;
* Trade-off between the accuracy and the coverage: combine different taggers&lt;br /&gt;
&lt;br /&gt;
===NLTK POS default tagger===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.tag import pos tag&lt;br /&gt;
&lt;br /&gt;
In[2]: print pos tag([&#039;ship&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[1]: [(&#039;ship&#039;, &#039;NN&#039;)]&lt;br /&gt;
&lt;br /&gt;
In[3]: print pos tag([&#039;shipping&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[2]: [(&#039;shipping&#039;, &#039;VBG&#039;)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/api/nltk.tag.html|http://www.nltk.org/api/nltk.tag.html] for more details on&lt;br /&gt;
learning taggers.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3.1 Genre comparison ==&lt;br /&gt;
&lt;br /&gt;
Text genre [Santini, Sharoff, 2009]&lt;br /&gt;
&lt;br /&gt;
The concept of genre is hard to agree upon. Many interpretations have been proposed since Aristotles Poetics without reaching any definite&lt;br /&gt;
conclusions about the inventory or even principles for classifying documents into genres. The lack of an agreed definition of what genre is causes the problem of the loose boundaries between the term \genre&amp;quot; with other neighbouring terms, such as &amp;quot;register&amp;quot;, &amp;quot;domain&amp;quot;, &amp;quot;topic&amp;quot;, and &amp;quot;style&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise 3.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Input: Two texts of different genre (for example, Wikipedia article and&lt;br /&gt;
blog post)&lt;br /&gt;
Output: rank all of POS tags for both texts&lt;br /&gt;
&lt;br /&gt;
How can you describe the difference between two genres?&lt;br /&gt;
&lt;br /&gt;
== Key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
There are many definitions of key word and phrase. Thus there are many methods for their extraction:&lt;br /&gt;
&lt;br /&gt;
* supervised VS unsupervised&lt;br /&gt;
* frequency-based VS more complex&lt;br /&gt;
* from individual text VS from text collection&lt;br /&gt;
* word (unigram) VS bigram VS ngram&lt;br /&gt;
* term VS named entity VS collocation&lt;br /&gt;
* sequential words VS using window&lt;br /&gt;
&lt;br /&gt;
== Supervised methods for key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
I am a word. Am I a key word? Let us build a classifier.&lt;br /&gt;
&lt;br /&gt;
* Am I in the beginning or in the end of the sentence?&lt;br /&gt;
* Am I capitalized?&lt;br /&gt;
* How many times do I occur?&lt;br /&gt;
* Am I used in Wikipedia as a title of a category or an article?&lt;br /&gt;
* Am I a term?&lt;br /&gt;
* Am I a NE?&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
But we need a collection of marked up texts!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase extraction from a single text ==&lt;br /&gt;
&lt;br /&gt;
* POS patterns&lt;br /&gt;
* Association measures: PMI, T-Score, LLR&lt;br /&gt;
* Graph methods: TextRank [Mihalcea, Tarau, 2004]&lt;br /&gt;
* Syntactic patterns&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.2 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif1.txt (or your own text)&lt;br /&gt;
&lt;br /&gt;
Key word: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; NN&lt;br /&gt;
&lt;br /&gt;
Key phrase: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; phrases, that satisfy the following patterns: JJ + NN, NN + NN, NN + IN + NN&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases&lt;br /&gt;
&lt;br /&gt;
Hint: use nltk.ngrams to get ngrams.&lt;br /&gt;
&lt;br /&gt;
== Bigram association measures ==&lt;br /&gt;
&lt;br /&gt;
==== Pointwise Mutual Information [Manning, Shuetze, 1999] ==== &lt;br /&gt;
&lt;br /&gt;
PMI measures the reduction of uncertainty about the occurrence of one&lt;br /&gt;
word when we are told about the occurrence of the other one.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p1.jpg|350px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== T-Score [Manning, Shuetze, 1999] ====&lt;br /&gt;
&lt;br /&gt;
T-Score is a statistical t-test applied to finding collocations. The t-test&lt;br /&gt;
looks at the difference between the observed and expected means, scaled&lt;br /&gt;
by the variance of the data. The T-score is most useful as a method for&lt;br /&gt;
ranking collocations. The level of significance itself is less useful.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p2.jpg|300px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p3.jpg|400px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
But Chi-squared has many other interesting applications.&lt;br /&gt;
&lt;br /&gt;
==== Chi-squared [Manning, Shuetze, 1999] ====&lt;br /&gt;
In general, for the problem of finding collocation, the difference between the T-score and the Chi-squared does not seem to be large.&lt;br /&gt;
&lt;br /&gt;
=== Bigram association measures in NLTK ===&lt;br /&gt;
&lt;br /&gt;
==== NLTK BigramCollocationFinder ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.collocations import *&lt;br /&gt;
&lt;br /&gt;
In[2]: bigram measures = nltk.collocations.BigramAssocMeasures()&lt;br /&gt;
&lt;br /&gt;
In[3]: finder = BigramCollocationFinder.from words(tokens)&lt;br /&gt;
&lt;br /&gt;
In[4]: finder.apply freq filter(3)&lt;br /&gt;
&lt;br /&gt;
In[5]: for i in finder.nbest(bigram measures.pmi, 20):&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bigram measures:&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.pmi &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.student_t &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.chi_sq &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; igram measures.likelihood_ratio &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/_modules/nltk/metrics/association.html|http://www.nltk.org/_modules/nltk/metrics/association.html] for more more bigram association measures.&lt;br /&gt;
&lt;br /&gt;
== TextRank: using graph centrality measures for key word and phrase extraction [Mihalcea, Tarau, 2004] ==&lt;br /&gt;
&lt;br /&gt;
# Add words as vertices in the graph.&lt;br /&gt;
# Identify relations that connect words:&lt;br /&gt;
## consequent words;&lt;br /&gt;
## words inside (left or right) the window (2-5 words); and use these relations to draw edges between vertices in the graph. Edges can be directed or undirected, weighted or unweighted.&lt;br /&gt;
# Iterate the graph-based ranking algorithm until convergence (for example, PageRank).&lt;br /&gt;
# Sort vertices based on their final score. Use the values attached to each vertex for ranking/selection decisions.&lt;br /&gt;
# If two adjacent words are selected as potential keywords by TextRank, collapse them into one single key phrase.&lt;br /&gt;
&lt;br /&gt;
See original paper: [http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf|http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf]&lt;br /&gt;
&lt;br /&gt;
Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types systems and systems of mixed types.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p4.jpg|обрамить|TextRank]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
G = (V, E) — a graph, V — vertices, E — edges&lt;br /&gt;
&#039;&#039;In(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that point to it&lt;br /&gt;
&#039;&#039;Out(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that &#039;&#039;V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;&#039;&#039; points to&lt;br /&gt;
Graph centrality measures:&lt;br /&gt;
&lt;br /&gt;
==== PageRank [Brin, Page, 1998] ====&lt;br /&gt;
[[Файл:L3 p5.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
==== HITS [Kleinberg, 1999] ==== &lt;br /&gt;
[[Файл:L3 p6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Key words and phrases, assigned by TextRank using PageRank centrality measure: linear constraints; linear diophantine equations; natural numbers; nonstrict inequations; strict inequations; upper bounds&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.3 ====&lt;br /&gt;
&lt;br /&gt;
Input: sif.txt (or your own text) &lt;br /&gt;
Output: key words and phrases computed by PageRank (using PR(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;),HITS&amp;lt;small&amp;gt;A&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) and HITS&amp;lt;small&amp;gt;H&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) as centrality measures)&lt;br /&gt;
&lt;br /&gt;
Hint: use NetworkX for PageRank and HITS [http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html|http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html]&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase selection from a text in a collection ==&lt;br /&gt;
&lt;br /&gt;
The problem: given a collection of texts find those words and phrases (terms) that occur in this text significant frequently than in other texts.&lt;br /&gt;
&lt;br /&gt;
=== Term frequency [Luhn, 1957] === &lt;br /&gt;
&lt;br /&gt;
The weight of a term that occurs in a document is simply proportional to the term frequency.&lt;br /&gt;
&lt;br /&gt;
=== Inverse document frequency [Spaerck Jones, 1972] ===&lt;br /&gt;
&lt;br /&gt;
The specificity of a term can be quantified as an inverse function of the number of documents in which it occurs.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;tfidf (term, text, collection) = tf (term, document) × idf (term, collection)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Variants of TF and IDF weights ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p7.jpg|обрамить|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF in NLTK ==&lt;br /&gt;
&lt;br /&gt;
===NLTK TextCollection class ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.text import TextCollection&lt;br /&gt;
&lt;br /&gt;
In[2]: collection = [WhitespaceTokenizer().tokenize(text) for text in collection]&lt;br /&gt;
&lt;br /&gt;
In[3]: corpus = TextCollection(collection)&lt;br /&gt;
&lt;br /&gt;
In[4]: for i in collection[0]: print i, corpus.tf idf(i,collection[0])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.4 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif2.txt (or your own collection of texts)&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases according to TF-IDF for one text&lt;br /&gt;
&lt;br /&gt;
Hint: &amp;lt;code&amp;gt; use sorted(mylist,key=lambda l:l[1], reverse=True) to sort mylist in descending order based on the second parameter &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF alternatives ==&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.5 ====&lt;br /&gt;
&lt;br /&gt;
Write MI and Chi-squared as an alternative for TF-IDF for measuring significance of a term in a text in a collection.&lt;br /&gt;
Check your ideas in Sebastiani[http://arxiv.org/pdf/cs/0110053.pdf|], 2001&lt;br /&gt;
&lt;br /&gt;
== Using TF-IDF to measure text similarity ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17058</id>
		<title>Lecture 3. POS tagging. Key word and phrase extraction</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17058"/>
		<updated>2015-09-02T23:54:24Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Pointwise Mutual Information [Manning, Shuetze, 1999] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Part of speech (POS) ==&lt;br /&gt;
&lt;br /&gt;
Part of speech [Manning, Shuetze, 1999]&lt;br /&gt;
&lt;br /&gt;
Words of a language are grouped into classes which show similar syntactic behavior. These word classes are called parts of speech (POS). Three&lt;br /&gt;
important parts of speech are noun, verb, and adjective. The major types of morphological process are in ection, derivation, and compounding.&lt;br /&gt;
&lt;br /&gt;
There are around 9 POS according to different schools:&lt;br /&gt;
* Nouns (NN, NP), pronouns (PN, PRP), adjectives (JJ): number, gender, case&lt;br /&gt;
* Adjective (JJ): comparative, superlative, short form&lt;br /&gt;
* Verbs (VB): subject number, subject person, tense, aspect, modality, participles, voice&lt;br /&gt;
* Adverbs (RB), prepositions (IN), conjunctions (, CS), articles (AT)&lt;br /&gt;
and particles (RP): nothing&lt;br /&gt;
&lt;br /&gt;
== POS ambiguation ==&lt;br /&gt;
&lt;br /&gt;
Ship (noun or verb?)&lt;br /&gt;
&lt;br /&gt;
* a luxury cruise ship&lt;br /&gt;
* Both products are due to ship at the beginning of June&lt;br /&gt;
* A new engine was shipped over from the US&lt;br /&gt;
* The port is closed to all &#039;&#039;&#039;shipping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Contest (noun or verb?)&lt;br /&gt;
* Stone decided to hold a contest to see who could write the best song.&lt;br /&gt;
* She plans to contest a seat in Congress next year.&lt;br /&gt;
&lt;br /&gt;
== POS taggers ==&lt;br /&gt;
&lt;br /&gt;
* Corpus- or dictionary-based VS rule-based&lt;br /&gt;
* Ngram-based taggers:&lt;br /&gt;
** unigram tagging: assign the most frequent tag&lt;br /&gt;
** ngram tagging: look at the context of n previous words (requires a lot of training data)&lt;br /&gt;
* Trade-off between the accuracy and the coverage: combine different taggers&lt;br /&gt;
&lt;br /&gt;
===NLTK POS default tagger===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.tag import pos tag&lt;br /&gt;
&lt;br /&gt;
In[2]: print pos tag([&#039;ship&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[1]: [(&#039;ship&#039;, &#039;NN&#039;)]&lt;br /&gt;
&lt;br /&gt;
In[3]: print pos tag([&#039;shipping&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[2]: [(&#039;shipping&#039;, &#039;VBG&#039;)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/api/nltk.tag.html|http://www.nltk.org/api/nltk.tag.html] for more details on&lt;br /&gt;
learning taggers.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3.1 Genre comparison ==&lt;br /&gt;
&lt;br /&gt;
Text genre [Santini, Sharoff, 2009]&lt;br /&gt;
&lt;br /&gt;
The concept of genre is hard to agree upon. Many interpretations have been proposed since Aristotles Poetics without reaching any definite&lt;br /&gt;
conclusions about the inventory or even principles for classifying documents into genres. The lack of an agreed definition of what genre is causes the problem of the loose boundaries between the term \genre&amp;quot; with other neighbouring terms, such as &amp;quot;register&amp;quot;, &amp;quot;domain&amp;quot;, &amp;quot;topic&amp;quot;, and &amp;quot;style&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise 3.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Input: Two texts of different genre (for example, Wikipedia article and&lt;br /&gt;
blog post)&lt;br /&gt;
Output: rank all of POS tags for both texts&lt;br /&gt;
&lt;br /&gt;
How can you describe the difference between two genres?&lt;br /&gt;
&lt;br /&gt;
== Key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
There are many definitions of key word and phrase. Thus there are many methods for their extraction:&lt;br /&gt;
&lt;br /&gt;
* supervised VS unsupervised&lt;br /&gt;
* frequency-based VS more complex&lt;br /&gt;
* from individual text VS from text collection&lt;br /&gt;
* word (unigram) VS bigram VS ngram&lt;br /&gt;
* term VS named entity VS collocation&lt;br /&gt;
* sequential words VS using window&lt;br /&gt;
&lt;br /&gt;
== Supervised methods for key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
I am a word. Am I a key word? Let us build a classifier.&lt;br /&gt;
&lt;br /&gt;
* Am I in the beginning or in the end of the sentence?&lt;br /&gt;
* Am I capitalized?&lt;br /&gt;
* How many times do I occur?&lt;br /&gt;
* Am I used in Wikipedia as a title of a category or an article?&lt;br /&gt;
* Am I a term?&lt;br /&gt;
* Am I a NE?&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
But we need a collection of marked up texts!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase extraction from a single text ==&lt;br /&gt;
&lt;br /&gt;
* POS patterns&lt;br /&gt;
* Association measures: PMI, T-Score, LLR&lt;br /&gt;
* Graph methods: TextRank [Mihalcea, Tarau, 2004]&lt;br /&gt;
* Syntactic patterns&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.2 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif1.txt (or your own text)&lt;br /&gt;
&lt;br /&gt;
Key word: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; NN&lt;br /&gt;
&lt;br /&gt;
Key phrase: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; phrases, that satisfy the following patterns: JJ + NN, NN + NN, NN + IN + NN&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases&lt;br /&gt;
&lt;br /&gt;
Hint: use nltk.ngrams to get ngrams.&lt;br /&gt;
&lt;br /&gt;
== Bigram association measures ==&lt;br /&gt;
&lt;br /&gt;
==== Pointwise Mutual Information [Manning, Shuetze, 1999] ==== &lt;br /&gt;
&lt;br /&gt;
PMI measures the reduction of uncertainty about the occurrence of one&lt;br /&gt;
word when we are told about the occurrence of the other one.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p1.jpg|350px|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== T-Score [Manning, Shuetze, 1999] ====&lt;br /&gt;
&lt;br /&gt;
T-Score is a statistical t-test applied to finding collocations. The t-test&lt;br /&gt;
looks at the difference between the observed and expected means, scaled&lt;br /&gt;
by the variance of the data. The T-score is most useful as a method for&lt;br /&gt;
ranking collocations. The level of significance itself is less useful.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p2.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p3.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
But Chi-squared has many other interesting applications.&lt;br /&gt;
&lt;br /&gt;
==== Chi-squared [Manning, Shuetze, 1999] ====&lt;br /&gt;
In general, for the problem of finding collocation, the difference between the T-score and the Chi-squared does not seem to be large.&lt;br /&gt;
&lt;br /&gt;
=== Bigram association measures in NLTK ===&lt;br /&gt;
&lt;br /&gt;
==== NLTK BigramCollocationFinder ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.collocations import *&lt;br /&gt;
&lt;br /&gt;
In[2]: bigram measures = nltk.collocations.BigramAssocMeasures()&lt;br /&gt;
&lt;br /&gt;
In[3]: finder = BigramCollocationFinder.from words(tokens)&lt;br /&gt;
&lt;br /&gt;
In[4]: finder.apply freq filter(3)&lt;br /&gt;
&lt;br /&gt;
In[5]: for i in finder.nbest(bigram measures.pmi, 20):&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bigram measures:&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.pmi &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.student_t &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.chi_sq &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; igram measures.likelihood_ratio &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/_modules/nltk/metrics/association.html|http://www.nltk.org/_modules/nltk/metrics/association.html] for more more bigram association measures.&lt;br /&gt;
&lt;br /&gt;
== TextRank: using graph centrality measures for key word and phrase extraction [Mihalcea, Tarau, 2004] ==&lt;br /&gt;
&lt;br /&gt;
# Add words as vertices in the graph.&lt;br /&gt;
# Identify relations that connect words:&lt;br /&gt;
## consequent words;&lt;br /&gt;
## words inside (left or right) the window (2-5 words); and use these relations to draw edges between vertices in the graph. Edges can be directed or undirected, weighted or unweighted.&lt;br /&gt;
# Iterate the graph-based ranking algorithm until convergence (for example, PageRank).&lt;br /&gt;
# Sort vertices based on their final score. Use the values attached to each vertex for ranking/selection decisions.&lt;br /&gt;
# If two adjacent words are selected as potential keywords by TextRank, collapse them into one single key phrase.&lt;br /&gt;
&lt;br /&gt;
See original paper: [http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf|http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf]&lt;br /&gt;
&lt;br /&gt;
Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types systems and systems of mixed types.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p4.jpg|обрамить|TextRank]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
G = (V, E) — a graph, V — vertices, E — edges&lt;br /&gt;
&#039;&#039;In(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that point to it&lt;br /&gt;
&#039;&#039;Out(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that &#039;&#039;V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;&#039;&#039; points to&lt;br /&gt;
Graph centrality measures:&lt;br /&gt;
&lt;br /&gt;
==== PageRank [Brin, Page, 1998] ====&lt;br /&gt;
[[Файл:L3 p5.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
==== HITS [Kleinberg, 1999] ==== &lt;br /&gt;
[[Файл:L3 p6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Key words and phrases, assigned by TextRank using PageRank centrality measure: linear constraints; linear diophantine equations; natural numbers; nonstrict inequations; strict inequations; upper bounds&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.3 ====&lt;br /&gt;
&lt;br /&gt;
Input: sif.txt (or your own text) &lt;br /&gt;
Output: key words and phrases computed by PageRank (using PR(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;),HITS&amp;lt;small&amp;gt;A&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) and HITS&amp;lt;small&amp;gt;H&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) as centrality measures)&lt;br /&gt;
&lt;br /&gt;
Hint: use NetworkX for PageRank and HITS [http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html|http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html]&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase selection from a text in a collection ==&lt;br /&gt;
&lt;br /&gt;
The problem: given a collection of texts find those words and phrases (terms) that occur in this text significant frequently than in other texts.&lt;br /&gt;
&lt;br /&gt;
=== Term frequency [Luhn, 1957] === &lt;br /&gt;
&lt;br /&gt;
The weight of a term that occurs in a document is simply proportional to the term frequency.&lt;br /&gt;
&lt;br /&gt;
=== Inverse document frequency [Spaerck Jones, 1972] ===&lt;br /&gt;
&lt;br /&gt;
The specificity of a term can be quantified as an inverse function of the number of documents in which it occurs.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;tfidf (term, text, collection) = tf (term, document) × idf (term, collection)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Variants of TF and IDF weights ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p7.jpg|обрамить|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF in NLTK ==&lt;br /&gt;
&lt;br /&gt;
===NLTK TextCollection class ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.text import TextCollection&lt;br /&gt;
&lt;br /&gt;
In[2]: collection = [WhitespaceTokenizer().tokenize(text) for text in collection]&lt;br /&gt;
&lt;br /&gt;
In[3]: corpus = TextCollection(collection)&lt;br /&gt;
&lt;br /&gt;
In[4]: for i in collection[0]: print i, corpus.tf idf(i,collection[0])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.4 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif2.txt (or your own collection of texts)&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases according to TF-IDF for one text&lt;br /&gt;
&lt;br /&gt;
Hint: &amp;lt;code&amp;gt; use sorted(mylist,key=lambda l:l[1], reverse=True) to sort mylist in descending order based on the second parameter &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF alternatives ==&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.5 ====&lt;br /&gt;
&lt;br /&gt;
Write MI and Chi-squared as an alternative for TF-IDF for measuring significance of a term in a text in a collection.&lt;br /&gt;
Check your ideas in Sebastiani[http://arxiv.org/pdf/cs/0110053.pdf|], 2001&lt;br /&gt;
&lt;br /&gt;
== Using TF-IDF to measure text similarity ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=NLP_References&amp;diff=17057</id>
		<title>NLP References</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=NLP_References&amp;diff=17057"/>
		<updated>2015-09-02T22:51:10Z</updated>

		<summary type="html">&lt;p&gt;Polidson: Новая страница: «# Salton, Gerard, and Christopher Buckley. Term-weighting approaches in automatic text retrieval. Information processing and management 24.5 (1988): 513-523. # Wo…»&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;# Salton, Gerard, and Christopher Buckley. Term-weighting approaches in automatic text retrieval. Information processing and management 24.5 (1988): 513-523.&lt;br /&gt;
# Wong, SK Michael, Wojciech Ziarko, and Patrick CN Wong. Generalized vector spaces model in information retrieval. Proceedings of the 8th annual international ACM SIGIR conference on Research and development in information retrieval. ACM, 1985.&lt;br /&gt;
# Turney, Peter D., and Patrick Pantel. From frequency to meaning: Vector space models of semantics. Journal of artificial intelligence research 37.1 (2010): 141-188.&lt;br /&gt;
# Ponte, Jay M., and W. Bruce Croft. A language modeling approach to information retrieval. Proceedings of the 21st annual international ACM SIGIR conference on Research and development in information retrieval. ACM, 1998.&lt;br /&gt;
# Zamir, Oren, and Oren Etzioni. Web document clustering: A feasibility demonstration. Proceedings of the 21st annual international ACM SIGIR conference on Research and development in information retrieval. ACM, 1998.&lt;br /&gt;
# Kennington, Casey Redd, Martin Kay, and Annemarie Friedrich. Suffix Trees as Language Models. LREC. 2012.&lt;br /&gt;
# Huang, Jin Hu, and David Powers. Suffix tree based approach for chinese information retrieval. Intelligent Systems Design and Applications, 2008. ISDA&#039;08. Eighth International Conference on. Vol. 3. IEEE, 2008.&lt;br /&gt;
# Zhang, Dell, and Wee Sun Lee. Extracting key-substring-group features for text classification. Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining. ACM, 2006.&lt;br /&gt;
# Gusfield, Dan. Algorithms on strings, trees and sequences: computer science and computational biology. Cambridge university press, 1997.&lt;br /&gt;
# Pampapathi R., Mirkin B., Levene M., A suffix tree approach to anti-spam email filtering, Machine Learning, 2006, Vol. 65, no.1, pp. 309-338.&lt;br /&gt;
#Chernyak E.L., Chugunova O.N., Mirkin B.G., Annotated suffix tree method for measuring degree of string to text belongingness, Business Informatics, 2012. Vol. 21, no.3, pp. 31-41 (in Russian).&lt;br /&gt;
# Chernyak E.L., Chugunova O.N., Askarova J.A., Nascimento S., Mirkin B.G., Abstracting concepts from text documents by using an ontology, in Proceedings of the 1st International Workshop on Concept Discovery in Unstructured Data. 2011, pp. 21-31.&lt;br /&gt;
# Chernyak E. L. An approach to the problem of annotation of research publications, Proceedings of The Eighth International Conference on Web Search and Data Mining, pp. 429-434.&lt;br /&gt;
# Chernyak E. L., Mirkin B. G. Refining a Taxonomy by Using Annotated Suffix Trees and Wikipedia Resources. Annals of Data Science. Vol. 2. No. 1. P. 61-82, 2015.&lt;br /&gt;
# Morenko, E. N., Chernyak E.L., Mirkin B.G.. Conceptual Maps: Construction Over a Text Collection and Analysis. In Analysis of Images, Social Networks and Texts, pp. 163-168. Springer International Publishing, 2014.&lt;br /&gt;
# Martin, James H., and Daniel Jurafsky. &amp;quot;Speech and language processing.&amp;quot; International Edition (2000).&lt;br /&gt;
# Manning, Christopher D., and Hinrich Schuetze. Foundations of statistical natural language processing. MIT press, 1999.&lt;br /&gt;
# Santini, Marina, and Serge Sharoff. Web Genre Benchmark Under Construction. JLCL, Volume 24 (1), 2009.&lt;br /&gt;
# Luhn, Hans Peter. &amp;quot;A statistical approach to mechanized encoding and searching of literary information.&amp;quot; IBM Journal of research and development 1.4 (1957): 309-317.&lt;br /&gt;
# Sparck Jones, Karen. &amp;quot;A statistical interpretation of term specificity and its application in retrieval.&amp;quot; Journal of documentation 28.1 (1972): 11-21.&lt;br /&gt;
# Sebastiani, Fabrizio. &amp;quot;Machine learning in automated text categorization.&amp;quot; ACM computing surveys (CSUR) 34.1 (2002): 1-47.&lt;br /&gt;
# Salton, Gerard, Anita Wong, and Chung-Shu Yang. &amp;quot;A vector space model for automatic indexing.&amp;quot; Communications of the ACM 18.11 (1975): 613-620.&lt;br /&gt;
# Bird, Steven, Ewan Klein, and Edward Loper. Natural language processing with Python. &amp;quot; O&#039;Reilly Media, Inc.&amp;quot;, 2009.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=%D0%9E_%D1%84%D0%B0%D0%BA%D1%83%D0%BB%D1%8C%D1%82%D0%B5%D1%82%D0%B5&amp;diff=17056</id>
		<title>О факультете</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=%D0%9E_%D1%84%D0%B0%D0%BA%D1%83%D0%BB%D1%8C%D1%82%D0%B5%D1%82%D0%B5&amp;diff=17056"/>
		<updated>2015-09-02T22:51:01Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Summer School 2015 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Факультет компьютерных наук НИУ ВШЭ ==&lt;br /&gt;
=== Курсы за 2015/16 учебный год ===&lt;br /&gt;
[[Майнор Интеллектуальный анализ данных]]&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Майнор Интеллектуальный анализ данных/Введение в программирование|Введение в программирование]]&lt;br /&gt;
&lt;br /&gt;
[[Компьютерные системы]]&lt;br /&gt;
&lt;br /&gt;
[[Математический анализ]]&lt;br /&gt;
&lt;br /&gt;
=== Summer School 2015 ===&lt;br /&gt;
[[Introduction to Natural Language Processing|Introduction to Natural Language Processing]]&lt;br /&gt;
#[[Lecture 1. Introduction|Introduction]]&lt;br /&gt;
#[[Lecture 2. Tokenization and word counts|Tokenization and word counts]]&lt;br /&gt;
#[[Lecture 3. POS tagging. Key word and phrase extraction|POS tagging. Key word and phrase extraction]]&lt;br /&gt;
#[[Lecture 4. Parsing|Parsing]]&lt;br /&gt;
#[[Lecture 5. Language sources|Language sources]]&lt;br /&gt;
#[[Lecture 6. Synonyms and near-synonyms detection|Synonyms and near-synonyms detection]]&lt;br /&gt;
#[[Lecture 8. Suffix trees for NLP|Suffix trees for NLP]]&lt;br /&gt;
#[[NLP References|References]]&lt;br /&gt;
&lt;br /&gt;
=== Курсы за 2014/15 учебный год ===&lt;br /&gt;
[[Основы и методологии программирования]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Алгоритмы и структуры данных]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Анализ данных (Программная инженерия)]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Алгебра]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Magolego_sna_2015| MAGoLEGO Social Network Analysis]]&lt;br /&gt;
&lt;br /&gt;
=== Проектная работа, 2015 год ===&lt;br /&gt;
[[Проектная работа]] &amp;lt;br /&amp;gt;&lt;br /&gt;
[[Учебная практика 1 курс (2015)]]&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=NLPref&amp;diff=17055</id>
		<title>NLPref</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=NLPref&amp;diff=17055"/>
		<updated>2015-09-02T22:50:19Z</updated>

		<summary type="html">&lt;p&gt;Polidson: Новая страница: «# Salton, Gerard, and Christopher Buckley. Term-weighting approaches in automatic text retrieval. Information processing and management 24.5 (1988): 513-523. # Wo…»&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;# Salton, Gerard, and Christopher Buckley. Term-weighting approaches in automatic text retrieval. Information processing and management 24.5 (1988): 513-523.&lt;br /&gt;
# Wong, SK Michael, Wojciech Ziarko, and Patrick CN Wong. Generalized vector spaces model in information retrieval. Proceedings of the 8th annual international ACM SIGIR conference on Research and development in information retrieval. ACM, 1985.&lt;br /&gt;
# Turney, Peter D., and Patrick Pantel. From frequency to meaning: Vector space models of semantics. Journal of artificial intelligence research 37.1 (2010): 141-188.&lt;br /&gt;
# Ponte, Jay M., and W. Bruce Croft. A language modeling approach to information retrieval. Proceedings of the 21st annual international ACM SIGIR conference on Research and development in information retrieval. ACM, 1998.&lt;br /&gt;
# Zamir, Oren, and Oren Etzioni. Web document clustering: A feasibility demonstration. Proceedings of the 21st annual international ACM SIGIR conference on Research and development in information retrieval. ACM, 1998.&lt;br /&gt;
# Kennington, Casey Redd, Martin Kay, and Annemarie Friedrich. Suffix Trees as Language Models. LREC. 2012.&lt;br /&gt;
# Huang, Jin Hu, and David Powers. Suffix tree based approach for chinese information retrieval. Intelligent Systems Design and Applications, 2008. ISDA&#039;08. Eighth International Conference on. Vol. 3. IEEE, 2008.&lt;br /&gt;
# Zhang, Dell, and Wee Sun Lee. Extracting key-substring-group features for text classification. Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining. ACM, 2006.&lt;br /&gt;
# Gusfield, Dan. Algorithms on strings, trees and sequences: computer science and computational biology. Cambridge university press, 1997.&lt;br /&gt;
# Pampapathi R., Mirkin B., Levene M., A suffix tree approach to anti-spam email filtering, Machine Learning, 2006, Vol. 65, no.1, pp. 309-338.&lt;br /&gt;
#Chernyak E.L., Chugunova O.N., Mirkin B.G., Annotated suffix tree method for measuring degree of string to text belongingness, Business Informatics, 2012. Vol. 21, no.3, pp. 31-41 (in Russian).&lt;br /&gt;
# Chernyak E.L., Chugunova O.N., Askarova J.A., Nascimento S., Mirkin B.G., Abstracting concepts from text documents by using an ontology, in Proceedings of the 1st International Workshop on Concept Discovery in Unstructured Data. 2011, pp. 21-31.&lt;br /&gt;
# Chernyak E. L. An approach to the problem of annotation of research publications, Proceedings of The Eighth International Conference on Web Search and Data Mining, pp. 429-434.&lt;br /&gt;
# Chernyak E. L., Mirkin B. G. Refining a Taxonomy by Using Annotated Suffix Trees and Wikipedia Resources. Annals of Data Science. Vol. 2. No. 1. P. 61-82, 2015.&lt;br /&gt;
# Morenko, E. N., Chernyak E.L., Mirkin B.G.. Conceptual Maps: Construction Over a Text Collection and Analysis. In Analysis of Images, Social Networks and Texts, pp. 163-168. Springer International Publishing, 2014.&lt;br /&gt;
# Martin, James H., and Daniel Jurafsky. &amp;quot;Speech and language processing.&amp;quot; International Edition (2000).&lt;br /&gt;
# Manning, Christopher D., and Hinrich Schuetze. Foundations of statistical natural language processing. MIT press, 1999.&lt;br /&gt;
# Santini, Marina, and Serge Sharoff. Web Genre Benchmark Under Construction. JLCL, Volume 24 (1), 2009.&lt;br /&gt;
# Luhn, Hans Peter. &amp;quot;A statistical approach to mechanized encoding and searching of literary information.&amp;quot; IBM Journal of research and development 1.4 (1957): 309-317.&lt;br /&gt;
# Sparck Jones, Karen. &amp;quot;A statistical interpretation of term specificity and its application in retrieval.&amp;quot; Journal of documentation 28.1 (1972): 11-21.&lt;br /&gt;
# Sebastiani, Fabrizio. &amp;quot;Machine learning in automated text categorization.&amp;quot; ACM computing surveys (CSUR) 34.1 (2002): 1-47.&lt;br /&gt;
# Salton, Gerard, Anita Wong, and Chung-Shu Yang. &amp;quot;A vector space model for automatic indexing.&amp;quot; Communications of the ACM 18.11 (1975): 613-620.&lt;br /&gt;
# Bird, Steven, Ewan Klein, and Edward Loper. Natural language processing with Python. &amp;quot; O&#039;Reilly Media, Inc.&amp;quot;, 2009.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=%D0%9E_%D1%84%D0%B0%D0%BA%D1%83%D0%BB%D1%8C%D1%82%D0%B5%D1%82%D0%B5&amp;diff=17054</id>
		<title>О факультете</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=%D0%9E_%D1%84%D0%B0%D0%BA%D1%83%D0%BB%D1%8C%D1%82%D0%B5%D1%82%D0%B5&amp;diff=17054"/>
		<updated>2015-09-02T22:42:26Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Summer School 2015 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Факультет компьютерных наук НИУ ВШЭ ==&lt;br /&gt;
=== Курсы за 2015/16 учебный год ===&lt;br /&gt;
[[Майнор Интеллектуальный анализ данных]]&amp;lt;br /&amp;gt;&lt;br /&gt;
#[[Майнор Интеллектуальный анализ данных/Введение в программирование|Введение в программирование]]&lt;br /&gt;
&lt;br /&gt;
[[Компьютерные системы]]&lt;br /&gt;
&lt;br /&gt;
[[Математический анализ]]&lt;br /&gt;
&lt;br /&gt;
=== Summer School 2015 ===&lt;br /&gt;
[[Introduction to Natural Language Processing|Introduction to Natural Language Processing]]&lt;br /&gt;
#[[Lecture 1. Introduction|Introduction]]&lt;br /&gt;
#[[Lecture 2. Tokenization and word counts|Tokenization and word counts]]&lt;br /&gt;
#[[Lecture 3. POS tagging. Key word and phrase extraction|POS tagging. Key word and phrase extraction]]&lt;br /&gt;
#[[Lecture 4. Parsing|Parsing]]&lt;br /&gt;
#[[Lecture 5. Language sources|Language sources]]&lt;br /&gt;
#[[Lecture 6. Synonyms and near-synonyms detection|Synonyms and near-synonyms detection]]&lt;br /&gt;
#[[Lecture 8. Suffix trees for NLP|Suffix trees for NLP]]&lt;br /&gt;
#[[NLPref|References]]&lt;br /&gt;
&lt;br /&gt;
=== Курсы за 2014/15 учебный год ===&lt;br /&gt;
[[Основы и методологии программирования]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Алгоритмы и структуры данных]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Анализ данных (Программная инженерия)]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Алгебра]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Magolego_sna_2015| MAGoLEGO Social Network Analysis]]&lt;br /&gt;
&lt;br /&gt;
=== Проектная работа, 2015 год ===&lt;br /&gt;
[[Проектная работа]] &amp;lt;br /&amp;gt;&lt;br /&gt;
[[Учебная практика 1 курс (2015)]]&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17053</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17053"/>
		<updated>2015-09-02T22:38:45Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Annotated suffix tree (AST) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|350px|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17052</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17052"/>
		<updated>2015-09-02T22:38:11Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Annotated suffix tree scoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17051</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17051"/>
		<updated>2015-09-02T22:37:55Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Annotated suffix tree scoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|550px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|550px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17050</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17050"/>
		<updated>2015-09-02T22:37:26Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Annotated suffix tree */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|500px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|500px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17049</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17049"/>
		<updated>2015-09-02T22:37:00Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Annotated suffix tree construction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg|350px]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|500px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|500px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17048</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17048"/>
		<updated>2015-09-02T22:36:15Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Annotated suffix tree scoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|500px|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|500px|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_2._Tokenization_and_word_counts&amp;diff=17047</id>
		<title>Lecture 2. Tokenization and word counts</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_2._Tokenization_and_word_counts&amp;diff=17047"/>
		<updated>2015-09-02T22:31:31Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Natural Language Toolkit (NLTK) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== How many words? ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;The rain in Spain stays mainly in the plain.&amp;quot;&lt;br /&gt;
9 &#039;&#039;&#039;tokens&#039;&#039;&#039;: The, rain, in, Spain, stays, mainly, in, the, plain&lt;br /&gt;
7 (or 8) &#039;&#039;&#039;types&#039;&#039;&#039;: T = the rain, in, Spain, stays, mainly, plain&lt;br /&gt;
&lt;br /&gt;
=== Type and token ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Type&#039;&#039; is an element of the vocabulary.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Token&#039;&#039; is an instance of that type in the text.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
N = number of tokens;&lt;br /&gt;
&lt;br /&gt;
V - vocabulary (i.e. all types);&lt;br /&gt;
&lt;br /&gt;
|V| = size of vocabulary (i.e. number of types).&lt;br /&gt;
&lt;br /&gt;
How are N and |V| related?&lt;br /&gt;
&lt;br /&gt;
== Zipf&#039;s law ==&lt;br /&gt;
&lt;br /&gt;
=== Zipf&#039;s law ([Gelbukh, Sidorov, 2001]) ===&lt;br /&gt;
&lt;br /&gt;
In any large enough text, the frequency ranks (starting from the highest)&lt;br /&gt;
of types are inversely proportional to the corresponding frequencies:&lt;br /&gt;
 f = 1/r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;f&#039;&#039; — frequency of a type;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;r&#039;&#039; — rank of a type (its position in the list of all types in order of their frequency of occurrence).&lt;br /&gt;
&lt;br /&gt;
[[Файл:L2 p1.jpg|мини|Zipf&#039;s law: example]]&lt;br /&gt;
&lt;br /&gt;
== Heaps&#039; law ==&lt;br /&gt;
&lt;br /&gt;
Heaps&#039; law ([Gelbukh, Sidorov, 2001])&lt;br /&gt;
&lt;br /&gt;
The number of different types in a text is roughly proportional to an exponent of its size:&lt;br /&gt;
[[Файл:L2 p2.jpg|мини|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;N&#039;&#039; = number of tokens;&lt;br /&gt;
&lt;br /&gt;
|V| = size of vocabulary (i.e. number of types);&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;K&#039;&#039;, &#039;&#039;b&#039;&#039; — free parameters,  K &amp;amp;isin; [10; 100]; b &amp;amp;isin; [0.4; 0.6]&lt;br /&gt;
&lt;br /&gt;
== Why tokenization is difficult? ==&lt;br /&gt;
&lt;br /&gt;
*Easy example: &amp;quot;Good muffins cost $3.88 in New York. Please buy me two of them. Thanks.&amp;quot;&lt;br /&gt;
** is \.&amp;quot; a token?&lt;br /&gt;
** is $3.88 a single token?&lt;br /&gt;
** is \New York&amp;quot; a single token?&lt;br /&gt;
*Real data may contain noise in it: code, markup, URLs, faulty punctuation&lt;br /&gt;
* Real data contains misspellings: &amp;quot;an dthen she aksed&amp;quot;&lt;br /&gt;
*Period &amp;quot;.&amp;quot; does not always mean the end of sentence: m.p.h., PhD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Nevertheless tokenization is important for all other text processing steps.&lt;br /&gt;
There are rule-based and machine learning-based approaches to development of tokenizers.&lt;br /&gt;
&lt;br /&gt;
== Rule-based tokenization ==&lt;br /&gt;
&lt;br /&gt;
For example, define a token as a sequence of upper and lower case letters: A-Za-z. Reqular expression is a nice tool for programming such rules.&lt;br /&gt;
&lt;br /&gt;
===RE in Python===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: import re&lt;br /&gt;
&lt;br /&gt;
In[2]: prog = re.compile(&#039;[A-Za-z]+&#039;)&lt;br /&gt;
&lt;br /&gt;
In[3]: prog.findall(&amp;quot;Words, words, words.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Out[1]: [&#039;Words&#039;, &#039;words&#039;, &#039;words&#039;]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sentence segmentation ==&lt;br /&gt;
&lt;br /&gt;
What are the sentence boundaries?&lt;br /&gt;
* ?, ! are usually unambiguous&lt;br /&gt;
* Period &amp;quot;.&amp;quot; is an issue&lt;br /&gt;
* Direct speech is also an issue: She said, &amp;quot;What time will you be home?&amp;quot; and I said, &amp;quot;I don&#039;t know!&amp;quot;. Even worse in Russian!&lt;br /&gt;
&lt;br /&gt;
Let us learn a classifier for sentence segmentation.&lt;br /&gt;
&lt;br /&gt;
===Binary classifier ===&lt;br /&gt;
&lt;br /&gt;
A binary classifier f : X &amp;amp;rArr; 0; 1  takes input data &#039;&#039;X&#039;&#039; (a set of sentences) and decides EndOfSentence (0) or NotEndOfSentence (1).&lt;br /&gt;
&lt;br /&gt;
What can be the features for classification? I am a period, am I EndOfSentence?&lt;br /&gt;
* Lots of blanks after me?&lt;br /&gt;
* Lots of lower case letters and ? or ! after me?&lt;br /&gt;
* Do I belong to abbreviation?&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
We need a lot of hand-markup.&lt;br /&gt;
&lt;br /&gt;
== Natural Language Toolkit (NLTK) ==&lt;br /&gt;
&lt;br /&gt;
Do we need to program this?&lt;br /&gt;
No! There is Natural Language Toolkit (NLTK) for everything.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NLTK tokenizers&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: from nltk.tokenize import RegexpTokenizer,&lt;br /&gt;
wordpunct tokenize&lt;br /&gt;
&lt;br /&gt;
In[2]: s = &#039;Good muffins cost $3.88 in New York. Please&lt;br /&gt;
buy me two of them. Thanks.&#039;&lt;br /&gt;
&lt;br /&gt;
In[3]: tokenizer = RegexpTokenizer(&#039;\w+ | \$ [\d \.]+ | S \+&#039;)&lt;br /&gt;
&lt;br /&gt;
In[4]: tokenizer.tokenize(s)&lt;br /&gt;
&lt;br /&gt;
In[5]: wordpunct tokenize(s)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Learning to tokenize ===&lt;br /&gt;
&lt;br /&gt;
nltk.tokenize.punkt is a tool for learning to tokenize from your data. It includes pre-trained Punkt tokenizer for English.&lt;br /&gt;
&lt;br /&gt;
==== Punkt tokenizer ====&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: import nltk.data&lt;br /&gt;
&lt;br /&gt;
In[2]: sent detector = nltk.data.load(&#039;tokenizers/punkt/english.pickle&#039;)&lt;br /&gt;
&lt;br /&gt;
In[3]: sent detector.tokenize(s)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise 1.1 Word counts ==&lt;br /&gt;
&lt;br /&gt;
Input: Alice in Wonderland (alice.txt) or your text&lt;br /&gt;
&lt;br /&gt;
Output 1: number of tokens&lt;br /&gt;
&lt;br /&gt;
Output 2: number of types&lt;br /&gt;
&lt;br /&gt;
Use nltk.FreqDist() to count types. nltk.FreqDist() is a frequency&lt;br /&gt;
dictionary: [key, frequency(key)].&lt;br /&gt;
&lt;br /&gt;
== Lemmatization (Normalization) ==&lt;br /&gt;
&lt;br /&gt;
Each word has a base form:&lt;br /&gt;
* has, had, have &amp;amp;rArr; have&lt;br /&gt;
* cats, cat, cat&#039;s &amp;amp;rArr; cat&lt;br /&gt;
* Windows &amp;amp;rArr; window or Windows?&lt;br /&gt;
&lt;br /&gt;
=== Lemmatization [Jurafsky, Martin, 1999] ===&lt;br /&gt;
Lemmatization (or normalization) is used to reduce in ections or variant forms to base forms. A dictionary with headwords is required.&lt;br /&gt;
&lt;br /&gt;
=== Lemmatization ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.stem import WordNetLemmatizer&lt;br /&gt;
&lt;br /&gt;
In[2]: lemmatizer = WordNetLemmatizer()&lt;br /&gt;
&lt;br /&gt;
In[3]: lemmatizer.lemmatize(t)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Stemming ==&lt;br /&gt;
&lt;br /&gt;
A word is built with morphems: &#039;&#039;word = stem + affixes&#039;&#039;. Sometimes we do not need affixes.&lt;br /&gt;
&lt;br /&gt;
translate, translation, translator &amp;amp;rArr; translat&lt;br /&gt;
&lt;br /&gt;
=== Stemming [Jurafsky, Martin, 1999] ===&lt;br /&gt;
&lt;br /&gt;
Reduce terms to their stems in information retrieval and text classification. Porter&#039;s algorithm is the most common English stemmer.&lt;br /&gt;
&lt;br /&gt;
=== Stemming ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: from nltk.stem.porter import PorterStemmer&lt;br /&gt;
&lt;br /&gt;
In[2]: stemmer = PorterStemmer()&lt;br /&gt;
&lt;br /&gt;
In[3]: stemmer.stem(t)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise 1.2 Word counts (continued) ==&lt;br /&gt;
&lt;br /&gt;
Input: Alice in Wonderland (alice.txt) or your text &lt;br /&gt;
&lt;br /&gt;
Output 1: 20 most common lemmata&lt;br /&gt;
&lt;br /&gt;
Output 2: 20 most common stems&lt;br /&gt;
&lt;br /&gt;
Use FreqDist() to count lemmata and stems. Use FreqDist().most common() to find most common lemmata and stems.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1.3 Do we need all words? ==&lt;br /&gt;
&lt;br /&gt;
Stopword is a not meaningful word: prepositions, adjunctions, pronouns, articles, etc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stopwords&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.corpus import stopwords&lt;br /&gt;
&lt;br /&gt;
In[2]: print stopwords.words(&#039;english&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise 1.3&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Input: Alice in Wonderland (alice.txt) or your text&lt;br /&gt;
&lt;br /&gt;
Output 1: 20 most common lemmata without stop words&lt;br /&gt;
&lt;br /&gt;
Use not in operator to exclude not stopwords in a cycle.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17046</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17046"/>
		<updated>2015-09-02T22:30:38Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Language Model [Ponte, Croft, 1998] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; ) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;) = p(t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;|BOS) p(t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)p(t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;|t&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)p(EOS|t&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17043</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17043"/>
		<updated>2015-08-31T21:27:53Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Language Model [Ponte, Croft, 1998] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |BOS)p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(EOS|t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17042</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17042"/>
		<updated>2015-08-31T21:27:35Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Language Model [Ponte, Croft, 1998] */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |BOS)p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(EOS|t&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17041</id>
		<title>Lecture 3. POS tagging. Key word and phrase extraction</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_3._POS_tagging._Key_word_and_phrase_extraction&amp;diff=17041"/>
		<updated>2015-08-31T21:26:18Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Exercise 3.2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Part of speech (POS) ==&lt;br /&gt;
&lt;br /&gt;
Part of speech [Manning, Shuetze, 1999]&lt;br /&gt;
&lt;br /&gt;
Words of a language are grouped into classes which show similar syntactic behavior. These word classes are called parts of speech (POS). Three&lt;br /&gt;
important parts of speech are noun, verb, and adjective. The major types of morphological process are in ection, derivation, and compounding.&lt;br /&gt;
&lt;br /&gt;
There are around 9 POS according to different schools:&lt;br /&gt;
* Nouns (NN, NP), pronouns (PN, PRP), adjectives (JJ): number, gender, case&lt;br /&gt;
* Adjective (JJ): comparative, superlative, short form&lt;br /&gt;
* Verbs (VB): subject number, subject person, tense, aspect, modality, participles, voice&lt;br /&gt;
* Adverbs (RB), prepositions (IN), conjunctions (, CS), articles (AT)&lt;br /&gt;
and particles (RP): nothing&lt;br /&gt;
&lt;br /&gt;
== POS ambiguation ==&lt;br /&gt;
&lt;br /&gt;
Ship (noun or verb?)&lt;br /&gt;
&lt;br /&gt;
* a luxury cruise ship&lt;br /&gt;
* Both products are due to ship at the beginning of June&lt;br /&gt;
* A new engine was shipped over from the US&lt;br /&gt;
* The port is closed to all &#039;&#039;&#039;shipping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Contest (noun or verb?)&lt;br /&gt;
* Stone decided to hold a contest to see who could write the best song.&lt;br /&gt;
* She plans to contest a seat in Congress next year.&lt;br /&gt;
&lt;br /&gt;
== POS taggers ==&lt;br /&gt;
&lt;br /&gt;
* Corpus- or dictionary-based VS rule-based&lt;br /&gt;
* Ngram-based taggers:&lt;br /&gt;
** unigram tagging: assign the most frequent tag&lt;br /&gt;
** ngram tagging: look at the context of n previous words (requires a lot of training data)&lt;br /&gt;
* Trade-off between the accuracy and the coverage: combine different taggers&lt;br /&gt;
&lt;br /&gt;
===NLTK POS default tagger===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.tag import pos tag&lt;br /&gt;
&lt;br /&gt;
In[2]: print pos tag([&#039;ship&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[1]: [(&#039;ship&#039;, &#039;NN&#039;)]&lt;br /&gt;
&lt;br /&gt;
In[3]: print pos tag([&#039;shipping&#039;])&lt;br /&gt;
&lt;br /&gt;
Out[2]: [(&#039;shipping&#039;, &#039;VBG&#039;)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/api/nltk.tag.html|http://www.nltk.org/api/nltk.tag.html] for more details on&lt;br /&gt;
learning taggers.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3.1 Genre comparison ==&lt;br /&gt;
&lt;br /&gt;
Text genre [Santini, Sharoff, 2009]&lt;br /&gt;
&lt;br /&gt;
The concept of genre is hard to agree upon. Many interpretations have been proposed since Aristotles Poetics without reaching any definite&lt;br /&gt;
conclusions about the inventory or even principles for classifying documents into genres. The lack of an agreed definition of what genre is causes the problem of the loose boundaries between the term \genre&amp;quot; with other neighbouring terms, such as &amp;quot;register&amp;quot;, &amp;quot;domain&amp;quot;, &amp;quot;topic&amp;quot;, and &amp;quot;style&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise 3.1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Input: Two texts of different genre (for example, Wikipedia article and&lt;br /&gt;
blog post)&lt;br /&gt;
Output: rank all of POS tags for both texts&lt;br /&gt;
&lt;br /&gt;
How can you describe the difference between two genres?&lt;br /&gt;
&lt;br /&gt;
== Key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
There are many definitions of key word and phrase. Thus there are many methods for their extraction:&lt;br /&gt;
&lt;br /&gt;
* supervised VS unsupervised&lt;br /&gt;
* frequency-based VS more complex&lt;br /&gt;
* from individual text VS from text collection&lt;br /&gt;
* word (unigram) VS bigram VS ngram&lt;br /&gt;
* term VS named entity VS collocation&lt;br /&gt;
* sequential words VS using window&lt;br /&gt;
&lt;br /&gt;
== Supervised methods for key word and phrase extraction ==&lt;br /&gt;
&lt;br /&gt;
I am a word. Am I a key word? Let us build a classifier.&lt;br /&gt;
&lt;br /&gt;
* Am I in the beginning or in the end of the sentence?&lt;br /&gt;
* Am I capitalized?&lt;br /&gt;
* How many times do I occur?&lt;br /&gt;
* Am I used in Wikipedia as a title of a category or an article?&lt;br /&gt;
* Am I a term?&lt;br /&gt;
* Am I a NE?&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
But we need a collection of marked up texts!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase extraction from a single text ==&lt;br /&gt;
&lt;br /&gt;
* POS patterns&lt;br /&gt;
* Association measures: PMI, T-Score, LLR&lt;br /&gt;
* Graph methods: TextRank [Mihalcea, Tarau, 2004]&lt;br /&gt;
* Syntactic patterns&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.2 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif1.txt (or your own text)&lt;br /&gt;
&lt;br /&gt;
Key word: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;1&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; NN&lt;br /&gt;
&lt;br /&gt;
Key phrase: top n&amp;lt;small&amp;gt;&amp;lt;small&amp;gt;2&amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; phrases, that satisfy the following patterns: JJ + NN, NN + NN, NN + IN + NN&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases&lt;br /&gt;
&lt;br /&gt;
Hint: use nltk.ngrams to get ngrams.&lt;br /&gt;
&lt;br /&gt;
== Bigram association measures ==&lt;br /&gt;
&lt;br /&gt;
==== Pointwise Mutual Information [Manning, Shuetze, 1999] ==== &lt;br /&gt;
&lt;br /&gt;
PMI measures the reduction of uncertainty about the occurrence of one&lt;br /&gt;
word when we are told about the occurrence of the other one.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
==== T-Score [Manning, Shuetze, 1999] ====&lt;br /&gt;
&lt;br /&gt;
T-Score is a statistical t-test applied to finding collocations. The t-test&lt;br /&gt;
looks at the difference between the observed and expected means, scaled&lt;br /&gt;
by the variance of the data. The T-score is most useful as a method for&lt;br /&gt;
ranking collocations. The level of significance itself is less useful.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p2.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p3.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
But Chi-squared has many other interesting applications.&lt;br /&gt;
&lt;br /&gt;
==== Chi-squared [Manning, Shuetze, 1999] ====&lt;br /&gt;
In general, for the problem of finding collocation, the difference between the T-score and the Chi-squared does not seem to be large.&lt;br /&gt;
&lt;br /&gt;
=== Bigram association measures in NLTK ===&lt;br /&gt;
&lt;br /&gt;
==== NLTK BigramCollocationFinder ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.collocations import *&lt;br /&gt;
&lt;br /&gt;
In[2]: bigram measures = nltk.collocations.BigramAssocMeasures()&lt;br /&gt;
&lt;br /&gt;
In[3]: finder = BigramCollocationFinder.from words(tokens)&lt;br /&gt;
&lt;br /&gt;
In[4]: finder.apply freq filter(3)&lt;br /&gt;
&lt;br /&gt;
In[5]: for i in finder.nbest(bigram measures.pmi, 20):&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bigram measures:&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.pmi &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.student_t &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; bigram measures.chi_sq &amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt; igram measures.likelihood_ratio &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [http://www.nltk.org/_modules/nltk/metrics/association.html|http://www.nltk.org/_modules/nltk/metrics/association.html] for more more bigram association measures.&lt;br /&gt;
&lt;br /&gt;
== TextRank: using graph centrality measures for key word and phrase extraction [Mihalcea, Tarau, 2004] ==&lt;br /&gt;
&lt;br /&gt;
# Add words as vertices in the graph.&lt;br /&gt;
# Identify relations that connect words:&lt;br /&gt;
## consequent words;&lt;br /&gt;
## words inside (left or right) the window (2-5 words); and use these relations to draw edges between vertices in the graph. Edges can be directed or undirected, weighted or unweighted.&lt;br /&gt;
# Iterate the graph-based ranking algorithm until convergence (for example, PageRank).&lt;br /&gt;
# Sort vertices based on their final score. Use the values attached to each vertex for ranking/selection decisions.&lt;br /&gt;
# If two adjacent words are selected as potential keywords by TextRank, collapse them into one single key phrase.&lt;br /&gt;
&lt;br /&gt;
See original paper: [http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf|http://web.eecs.umich.edu/~mihalcea/papers/mihalcea.emnlp04.pdf]&lt;br /&gt;
&lt;br /&gt;
Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types systems and systems of mixed types.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p4.jpg|обрамить|TextRank]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
G = (V, E) — a graph, V — vertices, E — edges&lt;br /&gt;
&#039;&#039;In(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that point to it&lt;br /&gt;
&#039;&#039;Out(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;)&#039;&#039; — the set of vertices that &#039;&#039;V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;&#039;&#039; points to&lt;br /&gt;
Graph centrality measures:&lt;br /&gt;
&lt;br /&gt;
==== PageRank [Brin, Page, 1998] ====&lt;br /&gt;
[[Файл:L3 p5.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
==== HITS [Kleinberg, 1999] ==== &lt;br /&gt;
[[Файл:L3 p6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Key words and phrases, assigned by TextRank using PageRank centrality measure: linear constraints; linear diophantine equations; natural numbers; nonstrict inequations; strict inequations; upper bounds&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.3 ====&lt;br /&gt;
&lt;br /&gt;
Input: sif.txt (or your own text) &lt;br /&gt;
Output: key words and phrases computed by PageRank (using PR(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;),HITS&amp;lt;small&amp;gt;A&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) and HITS&amp;lt;small&amp;gt;H&amp;lt;/small&amp;gt;(V&amp;lt;small&amp;gt;i&amp;lt;/small&amp;gt;) as centrality measures)&lt;br /&gt;
&lt;br /&gt;
Hint: use NetworkX for PageRank and HITS [http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html|http://networkx.github.io/documentation/networkx-1.9.1/reference/algorithms.link_analysis.html]&lt;br /&gt;
&lt;br /&gt;
== Unsupervised methods for key word and phrase selection from a text in a collection ==&lt;br /&gt;
&lt;br /&gt;
The problem: given a collection of texts find those words and phrases (terms) that occur in this text significant frequently than in other texts.&lt;br /&gt;
&lt;br /&gt;
=== Term frequency [Luhn, 1957] === &lt;br /&gt;
&lt;br /&gt;
The weight of a term that occurs in a document is simply proportional to the term frequency.&lt;br /&gt;
&lt;br /&gt;
=== Inverse document frequency [Spaerck Jones, 1972] ===&lt;br /&gt;
&lt;br /&gt;
The specificity of a term can be quantified as an inverse function of the number of documents in which it occurs.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;tfidf (term, text, collection) = tf (term, document) × idf (term, collection)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Variants of TF and IDF weights ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L3 p7.jpg|обрамить|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF in NLTK ==&lt;br /&gt;
&lt;br /&gt;
===NLTK TextCollection class ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.text import TextCollection&lt;br /&gt;
&lt;br /&gt;
In[2]: collection = [WhitespaceTokenizer().tokenize(text) for text in collection]&lt;br /&gt;
&lt;br /&gt;
In[3]: corpus = TextCollection(collection)&lt;br /&gt;
&lt;br /&gt;
In[4]: for i in collection[0]: print i, corpus.tf idf(i,collection[0])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3.4 ===&lt;br /&gt;
&lt;br /&gt;
Input: sif2.txt (or your own collection of texts)&lt;br /&gt;
&lt;br /&gt;
Output: list of key words and phrases according to TF-IDF for one text&lt;br /&gt;
&lt;br /&gt;
Hint: &amp;lt;code&amp;gt; use sorted(mylist,key=lambda l:l[1], reverse=True) to sort mylist in descending order based on the second parameter &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== TF-IDF alternatives ==&lt;br /&gt;
&lt;br /&gt;
==== Exercise 3.5 ====&lt;br /&gt;
&lt;br /&gt;
Write MI and Chi-squared as an alternative for TF-IDF for measuring significance of a term in a text in a collection.&lt;br /&gt;
Check your ideas in Sebastiani[http://arxiv.org/pdf/cs/0110053.pdf|], 2001&lt;br /&gt;
&lt;br /&gt;
== Using TF-IDF to measure text similarity ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_2._Tokenization_and_word_counts&amp;diff=17040</id>
		<title>Lecture 2. Tokenization and word counts</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_2._Tokenization_and_word_counts&amp;diff=17040"/>
		<updated>2015-08-31T21:25:29Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Heaps&amp;#039; law */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== How many words? ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;The rain in Spain stays mainly in the plain.&amp;quot;&lt;br /&gt;
9 &#039;&#039;&#039;tokens&#039;&#039;&#039;: The, rain, in, Spain, stays, mainly, in, the, plain&lt;br /&gt;
7 (or 8) &#039;&#039;&#039;types&#039;&#039;&#039;: T = the rain, in, Spain, stays, mainly, plain&lt;br /&gt;
&lt;br /&gt;
=== Type and token ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Type&#039;&#039; is an element of the vocabulary.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Token&#039;&#039; is an instance of that type in the text.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
N = number of tokens;&lt;br /&gt;
&lt;br /&gt;
V - vocabulary (i.e. all types);&lt;br /&gt;
&lt;br /&gt;
|V| = size of vocabulary (i.e. number of types).&lt;br /&gt;
&lt;br /&gt;
How are N and |V| related?&lt;br /&gt;
&lt;br /&gt;
== Zipf&#039;s law ==&lt;br /&gt;
&lt;br /&gt;
=== Zipf&#039;s law ([Gelbukh, Sidorov, 2001]) ===&lt;br /&gt;
&lt;br /&gt;
In any large enough text, the frequency ranks (starting from the highest)&lt;br /&gt;
of types are inversely proportional to the corresponding frequencies:&lt;br /&gt;
 f = 1/r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;f&#039;&#039; — frequency of a type;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;r&#039;&#039; — rank of a type (its position in the list of all types in order of their frequency of occurrence).&lt;br /&gt;
&lt;br /&gt;
[[Файл:L2 p1.jpg|мини|Zipf&#039;s law: example]]&lt;br /&gt;
&lt;br /&gt;
== Heaps&#039; law ==&lt;br /&gt;
&lt;br /&gt;
Heaps&#039; law ([Gelbukh, Sidorov, 2001])&lt;br /&gt;
&lt;br /&gt;
The number of different types in a text is roughly proportional to an exponent of its size:&lt;br /&gt;
[[Файл:L2 p2.jpg|мини|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;N&#039;&#039; = number of tokens;&lt;br /&gt;
&lt;br /&gt;
|V| = size of vocabulary (i.e. number of types);&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;K&#039;&#039;, &#039;&#039;b&#039;&#039; — free parameters,  K &amp;amp;isin; [10; 100]; b &amp;amp;isin; [0.4; 0.6]&lt;br /&gt;
&lt;br /&gt;
== Why tokenization is difficult? ==&lt;br /&gt;
&lt;br /&gt;
*Easy example: &amp;quot;Good muffins cost $3.88 in New York. Please buy me two of them. Thanks.&amp;quot;&lt;br /&gt;
** is \.&amp;quot; a token?&lt;br /&gt;
** is $3.88 a single token?&lt;br /&gt;
** is \New York&amp;quot; a single token?&lt;br /&gt;
*Real data may contain noise in it: code, markup, URLs, faulty punctuation&lt;br /&gt;
* Real data contains misspellings: &amp;quot;an dthen she aksed&amp;quot;&lt;br /&gt;
*Period &amp;quot;.&amp;quot; does not always mean the end of sentence: m.p.h., PhD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Nevertheless tokenization is important for all other text processing steps.&lt;br /&gt;
There are rule-based and machine learning-based approaches to development of tokenizers.&lt;br /&gt;
&lt;br /&gt;
== Rule-based tokenization ==&lt;br /&gt;
&lt;br /&gt;
For example, define a token as a sequence of upper and lower case letters: A-Za-z. Reqular expression is a nice tool for programming such rules.&lt;br /&gt;
&lt;br /&gt;
===RE in Python===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: import re&lt;br /&gt;
&lt;br /&gt;
In[2]: prog = re.compile(&#039;[A-Za-z]+&#039;)&lt;br /&gt;
&lt;br /&gt;
In[3]: prog.findall(&amp;quot;Words, words, words.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Out[1]: [&#039;Words&#039;, &#039;words&#039;, &#039;words&#039;]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sentence segmentation ==&lt;br /&gt;
&lt;br /&gt;
What are the sentence boundaries?&lt;br /&gt;
* ?, ! are usually unambiguous&lt;br /&gt;
* Period &amp;quot;.&amp;quot; is an issue&lt;br /&gt;
* Direct speech is also an issue: She said, &amp;quot;What time will you be home?&amp;quot; and I said, &amp;quot;I don&#039;t know!&amp;quot;. Even worse in Russian!&lt;br /&gt;
&lt;br /&gt;
Let us learn a classifier for sentence segmentation.&lt;br /&gt;
&lt;br /&gt;
===Binary classifier ===&lt;br /&gt;
&lt;br /&gt;
A binary classifier f : X &amp;amp;rArr; 0; 1  takes input data &#039;&#039;X&#039;&#039; (a set of sentences) and decides EndOfSentence (0) or NotEndOfSentence (1).&lt;br /&gt;
&lt;br /&gt;
What can be the features for classification? I am a period, am I EndOfSentence?&lt;br /&gt;
* Lots of blanks after me?&lt;br /&gt;
* Lots of lower case letters and ? or ! after me?&lt;br /&gt;
* Do I belong to abbreviation?&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
We need a lot of hand-markup.&lt;br /&gt;
&lt;br /&gt;
== Natural Language Toolkit (NLTK) ==&lt;br /&gt;
&lt;br /&gt;
Do we need to program this?&lt;br /&gt;
No! There is Natural Language Toolkit (NLTK) for everything.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NLTK tokenizers&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: from nltk.tokenize import RegexpTokenizer,&lt;br /&gt;
wordpunct tokenize&lt;br /&gt;
&lt;br /&gt;
In[2]: s = &#039;Good muffins cost $3.88 in New York. Please&lt;br /&gt;
buy me two of them. Thanks.&#039;&lt;br /&gt;
&lt;br /&gt;
In[3]: tokenizer = RegexpTokenizer(&#039;\w+ | \$ [\d \.]+ | S \+&#039;)&lt;br /&gt;
&lt;br /&gt;
In[4]: tokenizer.tokenize(s)&lt;br /&gt;
&lt;br /&gt;
In[5]: wordpunct tokenize(s)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Learning to tokenize ===&lt;br /&gt;
&lt;br /&gt;
nltk.tokenize.punkt is a tool for learning to tokenize from your data. It includes pre-trained Punkt tokenizer for English.&lt;br /&gt;
&lt;br /&gt;
==== Punkt tokenizer ====&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: import nltk.data&lt;br /&gt;
&lt;br /&gt;
In[2]: sent detector = nltk.data.load(&#039;tokenizers/punkt/english.pickle&#039;)&lt;br /&gt;
&lt;br /&gt;
In[3]: sent detector.tokenize(s)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise 1.1 Word counts ==&lt;br /&gt;
&lt;br /&gt;
Input: Alice in Wonderland (alice.txt) or your text&lt;br /&gt;
&lt;br /&gt;
Output 1: number of tokens&lt;br /&gt;
&lt;br /&gt;
Output 2: number of types&lt;br /&gt;
&lt;br /&gt;
Use nltk.FreqDist() to count types. nltk.FreqDist() is a frequency&lt;br /&gt;
dictionary: [key, frequency(key)].&lt;br /&gt;
&lt;br /&gt;
== Lemmatization (Normalization) ==&lt;br /&gt;
&lt;br /&gt;
Each word has a base form:&lt;br /&gt;
* has, had, have &amp;amp;rArr; have&lt;br /&gt;
* cats, cat, cat&#039;s &amp;amp;rArr; cat&lt;br /&gt;
* Windows &amp;amp;rArr; window or Windows?&lt;br /&gt;
&lt;br /&gt;
=== Lemmatization [Jurafsky, Martin, 1999] ===&lt;br /&gt;
Lemmatization (or normalization) is used to reduce in ections or variant forms to base forms. A dictionary with headwords is required.&lt;br /&gt;
&lt;br /&gt;
=== Lemmatization ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.stem import WordNetLemmatizer&lt;br /&gt;
&lt;br /&gt;
In[2]: lemmatizer = WordNetLemmatizer()&lt;br /&gt;
&lt;br /&gt;
In[3]: lemmatizer.lemmatize(t)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Stemming ==&lt;br /&gt;
&lt;br /&gt;
A word is built with morphems: &#039;&#039;word = stem + affixes&#039;&#039;. Sometimes we do not need affixes.&lt;br /&gt;
&lt;br /&gt;
translate, translation, translator &amp;amp;rArr; translat&lt;br /&gt;
&lt;br /&gt;
=== Stemming [Jurafsky, Martin, 1999] ===&lt;br /&gt;
&lt;br /&gt;
Reduce terms to their stems in information retrieval and text classification. Porter&#039;s algorithm is the most common English stemmer.&lt;br /&gt;
&lt;br /&gt;
=== Stemming ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: from nltk.stem.porter import PorterStemmer&lt;br /&gt;
&lt;br /&gt;
In[2]: stemmer = PorterStemmer()&lt;br /&gt;
&lt;br /&gt;
In[3]: stemmer.stem(t)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise 1.2 Word counts (continued) ==&lt;br /&gt;
&lt;br /&gt;
Input: Alice in Wonderland (alice.txt) or your text &lt;br /&gt;
&lt;br /&gt;
Output 1: 20 most common lemmata&lt;br /&gt;
&lt;br /&gt;
Output 2: 20 most common stems&lt;br /&gt;
&lt;br /&gt;
Use FreqDist() to count lemmata and stems. Use FreqDist().most common() to find most common lemmata and stems.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1.3 Do we need all words? ==&lt;br /&gt;
&lt;br /&gt;
Stopword is a not meaningful word: prepositions, adjunctions, pronouns, articles, etc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stopwords&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.corpus import stopwords&lt;br /&gt;
&lt;br /&gt;
In[2]: print stopwords.words(&#039;english&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise 1.3&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Input: Alice in Wonderland (alice.txt) or your text&lt;br /&gt;
&lt;br /&gt;
Output 1: 20 most common lemmata without stop words&lt;br /&gt;
&lt;br /&gt;
Use not in operator to exclude not stopwords in a cycle.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_2._Tokenization_and_word_counts&amp;diff=17039</id>
		<title>Lecture 2. Tokenization and word counts</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_2._Tokenization_and_word_counts&amp;diff=17039"/>
		<updated>2015-08-31T21:25:09Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Binary classifier */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== How many words? ==&lt;br /&gt;
&lt;br /&gt;
&amp;quot;The rain in Spain stays mainly in the plain.&amp;quot;&lt;br /&gt;
9 &#039;&#039;&#039;tokens&#039;&#039;&#039;: The, rain, in, Spain, stays, mainly, in, the, plain&lt;br /&gt;
7 (or 8) &#039;&#039;&#039;types&#039;&#039;&#039;: T = the rain, in, Spain, stays, mainly, plain&lt;br /&gt;
&lt;br /&gt;
=== Type and token ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Type&#039;&#039; is an element of the vocabulary.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Token&#039;&#039; is an instance of that type in the text.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
N = number of tokens;&lt;br /&gt;
&lt;br /&gt;
V - vocabulary (i.e. all types);&lt;br /&gt;
&lt;br /&gt;
|V| = size of vocabulary (i.e. number of types).&lt;br /&gt;
&lt;br /&gt;
How are N and |V| related?&lt;br /&gt;
&lt;br /&gt;
== Zipf&#039;s law ==&lt;br /&gt;
&lt;br /&gt;
=== Zipf&#039;s law ([Gelbukh, Sidorov, 2001]) ===&lt;br /&gt;
&lt;br /&gt;
In any large enough text, the frequency ranks (starting from the highest)&lt;br /&gt;
of types are inversely proportional to the corresponding frequencies:&lt;br /&gt;
 f = 1/r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;f&#039;&#039; — frequency of a type;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;r&#039;&#039; — rank of a type (its position in the list of all types in order of their frequency of occurrence).&lt;br /&gt;
&lt;br /&gt;
[[Файл:L2 p1.jpg|мини|Zipf&#039;s law: example]]&lt;br /&gt;
&lt;br /&gt;
== Heaps&#039; law ==&lt;br /&gt;
&lt;br /&gt;
Heaps&#039; law ([Gelbukh, Sidorov, 2001])&lt;br /&gt;
&lt;br /&gt;
The number of different types in a text is roughly proportional to an exponent of its size:&lt;br /&gt;
[[Файл:L2 p2.jpg|мини|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;N&#039;&#039; = number of tokens;&lt;br /&gt;
&lt;br /&gt;
|V| = size of vocabulary (i.e. number of types);&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;K&#039;&#039;, &#039;&#039;b&#039;&#039; — free parameters, &amp;lt;math&amp;gt; K &amp;amp;isin; [10; 100]; b &amp;amp;isin; [0.4; 0.6] &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Why tokenization is difficult? ==&lt;br /&gt;
&lt;br /&gt;
*Easy example: &amp;quot;Good muffins cost $3.88 in New York. Please buy me two of them. Thanks.&amp;quot;&lt;br /&gt;
** is \.&amp;quot; a token?&lt;br /&gt;
** is $3.88 a single token?&lt;br /&gt;
** is \New York&amp;quot; a single token?&lt;br /&gt;
*Real data may contain noise in it: code, markup, URLs, faulty punctuation&lt;br /&gt;
* Real data contains misspellings: &amp;quot;an dthen she aksed&amp;quot;&lt;br /&gt;
*Period &amp;quot;.&amp;quot; does not always mean the end of sentence: m.p.h., PhD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Nevertheless tokenization is important for all other text processing steps.&lt;br /&gt;
There are rule-based and machine learning-based approaches to development of tokenizers.&lt;br /&gt;
&lt;br /&gt;
== Rule-based tokenization ==&lt;br /&gt;
&lt;br /&gt;
For example, define a token as a sequence of upper and lower case letters: A-Za-z. Reqular expression is a nice tool for programming such rules.&lt;br /&gt;
&lt;br /&gt;
===RE in Python===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: import re&lt;br /&gt;
&lt;br /&gt;
In[2]: prog = re.compile(&#039;[A-Za-z]+&#039;)&lt;br /&gt;
&lt;br /&gt;
In[3]: prog.findall(&amp;quot;Words, words, words.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Out[1]: [&#039;Words&#039;, &#039;words&#039;, &#039;words&#039;]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sentence segmentation ==&lt;br /&gt;
&lt;br /&gt;
What are the sentence boundaries?&lt;br /&gt;
* ?, ! are usually unambiguous&lt;br /&gt;
* Period &amp;quot;.&amp;quot; is an issue&lt;br /&gt;
* Direct speech is also an issue: She said, &amp;quot;What time will you be home?&amp;quot; and I said, &amp;quot;I don&#039;t know!&amp;quot;. Even worse in Russian!&lt;br /&gt;
&lt;br /&gt;
Let us learn a classifier for sentence segmentation.&lt;br /&gt;
&lt;br /&gt;
===Binary classifier ===&lt;br /&gt;
&lt;br /&gt;
A binary classifier f : X &amp;amp;rArr; 0; 1  takes input data &#039;&#039;X&#039;&#039; (a set of sentences) and decides EndOfSentence (0) or NotEndOfSentence (1).&lt;br /&gt;
&lt;br /&gt;
What can be the features for classification? I am a period, am I EndOfSentence?&lt;br /&gt;
* Lots of blanks after me?&lt;br /&gt;
* Lots of lower case letters and ? or ! after me?&lt;br /&gt;
* Do I belong to abbreviation?&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
We need a lot of hand-markup.&lt;br /&gt;
&lt;br /&gt;
== Natural Language Toolkit (NLTK) ==&lt;br /&gt;
&lt;br /&gt;
Do we need to program this?&lt;br /&gt;
No! There is Natural Language Toolkit (NLTK) for everything.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NLTK tokenizers&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: from nltk.tokenize import RegexpTokenizer,&lt;br /&gt;
wordpunct tokenize&lt;br /&gt;
&lt;br /&gt;
In[2]: s = &#039;Good muffins cost $3.88 in New York. Please&lt;br /&gt;
buy me two of them. Thanks.&#039;&lt;br /&gt;
&lt;br /&gt;
In[3]: tokenizer = RegexpTokenizer(&#039;\w+ | \$ [\d \.]+ | S \+&#039;)&lt;br /&gt;
&lt;br /&gt;
In[4]: tokenizer.tokenize(s)&lt;br /&gt;
&lt;br /&gt;
In[5]: wordpunct tokenize(s)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Learning to tokenize ===&lt;br /&gt;
&lt;br /&gt;
nltk.tokenize.punkt is a tool for learning to tokenize from your data. It includes pre-trained Punkt tokenizer for English.&lt;br /&gt;
&lt;br /&gt;
==== Punkt tokenizer ====&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: import nltk.data&lt;br /&gt;
&lt;br /&gt;
In[2]: sent detector = nltk.data.load(&#039;tokenizers/punkt/english.pickle&#039;)&lt;br /&gt;
&lt;br /&gt;
In[3]: sent detector.tokenize(s)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise 1.1 Word counts ==&lt;br /&gt;
&lt;br /&gt;
Input: Alice in Wonderland (alice.txt) or your text&lt;br /&gt;
&lt;br /&gt;
Output 1: number of tokens&lt;br /&gt;
&lt;br /&gt;
Output 2: number of types&lt;br /&gt;
&lt;br /&gt;
Use nltk.FreqDist() to count types. nltk.FreqDist() is a frequency&lt;br /&gt;
dictionary: [key, frequency(key)].&lt;br /&gt;
&lt;br /&gt;
== Lemmatization (Normalization) ==&lt;br /&gt;
&lt;br /&gt;
Each word has a base form:&lt;br /&gt;
* has, had, have &amp;amp;rArr; have&lt;br /&gt;
* cats, cat, cat&#039;s &amp;amp;rArr; cat&lt;br /&gt;
* Windows &amp;amp;rArr; window or Windows?&lt;br /&gt;
&lt;br /&gt;
=== Lemmatization [Jurafsky, Martin, 1999] ===&lt;br /&gt;
Lemmatization (or normalization) is used to reduce in ections or variant forms to base forms. A dictionary with headwords is required.&lt;br /&gt;
&lt;br /&gt;
=== Lemmatization ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.stem import WordNetLemmatizer&lt;br /&gt;
&lt;br /&gt;
In[2]: lemmatizer = WordNetLemmatizer()&lt;br /&gt;
&lt;br /&gt;
In[3]: lemmatizer.lemmatize(t)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Stemming ==&lt;br /&gt;
&lt;br /&gt;
A word is built with morphems: &#039;&#039;word = stem + affixes&#039;&#039;. Sometimes we do not need affixes.&lt;br /&gt;
&lt;br /&gt;
translate, translation, translator &amp;amp;rArr; translat&lt;br /&gt;
&lt;br /&gt;
=== Stemming [Jurafsky, Martin, 1999] ===&lt;br /&gt;
&lt;br /&gt;
Reduce terms to their stems in information retrieval and text classification. Porter&#039;s algorithm is the most common English stemmer.&lt;br /&gt;
&lt;br /&gt;
=== Stemming ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
In[1]: from nltk.stem.porter import PorterStemmer&lt;br /&gt;
&lt;br /&gt;
In[2]: stemmer = PorterStemmer()&lt;br /&gt;
&lt;br /&gt;
In[3]: stemmer.stem(t)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exercise 1.2 Word counts (continued) ==&lt;br /&gt;
&lt;br /&gt;
Input: Alice in Wonderland (alice.txt) or your text &lt;br /&gt;
&lt;br /&gt;
Output 1: 20 most common lemmata&lt;br /&gt;
&lt;br /&gt;
Output 2: 20 most common stems&lt;br /&gt;
&lt;br /&gt;
Use FreqDist() to count lemmata and stems. Use FreqDist().most common() to find most common lemmata and stems.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1.3 Do we need all words? ==&lt;br /&gt;
&lt;br /&gt;
Stopword is a not meaningful word: prepositions, adjunctions, pronouns, articles, etc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stopwords&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In[1]: from nltk.corpus import stopwords&lt;br /&gt;
&lt;br /&gt;
In[2]: print stopwords.words(&#039;english&#039;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise 1.3&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Input: Alice in Wonderland (alice.txt) or your text&lt;br /&gt;
&lt;br /&gt;
Output 1: 20 most common lemmata without stop words&lt;br /&gt;
&lt;br /&gt;
Use not in operator to exclude not stopwords in a cycle.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17038</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17038"/>
		<updated>2015-08-31T21:24:35Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |BOS)p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(EOS|t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
AST construction and scoring in linear time and space using suffix arrays is developed by Mikhail Dubov. Take a look at his library for Python at GitHub: [https://github.com/msdubov/AST-text-analysis]. By the way, there is a huge theory about suffix trees and string algorithms I did not talk today about.&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17037</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17037"/>
		<updated>2015-08-31T21:23:42Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Profound filtering */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |BOS)p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(EOS|t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17036</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17036"/>
		<updated>2015-08-31T21:23:30Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Profound filtering */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |BOS)p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(EOS|t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
Za-***-t&#039;&lt;br /&gt;
Pro-***-t&#039;&lt;br /&gt;
Vy-***-t&#039;&lt;br /&gt;
Na-***-t&#039;&lt;br /&gt;
&lt;br /&gt;
There are dictionaries of *** , but new words appear. And we have new policy of using profanity in the Web. Also stemming fails since it does not strip preffixes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Idea&#039;&#039;&#039;: Get a text from the web. Construct an AST from it and index.&lt;br /&gt;
Score *** to it. Find profound words.&lt;br /&gt;
Chernyak,&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17035</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17035"/>
		<updated>2015-08-31T21:22:39Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Reference graph */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |BOS)p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(EOS|t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17034</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17034"/>
		<updated>2015-08-31T21:22:12Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Reference graph */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |BOS)p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(EOS|t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 14.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Reference graph is a graph of association rules. Not interesting itself, but:&lt;br /&gt;
* Dynamics&lt;br /&gt;
* Link analysis&lt;br /&gt;
* Visualization with different options&lt;br /&gt;
* Data: Russian newspapers&lt;br /&gt;
* Nodes: Key words and phrases&lt;br /&gt;
* Edges: A &amp;amp;rArr; B: the key word or phrase B occurs with a higher probability if the key word or phrase A occurs in the same text Features: Easy extension to temporal case and possibility of well developed graph analysis methods&lt;br /&gt;
&lt;br /&gt;
Reference graphs can be used as a tool of information discovery and search and as a tool for temporal analysis.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 15.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L8_15.jpg&amp;diff=17033</id>
		<title>Файл:L8 15.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L8_15.jpg&amp;diff=17033"/>
		<updated>2015-08-31T21:17:03Z</updated>

		<summary type="html">&lt;p&gt;Polidson: NLP: L8&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;NLP: L8&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17032</id>
		<title>Lecture 8. Suffix trees for NLP</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=Lecture_8._Suffix_trees_for_NLP&amp;diff=17032"/>
		<updated>2015-08-31T21:15:40Z</updated>

		<summary type="html">&lt;p&gt;Polidson: /* Annotated suffix tree construction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Text (collection) representation model ==&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Models, VSM [Salton, Wong, Yang, 1975] : every text is a vector in a space of terms. Usually is used along with cosine similarity&lt;br /&gt;
measure. &lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Makes linear algebra operation and thus machine learning applicable&lt;br /&gt;
* Is simple and based on human intuition&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The more the words are there in the the text, the higher is the cosinesimilarity&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Topic, genre and maybe sentiment classification&lt;br /&gt;
* Extractive summarization&lt;br /&gt;
* Spam filtering&lt;br /&gt;
&lt;br /&gt;
=== Generalized Vector Space Models ===&lt;br /&gt;
&lt;br /&gt;
Generalized Vector Space Models, GVSM [Wong, Ziarko, Wong, 1985]: introduces a term to term correlation in the VSM.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Synonyms or near synonyms are introduced into the model&lt;br /&gt;
* Term to term correlation may be computed in several ways: co-occurrences in the collection under consideration, co-occurrences in a large corpus, thesaurus-based relations&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* A lot of computations: if jVj = n (the number of terms), there are 2ndimensions in the GVSM&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications: mainly information retrieval&lt;br /&gt;
&lt;br /&gt;
=== Vector Space Model of Semantics ===&lt;br /&gt;
&lt;br /&gt;
Vector Space Model of Semantics [Turney, Pantel, 2010]: terms are vector in the space of contexts (usually, also terms).&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* Is still easy&lt;br /&gt;
* Allows to find semantically similar words&lt;br /&gt;
* Very loved by scientific community&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* Word order is lost&lt;br /&gt;
* Need some additional hacks to use bigrams and ngrams as terms&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Word similarity detection, clustering, classification&lt;br /&gt;
* Automatic thesaurus generation&lt;br /&gt;
* Word sense disambiguation&lt;br /&gt;
* Context-sensitive spelling correction&lt;br /&gt;
* Textual advertising&lt;br /&gt;
&lt;br /&gt;
=== Language Model [Ponte, Croft, 1998] ===&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Unigram model: p(t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t  &amp;lt;small&amp;gt;&amp;lt;small&amp;gt;  3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
Bigram model: p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; ) = p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |BOS)p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 1 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; |t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 2 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )p(EOS|t &amp;lt;small&amp;gt;&amp;lt;small&amp;gt; 3 &amp;lt;/small&amp;gt;&amp;lt;/small&amp;gt; )&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 1.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Language Model [Ponte, Croft, 1998]: a probability distribution over sequences of words.&lt;br /&gt;
&lt;br /&gt;
Pro:&lt;br /&gt;
* The word order is not lost&lt;br /&gt;
* Makes Markov chain theory applicable&lt;br /&gt;
&lt;br /&gt;
Contra:&lt;br /&gt;
* The problem of unseen words&lt;br /&gt;
* How to choose n?&lt;br /&gt;
* Long relations between words or sentences (for example, anaphora) are lost&lt;br /&gt;
&lt;br /&gt;
Applications:&lt;br /&gt;
* Information retrieval&lt;br /&gt;
* Text generation&lt;br /&gt;
* Abstractive summarization&lt;br /&gt;
* Speech recognition&lt;br /&gt;
* Speech generation&lt;br /&gt;
&lt;br /&gt;
To sum up:&lt;br /&gt;
&lt;br /&gt;
* VSM-like models: no word order, algebraic structures, classification of any kind, stemming and lemmatization for dimension reduction&lt;br /&gt;
&lt;br /&gt;
* LM-like models: partially word order, Markov chains, generation of text and speech&lt;br /&gt;
&lt;br /&gt;
* What if new word appears? What if there is a typo? What if stemming is not always correct? Use edit distance on words or stems or use symbol ngrams instead as terms or ...&lt;br /&gt;
&lt;br /&gt;
== Suffix tree ==&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree (AST) ===&lt;br /&gt;
&lt;br /&gt;
The suffix tree is a data structure used for storing of and searching for strings of characters and their fragments.&lt;br /&gt;
&lt;br /&gt;
Suffix trees in NLP:&lt;br /&gt;
&lt;br /&gt;
* Text clustering [Zamir, Etzioni,1998]&lt;br /&gt;
* Language model for MT [Kennington et al., 2012] and IR [Huang, Powers, 2008]&lt;br /&gt;
* Feature generation for text classification [Zhang, Lee, 2006]&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 2.jpg|Suffix tree: Example from [Gus�led, 1998]]]&lt;br /&gt;
&lt;br /&gt;
== Annotated suffix tree ==&lt;br /&gt;
&lt;br /&gt;
Annotated suffix tree (AST) [Pampapathi, Mirkin, Levene, 2006]:&lt;br /&gt;
&lt;br /&gt;
An annotated suffix tree is a data structure used for computing and storing all fragments of the text and their frequencies. It is a rooted tree in which: &lt;br /&gt;
* Every node corresponds to one character&lt;br /&gt;
* Every node is labeled by the frequency of the text fragment encoded by the path from the root to the node.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 3.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree construction ===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MINING&amp;quot; has 6 suffixes: &amp;quot;MINING&amp;quot;, &amp;quot;INING&amp;quot;, &amp;quot;NING&amp;quot;, &amp;quot;ING&amp;quot;, &amp;quot;NG&amp;quot;, &amp;quot;G&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Naive algorithm for AST construction&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Start with &amp;quot;MINING&amp;quot;, add it as a chain of nodes with frequencies equal to unity. Add &amp;quot;INING&amp;quot; and &amp;quot;NING&amp;quot; the same way.&lt;br /&gt;
* When adding &amp;quot;ING&amp;quot;, note that there is already a path from root that encodes / reads &amp;quot;I N&amp;quot;. Increase the frequencies in this path by 1. Add  &amp;quot;G&amp;quot; to the end of the path. When adding &amp;quot;NG&amp;quot;, note &amp;quot;G&amp;quot; and react in the same way.&lt;br /&gt;
* Add &amp;quot;G&amp;quot; as a single node with frequency equal to unity.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 4.jpg]]&lt;br /&gt;
&lt;br /&gt;
Using Naive algorithm we add the second string &amp;quot;DINING&amp;quot;. Complexity: both O(n^2) time and space, where n is the number of input strings. Frequency of the root node is the sum of the first level node frequencies.&lt;br /&gt;
&lt;br /&gt;
=== Annotated suffix tree scoring ===&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 5.jpg|слева]]&lt;br /&gt;
[[Файл:L8 6.jpg|слева]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Applications of AST ===&lt;br /&gt;
&lt;br /&gt;
* Spam filtering [Pampapathi, Mirkin, Levene, 2006]&lt;br /&gt;
* Text categorization and clustering [Chernyak, Chugunova, Mirkin, 2010]&lt;br /&gt;
* Text summarization [Yakovlev, Chernyak, 2014]&lt;br /&gt;
* Taxonomy refinement [Chernyak, Mirkin, 2013]&lt;br /&gt;
* German compound splitting [Provatorova, Chernyak, 201x]&lt;br /&gt;
* AST as a string kernel [Dubov, 201x]&lt;br /&gt;
* Reference graph construction [Dubov, Chernyak, Mirkin, 201x]&lt;br /&gt;
* Profound filtering&lt;br /&gt;
* Duplicate detection&lt;br /&gt;
&lt;br /&gt;
== Spam filtering ==&lt;br /&gt;
&lt;br /&gt;
# Construct two huge ASTs: spam AST and ham AST&lt;br /&gt;
# Introduce match permutation (swaping symbols in the match) to SCORE&lt;br /&gt;
# Test versus Naive Bayes classifier on a standart datasets (The Ling-Spam corpus, Spam Assassin public corpus, The BBKSpam04 corpus)&lt;br /&gt;
# Beat it (in terms of spam precision and spam recall)!&lt;br /&gt;
&lt;br /&gt;
== Unsupervised text categorization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: 5k+ abstracts from ACM journal and ACM CCS (English). Every abstract is annotated with some of the ACM CCS topics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: 100k+ web page description from Yandex Categories (YaCa) and Yandex Categories (Russian). Every description belongs to a YaCa categories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: We know right answers! We try to reproduce them computationally. Pure scientific joy. No business applications.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Task&#039;&#039;&#039;: different models of text collection representation, relevance measures and AST &#039;&#039;scoring&#039;&#039; &amp;amp;rArr; &#039;&#039;relevance()&#039;&#039; Score relevance(taxonomy topic) and &#039;&#039;relevance(YaCa category)&#039;&#039; to abstracts and descriptions. Score the taxonomy topics and YaCa categories in descending order. Calculate how many right answers are there. Use &#039;&#039;nDCG&#039;&#039; and &#039;&#039;MAP&#039;&#039; to evaluate the &#039;&#039;&#039;quality&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Text summarization ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TextRank&#039;&#039;&#039; is an efficient algorithm for extractive text summarization. Let us construct graph, where nodes stand for single sentences and edges connect sequential sentences. Than we can use the VSM and cosine similarity to compute the similarity between sentences and run PageRank&lt;br /&gt;
to get the most important sentences. Let us replace the cosine similarity with scoring common AST.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;common AST&#039;&#039;&#039; of two ASTs is a tree, that consists of all chains of nodes that coincide in the ASTs. The frequencies are computed as average. Scoring the common AST (i.e.scoring all the paths in the tree according to &#039;&#039;SCORE&#039;&#039;) suits as sentence similarity measure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 1&#039;&#039;&#039;: DUC 2004 (a text collection for text summarization)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input 2&#039;&#039;&#039;: home made collection of gazeta.ru papers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Quality measures&#039;&#039;&#039;: precision&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 7.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Taxonomy refinement ==&lt;br /&gt;
&lt;br /&gt;
No taxonomy of mathematics in Russian! Let us construct one.&lt;br /&gt;
Still we have something in educational standards. We can use Wikipedia to refine it.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 8.jpg|слева]]&lt;br /&gt;
[[Файл:L8 9.jpg|слева]]&lt;br /&gt;
[[Файл:L8 10.jpg|слева|The refining scheme. Initial taxonomy topics are in rectangles, the Wikipedia categories and subcategories are in rounded rectangles, the Wikipedia articles are in the ovals, and the leaf descriptors are in the clouds.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
# Specify the domain of taxonomy to be refined and set the frame of taxonomy manually.&lt;br /&gt;
# Download, from the Wikipedia, the category tree and articles from the domain under consideration.&lt;br /&gt;
# Clean the category subtree of irrelevant articles.&lt;br /&gt;
# Clean the category subtree of irrelevant subcategories.&lt;br /&gt;
# Assign the remaining Wikipedia categories to the taxonomy topics.&lt;br /&gt;
# Form the intermediate layers of the taxonomy&lt;br /&gt;
# Use Wikipedia articles in each of the added category nodes as its leaves.&lt;br /&gt;
# Extract relevant keywords from Wikipedia articles and use them as leaf descriptors.&lt;br /&gt;
&lt;br /&gt;
[[Файл:L8 11.jpg|слева]]&lt;br /&gt;
[[Файл:L8 12.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
[[Файл:L8 13.jpg|слева|The fragment of refined PTMS taxonomy. Lower layers are shown.]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== German compound splitting ==&lt;br /&gt;
&lt;br /&gt;
Liebeskummer — heart-sickness —  Lieb-es-kumm-er&lt;br /&gt;
Bilderrahmen —  picture frame —  Bild-er-rahm-en&lt;br /&gt;
Schmerzensgeld —  compensation —  Schmerz-ens-geld&lt;br /&gt;
Gedankenfreiheit —  freedom of thought —  Gedank-en-frei-heit&lt;br /&gt;
Schweineeisch —  pork —  Schwein-e-eisch&lt;br /&gt;
Trinkgeld —  tip —  Trink-geld&lt;br /&gt;
&lt;br /&gt;
To split a compound:&lt;br /&gt;
* write complex linguistics rules&lt;br /&gt;
* use machine learning algorithms&lt;br /&gt;
* (hypothesis) construct an AST from a list of simple words, than score compounds to this tree&lt;br /&gt;
&lt;br /&gt;
It is a problem to find a list of German words that does not contain compounds.&lt;br /&gt;
&lt;br /&gt;
== Reference graph ==&lt;br /&gt;
&lt;br /&gt;
== Profound filtering ==&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
	<entry>
		<id>https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L8_14.jpg&amp;diff=17031</id>
		<title>Файл:L8 14.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.cs.hse.ru/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:L8_14.jpg&amp;diff=17031"/>
		<updated>2015-08-31T21:11:03Z</updated>

		<summary type="html">&lt;p&gt;Polidson: NLP: L8&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;NLP: L8&lt;/div&gt;</summary>
		<author><name>Polidson</name></author>
	</entry>
</feed>