theirAlgorithm.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:nlpSentiment 作者: ClimbsRocks 项目源码 文件源码
def loadDataset(fileName):
    with open(fileName, 'rU') as trainingInput:
        # detect the "dialect" of this type of csv file
        try:
            dialect = csv.Sniffer().sniff(trainingInput.read(1024))
        except:
            # if we fail to detect the dialect, defautl to Microsoft Excel
            dialect = 'excel'
        trainingInput.seek(0)
        trainingRows = csv.reader(trainingInput, dialect)

        allTweets = []
        allTweetSentiments = []
        entireDataset = []
        for row in trainingRows:
            # csv only gives us an iterable, not the data itself
            entireDataset.append(row)

    return entireDataset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号