lp_email_reply_parser 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/LICENSE +22 -0
  2. data/README.md +68 -0
  3. data/Rakefile +135 -0
  4. data/lib/email_reply_parser.rb +448 -0
  5. data/lp_email_reply_parser.gemspec +77 -0
  6. data/test/email_reply_parser_test.rb +431 -0
  7. data/test/emails/correct_sig.txt +4 -0
  8. data/test/emails/email_1_1.txt +13 -0
  9. data/test/emails/email_1_2.txt +51 -0
  10. data/test/emails/email_1_3.txt +55 -0
  11. data/test/emails/email_1_4.txt +5 -0
  12. data/test/emails/email_1_5.txt +15 -0
  13. data/test/emails/email_1_6.txt +15 -0
  14. data/test/emails/email_1_7.txt +12 -0
  15. data/test/emails/email_1_8.txt +6 -0
  16. data/test/emails/email_1_9.txt +9 -0
  17. data/test/emails/email_2_1.txt +25 -0
  18. data/test/emails/email_2_2.txt +10 -0
  19. data/test/emails/email_2_3.txt +14 -0
  20. data/test/emails/email_2_4.txt +14 -0
  21. data/test/emails/email_2_5.txt +15 -0
  22. data/test/emails/email_2_6.txt +11 -0
  23. data/test/emails/email_2_7.txt +5 -0
  24. data/test/emails/email_2_8.txt +4 -0
  25. data/test/emails/email_2_9.txt +9 -0
  26. data/test/emails/email_2nd_paragraph_starting_with_on.txt +12 -0
  27. data/test/emails/email_BlackBerry.txt +3 -0
  28. data/test/emails/email_bullets.txt +22 -0
  29. data/test/emails/email_from_address_in_quote_header.txt +12 -0
  30. data/test/emails/email_from_name_in_quote_header.txt +12 -0
  31. data/test/emails/email_hyphens.txt +5 -0
  32. data/test/emails/email_iPhone.txt +3 -0
  33. data/test/emails/email_mentions_own_email_address.txt +6 -0
  34. data/test/emails/email_mentions_own_name.txt +6 -0
  35. data/test/emails/email_multi_word_sent_from_my_mobile_device.txt +3 -0
  36. data/test/emails/email_multiline_quote_header_es_mx.txt +8 -0
  37. data/test/emails/email_multiline_quote_header_fr.txt +8 -0
  38. data/test/emails/email_multiline_quote_header_from_first.txt +11 -0
  39. data/test/emails/email_multiline_quote_header_from_replyto_date_to_subject.txt +12 -0
  40. data/test/emails/email_multiline_quote_header_from_to_date_subject.txt +11 -0
  41. data/test/emails/email_multiline_quote_header_none.txt +11 -0
  42. data/test/emails/email_multiline_quote_header_pt_br.txt +8 -0
  43. data/test/emails/email_multiline_quote_header_with_asterisks.txt +21 -0
  44. data/test/emails/email_multiline_quote_header_with_cc.txt +9 -0
  45. data/test/emails/email_multiline_quote_header_with_multiline_headers.txt +14 -0
  46. data/test/emails/email_no_signature_deliminator.txt +7 -0
  47. data/test/emails/email_no_signature_deliminator_adds_a_middle_initial.txt +7 -0
  48. data/test/emails/email_one_is_not_on.txt +10 -0
  49. data/test/emails/email_sent_from_my_not_signature.txt +3 -0
  50. data/test/emails/email_was_showing_as_nothing_visible.txt +13 -0
  51. metadata +143 -0
