/
unigram,_biagram_and_trigram_code_.py
25 lines (20 loc) · 1.71 KB
/
unigram,_biagram_and_trigram_code_.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
"""Unigram, Biagram And Trigram Code .ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1fz3ji7JokGo0IDMD78uL4FBfQWh8-Wzg
"""
import nltk as nlp
#nlp.download()
paragrapha = """"
Machine learning is a form of AI that enables a system to learn from data rather than through explicit programming.
However, machine learning is not a simple process.
As the algorithms ingest training data, it is then possible to produce more precise models based on that data.
A machine-learning model is the output generated when you train your machine-learning algorithm with data. After training, when you provide a model with an input, you will be given an output. For example, a predictive algorithm will create a predictive model. Then, when you provide the predictive model with data, you will receive a prediction based on the data that trained the model.
illustration of robot solving puzzle Iterative learning Machine learning enables models to train on data sets before being deployed. Some machine- learning models are online and continuous. This iterative process of online models leads to an improvement in the types of associations made between data elements. Due to their complexity and size, these patterns and associations could have easily been overlooked by human observation. After a model has been trained, it can be used in real time to learn from data. The improvements in accuracy are a result of the training process and automation that are part of machine learning.
"""
sentence = nlp.sent_tokenize(paragrapha)
word = nlp.word_tokenize(paragrapha)
print(list(nlp.bigrams(word)))
print(list(nlp.trigrams(word)))
#print(sentence)