This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Format | Size | |
|---|---|---|
| CSV | 38 | |
| JSON | 299.9 | |
| ORC | 17.5 | |
| Parquet | 2.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import pandas as pd | |
| data_path = os.getcwd() + "/data/instagram_comments/" | |
| dfs = [] | |
| for file in files: | |
| current_df = pd.read_csv(data_path + file) | |
| dfs.append(current_df) | |
| final_df = pd.concat(dfs) | |
| final_selected_df = final_df[['Unnamed: 1','Likes','Comment','Profile URL','Comment URL']] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scrapy | |
| class PensadorSpider(scrapy.Spider): | |
| name = "pensador" | |
| allowed_domains = ["www.pensador.com"] | |
| start_urls = ["https://www.pensador.com/autor/machado_de_assis/"] | |
| def parse(self, response): | |
| author = response.xpath("//*[@id='content']/div[1]/h1/text()").get() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scrapy | |
| class PensadorCrawlerItem(scrapy.Item): | |
| author = scrapy.Field() | |
| sentence = scrapy.Field() | |
| book_title = scrapy.Field() | |
| share_amount = scrapy.Field() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scrapy | |
| from items import PensadorCrawlerItem | |
| class PensadorSpider(scrapy.Spider): | |
| name = "pensador" | |
| allowed_domains = ["www.pensador.com"] | |
| start_urls = ["https://www.pensador.com/autor/machado_de_assis/"] | |
| def parse(self, response): | |
| pensador_item = PensadorCrawlerItem() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from itemadapter import ItemAdapter | |
| class PensadorCrawlerPipeline: | |
| def process_item(self, item, spider): | |
| return item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Method | Accuracy | |
|---|---|---|
| Gaussian | 0.725232511120097 | |
| Multinomial | 0.76081682167408 | |
| Bernoulli | 0.7267488879902951 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| imdb_df['text_pt'] = imdb_df['text_pt'].str.lower() | |
| instagram_df['comment'] = instagram_df['comment'].str.lower() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| imdb_df['classification']= imdb_df['sentiment'].replace(["neg","pos"],[0,1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import emoji | |
| comment_demojize = [] | |
| for i in range(len(instagram_df)): | |
| if type(instagram_df['comment'][i]) is str: | |
| comment_demojize.append(emoji.demojize(instagram_df['comment'][i], language='pt').replace("::", " ").replace(":", "").replace("_", " ")) | |
| else: | |
| comment_demojize.append(instagram_df['comment'][i]) | |
| instagram_df['comment'] = comment_demojize |
OlderNewer