You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
['negative']
['positive']
['positive']
["It's amazing that this no talent actor Chapa got all these well known stars to appear in this dismal, pathetic, cheesy and overlong film about a low life gangster who looks white but is half Mexican, much of the acting is bad and many of the well known stars in this trashy movie are given a script that seems made up by a 16 year old, i'm sure this movie is the career low point for actors such as Dunaway, Wagner, Keach, Tilly and Busey who i'm sure are very embarrassed that they ever appeared in this turkey of a film. I doubt many people have ever heard of Chapa and after this terrible movie i'm sure he will disappear into oblivion where he belongs."]
['I think this is a great, classic monster film for the family. The mole, what a machine! The tall creature with the beak, the flying green lizards, Ranthorincus/mayas or whatever they are and the ape men things the speak telepathically with them. The battle of the men in rubber suits fighting for a doll for breakfast umm! yummy! Class, what else can I say? How would they make a 2002 remake of this one?']
["I saw this film over Christmas, and what a great film it was! It tells the story of Custer (played by Errol Flynn) during and after his graduation from Westpoint. Although I've heard that the film isn't very historically accurate (Hollywood never is) I still enjoyed it as I knew little of the real events anyway.<br /><br />I thought Errol Flynn was brilliant as Custer and has since become my favourite actor! His acting alongside Olivia De Havilland was brilliant and the ending was fantastic! It brought me close to tears as he and Ned Sharp (Arthur Kennedy) rode to their deaths on little big horn.<br /><br />I had always known that Errol Flynn was a brilliant actor as he was my dads favourite actor, and I grew up watching his films as a child. But it wasn't until I watched this film that I realised how great he actually was.<br /><br />I'll give this film 10 out of 10!!"]
# first one - very negative# second one: very positive# third one: good but not very complimentary
Fine Tuning
Initial Run on MLP
!pipinstallcontractions
!pipinstallunidecode
!pipinstallword2numberimportpandasaspdimportnumpyasnpimportsklearnfromsklearn.model_selectionimporttrain_test_split#for bag of wordsfromsklearn.feature_extraction.textimportCountVectorizer#these are all for preprocessingimportnltkfromnltk.tokenizeimportword_tokenizeimportrefrombs4importBeautifulSoupimportspacyimportunidecodefromword2numberimportw2nimportcontractionsfromnltk.corpusimportstopwordsfromnltk.stemimportWordNetLemmatizer# this is required for word_tokenizenltk.download('punkt')
nltk.download('stopwords')
nltk.download('wordnet')
Requirement already satisfied: contractions in /usr/local/lib/python3.7/dist-packages (0.0.52)
Requirement already satisfied: textsearch>=0.0.21 in /usr/local/lib/python3.7/dist-packages (from contractions) (0.0.21)
Requirement already satisfied: anyascii in /usr/local/lib/python3.7/dist-packages (from textsearch>=0.0.21->contractions) (0.2.0)
Requirement already satisfied: pyahocorasick in /usr/local/lib/python3.7/dist-packages (from textsearch>=0.0.21->contractions) (1.4.2)
Requirement already satisfied: unidecode in /usr/local/lib/python3.7/dist-packages (1.2.0)
Requirement already satisfied: word2number in /usr/local/lib/python3.7/dist-packages (1.1)
[nltk_data] Downloading package punkt to /root/nltk_data...
[nltk_data] Package punkt is already up-to-date!
[nltk_data] Downloading package stopwords to /root/nltk_data...
[nltk_data] Package stopwords is already up-to-date!
[nltk_data] Downloading package wordnet to /root/nltk_data...
[nltk_data] Package wordnet is already up-to-date!
True
defremove_all_non_alphabetic(text):
returnre.sub('[^A-Za-z]',' ',text)
defstrip_html_tags(text):
"""remove html tags from text"""soup=BeautifulSoup(text, "html.parser")
stripped_text=soup.get_text(separator=" ")
returnstripped_textdefremove_accented_chars(text):
"""remove accented characters from text, e.g. café"""text=unidecode.unidecode(text)
returntextstop_words=set(stopwords.words('english'))
defremove_stop_words(token):
return [itemforitemintokenifitemnotinstop_words]
lemma=WordNetLemmatizer()
deflemmatization(token):
return [lemma.lemmatize(word=w,pos='v') forwintoken]
defclean_length(token):
return [itemforitemintokeniflen(item)>2]
defpunctuation_removal(text):
returnre.sub(r'[\.\?\!\,\:\;\"]', '', text)
deftext_merge(token):
return' '.join([iforiintokenifnoti.isdigit()])