Git Product home page Git Product logo

advicebot's Introduction

AdviceBot

Chatbot which gives general advice using a sequence to sequence deep learning model

advicebot's People

Contributors

gladisor avatar drowsydame3000 avatar

Watchers

James Cloos avatar  avatar

advicebot's Issues

Create function which gets comments from post

Create function in utils.py

Use pushshift api to get all comments from a list of post ids.

First get comment ids from a post
/reddit/submission/comment_ids/{base36-submission-id}

Then get comments from comment ids
/reddit/search/comment/

Inputs:

  • List of post ids

Returns:

  • List of lists of comments

Need to select criteria for helpful comments on training data

We need to create a way of telling if a post contains helpful comments.

Function which takes as input a post from pushshift api and reconstructs comment chain. Then returns all useful comments.
Write function in utils.py

Ideas:

  • Commenter karma / status on r/Advice
  • Upvote ratio of comment

All ideas must be searchable in the pushshift post.

Error getting comments from pushshift.

Getting this error when requesting larger numbers of posts / comments from pushshift. Not sure why. It works for requesting 5 posts. Try running test.py.

Traceback (most recent call last):
File "C:\Users\123tr\Desktop\AdviceBot\test.py", line 52, in
comments = list(map(get_comments, ids))
File "C:\Users\123tr\Desktop\AdviceBot\utils.py", line 69, in get_comments
return request_data(url)
File "C:\Users\123tr\Desktop\AdviceBot\utils.py", line 20, in request_data
data = json.loads(r.text)
File "C:\Users\123tr\miniconda3\envs\adv\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\123tr\miniconda3\envs\adv\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\123tr\miniconda3\envs\adv\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Create data extracting function

We need a function which pulls one days worth of data from pushshift using the functions we have already defined. This function should take in a starting date and query the maximum amount of posts from this time period. It should combine a post with each comment, repeating the post for the number of comments it has. Most of this code is already in the test.py file, it just needs to be packaged into a function and placed in utils.py

Inputs:

  • Start date

Outputs:

  • Pandas dataframe with two columns: Question (from OP), Response (Comment containing advice)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.