GithubHelp home page GithubHelp logo

email-parser's Introduction

email-parser JetBrains team project

This simple library provides ability to separate the quotation from the useful content in email messages. The main purpose of this library is to process as much different quotation formats as possible. It is also independent from the language used in email.

Efficiency estimation we have got during testing: > 97.5 % correctly processed emails.

For now it works only with text/plain Content-Type. Other content-types may be added later (you are welcome to make a pull request).

Usage

You can download library sources and add them into your project.

To run in the console

Clone project via git and change directory to email-parser.

Process .eml file:

Enter gradlew runProcessing -PemlFile="path" in the console, where path is path to eml file.

Output format
Header of the quotation is in uppercase.
Quotation is marked with '>' symbol beginning with the first line of the header of the quotation till the end of the message.
Working time is also provided.

Tests:

Enter gradlew test in the console.

Documentation

To get documentation in dokka format enter gradlew dokka in the console. Then run build/dokka/email-parser/index.html

To get documentation in Javadoc format enter gradlew dokkaJavadoc in the console. Then run build/javadoc/index.html

Description

The main package of the library is quoteParser. Its main class is QuoteParser.

To use parser call quoteParserObj.parse() method. This method will return Content object with a separate body, header of the quote if exists and quotation itself if exists.

For more information, read the documentation.

Examples

Simple usage example:

val content = QuoteParser.Builder()
        .build()
        .parse(file)

You also can parse list of strings and customize parser parameters via different builder methods:

val content = QuoteParser.Builder()
        .deleteQuoteMarks(true)
        .recursive(false)
        .build()
        .parse(emlText.lines())

Kotlin-style builder is also supported:

val content = QuoteParser.Builder()
        .build {
            deleteQuoteMarks = true
            recursive = false
        }.parse(emlText.lines())

Complete code of the examples is placed here.

email-parser's People

Contributors

mariyadavydova avatar ppzhuk avatar sergeyzh avatar

Watchers

 avatar  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.