I am also a newbie to NLP. My tutor gave us the learning materials for getting started. It is a free Chinese Version translated by Chinese fans of Natural Language Processing with Python. In the Chinese version, it is inevitable that there will be some minor errors. Most of them can be corrected after careful study.
A small code error was found here for your sharing.
In section 11.3 "special considerations when dealing with endangered languages" in data collection, there is a code that standardizes the alphabetic order of consonants. This code is not hard to understand. However, in Chinese translation, typographical errors may occur due to the carelessness of the typographical staff.
In the Chinese version, this code is as follows:
>>>mappings= [(, ), (, ), (, ), (, , ), (r, r>>> patt,repl == re.findall( .join(char piecein pieces charin sorted(piece))[:8>>>signature(>>>signature(>>>signature(
Follow pieces = re. findall... In this line, it is found that a has an extra ^ symbol on it, which is incorrect here.
The Code should be written as pieces = re. findall ('[^ aeiou] +', word). readers who have learned Regular Expressions and read this section should know why this change is necessary.
The complete code is as follows:
>>> mappings = [(, ), (, ), (, ), (, , ), (r, r>>> patt, repl == re.findall( .join(char piece pieces char sorted(piece))[:8>>> signature(>>> signature(>>> signature(
Thanks again for the help of the author!