NLP随手笔记

Wayne posted @ Mon, 19 Mar 2012 14:56:07 +0000 in Notes , 3415 readers

虽然说记笔记应该有更好的方式,不过懒得折腾了。先在这随便记下吧。

 

Lemma, Wordform  : 一句话中的WORD可以用两种不同的标准来区分。一种是Lemma,一种是wordform。 wordform就是词的形状,而lemma则是词意。比如 am   is  are ,都是一个lemma,但是3个wordform。

Type, Token :倘若以wordform的形式来界定一个词,那么一句话中WORD的数目还可以用两种不同的标准来区分。Type是相同的词都算一个,Token是每个词出现几次都算。所以 "no no no .... it is not possible" 这样的一句话,Type 有5个,Token 有7个。

token常用N来表示,(number of tokens), type 常用V来表示,(|V| 就是 size of vocabulary),Church and Gale 1990年有个统计公式  |V| > O(N 1/2)

这里它还展示了一个 Tokenization, 统计莎士比亚作品中的Token数。 tr 这个命令看上去不错,虽然 依云 说给出的指令组合比较低效,不如awk版的。但是我问他awk版的长什么样,他让我自己去翻wiki……

(note: 翻了下wiki,在词频统计这里,发现了Awk的方法:

 

BEGIN {
    FS="[^a-zA-Z]+"
}
{
     for (i=1; i<=NF; i++)
          words[tolower($i)]++
}
END {
    for (i in words)
         print i, words[i]
}

  这个可能效率上会快些,不过我也没实际time过。但是思路上完全就是两个不同的方向,更类似于专门来解决一个词频统计问题,而不是在遇到一堆文字时顺手所做。tr 的这个结合了管道和多钟工具的方法在思路上就自然多了 )

 

简单的通过正则匹配的 Tokenization 方式 还存在很多问题,比如一些词不好切分,一些词中间带了杂七杂八的符号但却又是同一个。更不用说中文分词这个东西了。 关于中文分词,这边认为,使用Greedy的方式来匹配很有效,不过同样的方法对英文又不适用。

 

Normalization,就是把各种形状的词,按意义统一起来。实际上就是找Lemma。或者说,Lemmatization是一个很好的Normalization的方法。把am is are 都转换成be,那自然就normal了。具体Lemmatization的方法很复杂,不过也有些可以解决部分问题的手段。比如说对于那些一个主干加了不同前缀后缀的词,就可以去掉前后缀,抓住主干。主干叫Stem,各种缀叫Affix。对于英文,有个Porter's algorithm 用于处理各种Affix。可惜这个办法没有任何通用性,而且容易找到例外。

 

Sentence Segmentation, 就是断句。这里讲了一些常用的断句方法,不过我觉得只适用于严肃的英文文本中。它主要基于标点和大小写来判断。通过“决策树”的方式。 决策树是一堆嵌套的if ... else, 这个目测就知道效率不会高。所以实际中也会用到不少其他方法。决策树的效果直接取决于判断条件,也就是features,这里需要记住几个看上去比较有技术含量的Numeric features:

 Length of word with "."

 Probability(word with "." occurs at end-of-s)

 Probability(word after "." occurs at beginning-of-s)

How to Change Mobile said:
Mon, 14 Nov 2022 05:08:06 +0000

Aadhaar card is a unique card that holds all the biometric information of an individual. The Unique Identification Authority of India issues the card to all Indian citizens. The 12-digit card works as an identification and address proof. How to Change Mobile Number in Aadhar Card without otp The card is used by banks, telecom companies, the public distribution system, and the income tax department as an identity verification card.

apple carplay ne fon said:
Mon, 17 Jul 2023 15:39:08 +0000

Lorsque l’utilisation de votre téléphone pendant la conduite est restreinte dans de nombreux pays pour des raisons de sécurité claires, Apple a créé CarPlay, qui peut acheminer les applications et les médias vers le système de navigation de votre voiture, apple carplay ne fonctionne pas ce qui facilite l’accès aux applications mains libres. Les iPhones commencent rapidement à charger, cependant, Carplay ne fonctionne pas, ce qui est un problème assez courant.

pourquoi apple carpl said:
Mon, 17 Jul 2023 15:52:52 +0000

Lorsque l’utilisation de votre téléphone pendant la conduite est restreinte dans de nombreux pays pour des raisons de sécurité claires, Apple a créé CarPlay, qui peut acheminer les applications et les médias vers le système de navigation de votre voiture, pourquoi apple carplay ne fonctionne pas ce qui facilite l’accès aux applications mains libres. Les iPhones commencent rapidement à charger, cependant, Carplay ne fonctionne pas, ce qui est un problème assez courant.

CBSE 7th Class Syll said:
Sat, 02 Sep 2023 10:27:29 +0000

NCERT new Syllabus 2024 for Class 7 Contains Complete Information about Curriculum, course Structure Exam Pattern etc. The information Available in CBSE Class 7th new Syllabus 2024 is important for the Preparation CBSE 7th Class Syllabus 2024 of CBSE Class 7th Board Exams 2024.NCERT 7th New Revised Syllabus 2024 Chapter Wise Pdf Download.Online Service Covers All Subjects Published by NCERT Syllabus 2024 for Standard VII in Hindi, English and Urdu medium Chapter Wise Pdf Format, our Website Providing the latest NCERT 7th Syllabus 2024 for all Important Subjects.


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter