Comments (1)
I've also encountered an issue in the treebank.py
script within the B2WSentiment class, particularly related to file path handling and CSV reading. The original code snippet is as follows:
class B2WSentiment:
def __init__(self, path=None, tablesize=1000000):
if not path:
path = "data/B2W-Reviews01.csv"
self.path = path
self.df = pd.read_csv(path, nrows=15000, sep=';')[[
"review_text", "overall_rating"
]].drop_duplicates(subset=['review_text'])
self.tablesize = tablesize
While this works well in certain environments (like linux), it wasnt working on windows, throwing erros about the
overall_rating` column (that doesn't exist) and also the file name that changed. To enhance portability and ensure more consistent behavior across different operating systems, I propose the following modifications:
class B2WSentiment:
def __init__(self, path=None, tablesize=1000000):
if not path:
path = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'data/b2w.csv'))
self.path = path
self.df = pd.read_csv(path, nrows=15000, sep=',', quotechar='"')[[
"review_text", "rating"
]].drop_duplicates(subset=['review_text'])
self.tablesize = tablesize
@alan-barzilay , could you please review these changes? Your insights would be greatly appreciated to ensure the best practices and optimal functionality!
from nlportugues.
Related Issues (7)
- [Semana 05] Notebook quebra com a versão do tensorflow >= 2.3.0
- image lint report - consertar no site alguma hora
- Curso Processamento Neural de Linguagem Natural em Português I (Coursera) HOT 23
- errata video Modulo 1 - Problemas I
- Problemas com o 'vetores_de_palavras.png' HOT 7
- Instrucoes para re-submissao da entrega semana 4 (word2vec)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nlportugues.