Git Product home page Git Product logo

20newsgroups-parser's Introduction

20newsgroup-parser

Simple tool for parsing the contents of the 20_newsgroups.tar.gz archive. I've built it since I couldn't find such software for Java.

Consider an example document:

Newsgroups: sci.med
Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!spdcc!dyer
From: [email protected] (Steve Dyer)
Subject: Re: food-related seizures?
Message-ID: <[email protected]>
Organization: S.P. Dyer Computer Consulting, Cambridge MA
References: <[email protected]> <[email protected]> <[email protected]>
Date: Mon, 19 Apr 1993 20:44:10 GMT

My comments about the Feingold Diet have no relevance to your
daughter's purported FrostedFlakes-related seizures.  I can't imagine
why you included it.

--
Steve Dyer
[email protected] aka {ima,harvard,rayssd,linus,m2c}!spdcc!dyer

To parse it, just instantiate a NewsgroupParser passing the path to the uncompressed tarball, and call the parse() method on the parser. After the files have been parsed, you can access them via getArticles(). This gives a key-value collection, with newsgroups labels as keys, and the lists of parsed articles as values. Every article consists of the text and the key-value collection of headers.

NewsgroupParser parser = new NewsgroupParser("20_newsgroups");
parser.parse();

parser.getArticles().forEach((key, articles) -> {
    System.out.println(key);
    System.out.println(articles.size());
});

20newsgroups-parser's People

Contributors

wojtuch avatar

Stargazers

Rajani Maski 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.