GithubHelp home page GithubHelp logo

nlp-dataloader's Introduction

Congressional Tweet DataLoader

This program can read and load large Congressional Tweet dataset. It will read and load their text and their corresponding party.

Description

  • DatasetReader: Used to read data from files and create Instances
  • DataLoader: Used to piece together several Instances of data into several Batches for training

Construct DatasetReader

  1. The _read method, where the input is the path to the file you want to read, keeps yielding Instance data
  2. text_to_instance, called in the _read method, the goal is to create Instance data based on the text data obtained from _read
  3. TweetReader can set max_instances to specify the maximum number of instances to be retrieved from the data

Construct DatasetLoader

After constructed Datasetreader, we can use AllenNLP build-in function to construct dataloader. However, before we transfer data into batches, we need to convert a series of tokens recorded in the TextField of the Instance to the corresponding idx.

  1. We need to iterate through all Instances to build the vocabulary.
  2. Using the dictionary, encode the contents of each Field of each Instance.
    • For TextField: we need to convert each Token into its corresponding idx using indexer
    • For LabelField: we need to number the labels with the vocabulary
    • For SequenceLabelField, we need to number each content of labels

Executing program

python dataloader.py

Acknowledgments

Inspiration, code snippets, etc.

nlp-dataloader's People

Contributors

michaelxzh avatar

Watchers

 avatar

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.