User:Bohye Woo/nltk-Terms of Service

From XPUB & Lens-Based wiki

Virtual Environment

1. To create a virtual environment=

cd to the place you want to make it and...

    python3 -m venv venv

2. To activate a virtual environment

cd to the folder where "venv" is and...

    source venb/bin/activate

NLTK

Tokenize

>>> import nltk
>>> text = "If you choose to login to the Services via a third-party platform or social media network, you will need to use your credentials."
>>> token = nltk.word_tokenize(text)
>>> token
['If', 'you', 'choose', 'to', 'login', 'to', 'the', 'Services', 'via', 'a', 'third-party', 'platform', 'or', 'social', 'media', 'network', ',', 'you', 'will', 'need', 'to', 'use', 'your', 'credentials', '.']

sort

>>> token.sort()
>>> token
[',', '.', 'If', 'Services', 'a', 'choose', 'credentials', 'login', 'media', 'need', 'network', 'or', 'platform', 'social', 'the', 'third-party', 'to', 'to', 'to', 'use', 'via', 'will', 'you', 'you', 'your']

collections

>>> import collections
>>> collections.Counter(token)
Counter({'to': 3, 'you': 2, ',': 1, '.': 1, 'If': 1, 'Services': 1, 'a': 1, 'choose': 1, 'credentials': 1, 'login': 1, 'media': 1, 'need': 1, 'network': 1, 'or': 1, 'platform': 1, 'social': 1, 'the': 1, 'third-party': 1, 'use': 1, 'via': 1, 'will': 1, 'your': 1})


Concordance

nltk.download("stopwords")

file=open('faceapp.txt','r')
raw=file.read()
tokens = nltk.word_tokenize(raw)
faceapp = nltk.Text(tokens)

faceapp.concordance('services')
//////resrult///////
Displaying 11 of 11 matches:
t about FaceApp or our products or Services ( collectively ,  Feedback  ) , 
e operation and maintenance of the Services and/or FaceApp  s business . - If
 . - If you choose to login to the Services via a third-party platform or soci
connection with your account . Our Services may allow you and other users to c
nt that you post on or through the Services . You grant FaceApp a nonexclusive
ent solely to provide you with the Services . You acknowledge that some of the
. You acknowledge that some of the Services are supported by advertising reven
 advertising and promotions on the Services or on , about , or in conjunction 
at we may not always identify paid services , sponsored content , or commercia
 modified by you on or through the Services in accordance with the rights and 
tent you stylize on or through the Services ; and ( iii ) you have the legal r