@@ -0,0 +1,4 @@
1
+ this is an email with a correct -- signature.
2
+
3
+ --
4
+ rick
@@ -0,0 +1,13 @@
1
+ Hi folks
2
+
3
+ What is the best way to clear a Riak bucket of all key, values after
4
+ running a test?
5
+ I am currently using the Java HTTP API.
6
+
7
+ -Abhishek Kona
8
+
9
+
10
+ _______________________________________________
11
+ riak-users mailing list
12
+ riak-users@lists.basho.com
13
+ http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
@@ -0,0 +1,51 @@
1
+ Hi,
2
+ On Tue, 2011-03-01 at 18:02 +0530, Abhishek Kona wrote:
3
+ > Hi folks
4
+ >
5
+ > What is the best way to clear a Riak bucket of all key, values after
6
+ > running a test?
7
+ > I am currently using the Java HTTP API.
8
+
9
+ You can list the keys for the bucket and call delete for each. Or if you
10
+ put the keys (and kept track of them in your test) you can delete them
11
+ one at a time (without incurring the cost of calling list first.)
12
+
13
+ Something like:
14
+
15
+ String bucket = "my_bucket";
16
+ BucketResponse bucketResponse = riakClient.listBucket(bucket);
17
+ RiakBucketInfo bucketInfo = bucketResponse.getBucketInfo();
18
+
19
+ for(String key : bucketInfo.getKeys()) {
20
+ riakClient.delete(bucket, key);
21
+ }
22
+
23
+
24
+ would do it.
25
+
26
+ See also
27
+
28
+ http://wiki.basho.com/REST-API.html#Bucket-operations
29
+
30
+ which says
31
+
32
+ "At the moment there is no straightforward way to delete an entire
33
+ Bucket. There is, however, an open ticket for the feature. To delete all
34
+ the keys in a bucket, you’ll need to delete them all individually."
35
+
36
+ >
37
+ > -Abhishek Kona
38
+ >
39
+ >
40
+ > _______________________________________________
41
+ > riak-users mailing list
42
+ > riak-users@lists.basho.com
43
+ > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
44
+
45
+
46
+
47
+
48
+ _______________________________________________
49
+ riak-users mailing list
50
+ riak-users@lists.basho.com
51
+ http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
@@ -0,0 +1,55 @@
1
+ Oh thanks.
2
+
3
+ Having the function would be great.
4
+
5
+ -Abhishek Kona
6
+
7
+ On 01/03/11 7:07 PM, Russell Brown wrote:
8
+ > Hi,
9
+ > On Tue, 2011-03-01 at 18:02 +0530, Abhishek Kona wrote:
10
+ >> Hi folks
11
+ >>
12
+ >> What is the best way to clear a Riak bucket of all key, values after
13
+ >> running a test?
14
+ >> I am currently using the Java HTTP API.
15
+ > You can list the keys for the bucket and call delete for each. Or if you
16
+ > put the keys (and kept track of them in your test) you can delete them
17
+ > one at a time (without incurring the cost of calling list first.)
18
+ >
19
+ > Something like:
20
+ >
21
+ > String bucket = "my_bucket";
22
+ > BucketResponse bucketResponse = riakClient.listBucket(bucket);
23
+ > RiakBucketInfo bucketInfo = bucketResponse.getBucketInfo();
24
+ >
25
+ > for(String key : bucketInfo.getKeys()) {
26
+ > riakClient.delete(bucket, key);
27
+ > }
28
+ >
29
+ >
30
+ > would do it.
31
+ >
32
+ > See also
33
+ >
34
+ > http://wiki.basho.com/REST-API.html#Bucket-operations
35
+ >
36
+ > which says
37
+ >
38
+ > "At the moment there is no straightforward way to delete an entire
39
+ > Bucket. There is, however, an open ticket for the feature. To delete all
40
+ > the keys in a bucket, you’ll need to delete them all individually."
41
+ >
42
+ >> -Abhishek Kona
43
+ >>
44
+ >>
45
+ >> _______________________________________________
46
+ >> riak-users mailing list
47
+ >> riak-users@lists.basho.com
48
+ >> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
49
+ >
50
+
51
+
52
+ _______________________________________________
53
+ riak-users mailing list
54
+ riak-users@lists.basho.com
55
+ http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
@@ -0,0 +1,5 @@
1
+ Awesome! I haven't had another problem with it.
2
+
3
+ On Aug 22, 2011, at 7:37 PM, defunkt<reply@reply.github.com> wrote:
4
+
5
+ > Loader seems to be working well.
@@ -0,0 +1,15 @@
1
+ One: Here's what I've got.
2
+
3
+ - This would be the first bullet point that wraps to the second line
4
+ to the next
5
+ - This is the second bullet point and it doesn't wrap
6
+ - This is the third bullet point and I'm having trouble coming up with enough
7
+ to say
8
+ - This is the fourth bullet point
9
+
10
+ Two:
11
+ - Here is another bullet point
12
+ - And another one
13
+
14
+ This is a paragraph that talks about a bunch of stuff. It goes on and on
15
+ for a while.
@@ -0,0 +1,15 @@
1
+ I get proper rendering as well.
2
+
3
+ Sent from a magnificent torch of pixels
4
+
5
+ On Dec 16, 2011, at 12:47 PM, Corey Donohoe
6
+ <reply@reply.github.com>
7
+ wrote:
8
+
9
+ > Was this caching related or fixed already? I get proper rendering here.
10
+ >
11
+ > ![](https://img.skitch.com/20111216-m9munqjsy112yqap5cjee5wr6c.jpg)
12
+ >
13
+ > ---
14
+ > Reply to this email directly or view it on GitHub:
15
+ > https://github.com/github/github/issues/2278#issuecomment-3182418
@@ -0,0 +1,12 @@
1
+ :+1:
2
+
3
+ On Tue, Sep 25, 2012 at 8:59 AM, Chris Wanstrath
4
+ <notifications@github.com>wrote:
5
+
6
+ > Steps 0-2 are in prod. Gonna let them sit for a bit then start cleaning up
7
+ > the old code with 3 & 4.
8
+ >
9
+ >
10
+ > Reply to this email directly or view it on GitHub.
11
+ >
12
+ >
@@ -0,0 +1,6 @@
1
+ Hello
2
+
3
+ 2013/1/31 Lawrence Pit <lawrence.pit@example.com>
4
+
5
+ > bailter space
6
+ > flying nun
@@ -0,0 +1,9 @@
1
+ Foo
2
+
3
+ -Abhishek Kona
4
+
5
+
6
+ _______________________________________________
7
+ riak-users mailing list
8
+ riak-users@lists.basho.com
9
+ http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
@@ -0,0 +1,25 @@
1
+ Outlook with a reply
2
+
3
+
4
+ ------------------------------
5
+
6
+ *From:* Google Apps Sync Team [mailto:mail-noreply@google.com]
7
+ *Sent:* Thursday, February 09, 2012 1:36 PM
8
+ *To:* jow@xxxx.com
9
+ *Subject:* Google Apps Sync was updated!
10
+
11
+
12
+
13
+ Dear Google Apps Sync user,
14
+
15
+ Google Apps Sync for Microsoft Outlook® was recently updated. Your computer
16
+ now has the latest version (version 2.5). This release includes bug fixes
17
+ to improve product reliability. For more information about these and other
18
+ changes, please see the help article here:
19
+
20
+ http://www.google.com/support/a/bin/answer.py?answer=153463
21
+
22
+ Sincerely,
23
+
24
+ The Google Apps Sync Team.
25
+
@@ -0,0 +1,10 @@
1
+ Outlook with a reply directly above line
2
+ ________________________________________
3
+ From: CRM Comments [crm-comment@example.com]
4
+ Sent: Friday, 23 March 2012 5:08 p.m.
5
+ To: John S. Greene
6
+ Subject: [contact:106] John Greene
7
+
8
+ A new comment has been added to the Contact named 'John Greene':
9
+
10
+ I am replying to a comment.
@@ -0,0 +1,14 @@
1
+ This one is from Windows 8 Mail (preview).
2
+
3
+ Sent from my Windows 8 PC <http://windows.microsoft.com/consumer-preview>
4
+
5
+ *From:* Lord Nelson <bignelly@theadmiralty.com>
6
+ *Sent:* Monday, August 20, 2012 5:08:34 PM
7
+ *To:* boo@example.com
8
+ *Subject:* The Royal Navy=92s Ships are like women
9
+
10
+
11
+ My dreams are haunting with visions of lithe ships dancing over the waves,
12
+ beckoning me to lie with them.
13
+
14
+ =93MAKE IT STOP!=94
@@ -0,0 +1,14 @@
1
+ Here's one from Outlook 2007.
2
+
3
+
4
+
5
+ From: bigboo@example.com [mailto:bigboo@example.com]
6
+ Sent: Monday, August 20, 2012 8:46 PM
7
+ To: lilboo@example.com
8
+ Subject: Somebody’s got the hoots
9
+
10
+
11
+
12
+ I am going to include some emoji here because, well, that's what people do.
13
+
14
+ “🐶”
@@ -0,0 +1,15 @@
1
+ One from Outlook 2013?
2
+
3
+
4
+ From: Gmail Team [mailto:gmail-noreply@google.com]
5
+ Sent: None
6
+ To: Mickey Bonk
7
+ Subject: Gmail is different. Here's what you need to know.
8
+
9
+ Didn't have the patience to wait for Outlook 2013 to sync my Gmail, but
10
+ above is a reply to a different message.
11
+
12
+ First off, welcome. And thanks for agreeing to help us test Gmail. By now
13
+ you probably know the key ways in which Gmail differs from traditional
14
+ webmail services. Searching instead of filing. A free gigabyte of storage.
15
+ Messages displayed in context as conversations.
@@ -0,0 +1,11 @@
1
+ Reply from the hottest mail.
2
+
3
+ Date: Wed, 15 Aug 2012 17:46:32 -0700
4
+ From: mork@example.com
5
+ To: mindy@hotmail.com
6
+ Subject: Here's a long subject line that will likely be broken at some point
7
+ and wrap to the next line.
8
+
9
+ I'm moving into the master bedroom.
10
+
11
+ Deal with it.
@@ -0,0 +1,5 @@
1
+ Foo
2
+
3
+ -------- Original Message --------
4
+
5
+ THE END.
@@ -0,0 +1,4 @@
1
+ Hello
2
+
3
+ --
4
+ Rick
@@ -0,0 +1,9 @@
1
+ Hello
2
+
3
+ Mr Rick Olson
4
+ Galactic President Superstar Mc Awesomeville
5
+ GitHub
6
+
7
+ **********************DISCLAIMER***********************************
8
+ * Note: blah blah blah *
9
+ **********************DISCLAIMER***********************************
@@ -0,0 +1,12 @@
1
+ This emails tests that multiline header fix isn't catching things it shouldn't.
2
+
3
+ On friday when I tried it didn't work as expect.
4
+
5
+ This line would have been considered part of the header line.
6
+
7
+ On Wed, Apr 4, 2012 at 9:32 AM, Bob Jones <bjones@gmail.com> wrote:
8
+ > We are still very interested in achievements you’ve had from participating
9
+ > in our initiative. When you have a chance, please reply to this
10
+ > email and describe what you have done.
11
+ >
12
+
@@ -0,0 +1,3 @@
1
+ Here is another email
2
+
3
+ Sent from my BlackBerry
@@ -0,0 +1,22 @@
1
+ test 2 this should list second
2
+
3
+ and have spaces
4
+
5
+ and retain this formatting
6
+
7
+
8
+ - how about bullets
9
+ - and another
10
+
11
+
12
+ On Fri, Feb 24, 2012 at 10:19 AM, <examples@email.goalengine.com> wrote:
13
+
14
+ > Give us an example of how you applied what they learned to achieve
15
+ > something in your organization
16
+
17
+
18
+
19
+
20
+ --
21
+
22
+ *Joe Smith | Director, Product Management*
@@ -0,0 +1,12 @@
1
+ I have gained valuable experience from working with students from other cultures. They bring a significantly different perspective to the work we do. I have also had the opportunity to practice making myself very clear in discussion, so that everyone understands. I've also seen how different our culture is to them, in their reactions to what I think is a normal approach to assignments, and to life in general.
2
+
3
+
4
+ Date: Tue, 2 Oct 2012 02:35:10 +0000
5
+ From: john@example.com
6
+ To: shelly@example.com
7
+ Subject: Tell us what you learned.
8
+
9
+
10
+
11
+
12
+ Thank you for recently participating in our class. We're interested in feedback. Please reply to this email.
@@ -0,0 +1,12 @@
1
+ I have gained valuable experience from working with students from other cultures. They bring a significantly different perspective to the work we do. I have also had the opportunity to practice making myself very clear in discussion, so that everyone understands. I've also seen how different our culture is to them, in their reactions to what I think is a normal approach to assignments, and to life in general.
2
+
3
+
4
+ Date: Tue, 2 Oct 2012 02:35:10 +0000
5
+ From: john@example.com
6
+ To: Smith, Shelly
7
+ Subject: Tell us what you learned.
8
+
9
+
10
+
11
+
12
+ Thank you for recently participating in our class. We're interested in feedback. Please reply to this email.
@@ -0,0 +1,5 @@
1
+ Keep in mind that while scientific meetings of large medical societies allow for researchers and doctors to gather in one place to discuss hundreds, if not thousands, of new findings, what’s often presented may not pass muster for publication in prestigious medical journals, where they first undergo rigorous peer review. Addendum --
2
+
3
+ A Danish study drawing a lot of attention, but which has not yet published in a peer-reviewed journal, suggested that common signs of aging can predict a person’s heart disease risk. The researchers analyzed data from nearly 11,000 participants over age 40 in the Copenhagen Heart Study and found that those who had three to four aging signs at the beginning of the study -- such as a receding hairline, baldness at the top of the head, creases in the earlobes, and fatty deposits around the eye -- had a 57 percent increased risk of having a heart attack and a 39 percent increased risk of being diagnosed with heart disease during the 35-year study compared with those who had none of them.
4
+
5
+ “The visible signs of aging reflect physiologic or biological age, not chronological age,” the study’s senior author, Dr. Anne Tybjaerg--Hansen at the University of Copenhagen, said in a statement on the Heart Association’s website. She went on to recommend that doctors check for these aging signs as a “routine part” of their physical exam.
@@ -0,0 +1,3 @@
1
+ Here is another email
2
+
3
+ Sent from my iPhone
@@ -0,0 +1,6 @@
1
+ Hi,
2
+
3
+ My email is john.smith@gmail.com and I had a question.
4
+
5
+ What do you do?
6
+
@@ -0,0 +1,6 @@
1
+ Hi,
2
+
3
+ My name is Jim Smith and I had a question.
4
+
5
+ What do you do?
6
+
@@ -0,0 +1,3 @@
1
+ Here is another email
2
+
3
+ Sent from my Verizon Wireless BlackBerry
@@ -0,0 +1,8 @@
1
+ Foo!
2
+
3
+ De: john@example.com
4
+ Para: shelly@example.com
5
+ Fecha: 01/02/2013 05:04 p.m.
6
+ Asunto: Requerimiento #12345
7
+
8
+ Thank you for recently participating in our class. We're interested in feedback. Please reply to this email.