NLTK's snowball extract stemming

Source: Internet
Author: User
Tags nltk
The most important application scenario in machine learning is the automatic classification of machines, and the key to classification is stemming. So we're going to use the snowball. Here's a look at two ways to extract stems from snowball.

Two methods:

Method One:

>>> from NLTK import Snowballstemmer
>>> Snowballstemmer.languages # See which languages is supported
(' Danish ', ' Dutch ', ' 中文版 ', ' Finnish ', ' French ', ' German ', ' Hungarian ',
' Italian ', ' Norwegian ', ' Porter ', ' Portuguese ', ' Romanian ',
' Russian ', ' Spanish ', ' Swedish ')
>>> stemmer = Snowballstemmer ("German") # Choose a language
>>> stemmer.stem (U "Autobahnen") # Stem a word
U ' Autobahn '
But when you know the language scene you are using, you can call it directly using the following method:
Method Two:
>>> PS = Nltk.stem.snowball.PortugueseStemmer ()
>>> ps.stem (' Celular ')
U ' Celul '
>>> ps.stem (' Celular ')
U ' Celul '

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.