<commit_before>require 'helper'

class TestEmail < Test::Unit::TestCase
  should "recognizes academic email addresses and domains" do
    assert_equal Swot::is_academic?('<EMAIL>'),          true
    assert_equal Swot::is_academic?('<EMAIL>'),          true
    assert_equal Swot::is_academic?('<EMAIL>'),          true
    assert_equal Swot::is_academic?('<EMAIL>'),     true
    assert_equal Swot::is_academic?('<EMAIL>'),          true
    assert_equal Swot::is_academic?('<EMAIL>'), true
    assert_equal Swot::is_academic?('<EMAIL>'),                    true
    assert_equal Swot::is_academic?('<EMAIL>'),                true
    assert_equal Swot::is_academic?('<EMAIL>'),             true
    assert_equal Swot::is_academic?('<EMAIL>'),                 true

    assert_equal Swot::is_academic?('<EMAIL>'),              false
    assert_equal Swot::is_academic?('<EMAIL>'),                 false
    assert_equal Swot::is_academic?('<EMAIL>'),          false
    assert_equal Swot::is_academic?('<EMAIL>'),          false

    assert_equal Swot::is_academic?('stanford.edu'),                  true
    assert_equal Swot::is_academic?('slac.stanford.edu'),             true
    assert_equal Swot::is_academic?('www.stanford.edu'),              true
    assert_equal Swot::is_academic?('http://www.stanford.edu'),       true
    #assert_equal Swot::is_academic?('http://www.stanford.edu:9393'), true
    assert_equal Swot::is_academic?('strath.ac.uk'),                  true
    assert_equal Swot::is_academic?('soft-eng.strath.ac.uk'),         true
    assert_equal Swot::is_academic?('ugr.es'),                        true
    assert_equal Swot::is_academic?('uottawa.ca'),                    true
    assert_equal Swot::is_academic?('mother.edu.ru'),                 true
    assert_equal Swot::is_academic?('ucy.ac.cy'),                     true

    assert_equal Swot::is_academic?('leerilly.net'),                  false
    assert_equal Swot::is_academic?('gmail.com'),                     false
    assert_equal Swot::is_academic?('stanford.edu.com'),              false
    assert_equal Swot::is_academic?('strath.ac.uk.com'),              false

    assert_equal Swot::is_academic?(nil),                             false
    assert_equal Swot::is_academic?(''),                              false
    assert_equal Swot::is_academic?('the'),                           false

    assert_equal Swot::is_academic?(' stanford.edu'),                 true
    assert_equal Swot::is_academic?('<EMAIL> '),         true
    assert_equal Swot::is_academic?(' gmail.com '),                   false
  end

  should "returns name of valid institution" do
    assert_equal Swot::get_institution_name('<EMAIL>'), "University of Strathclyde"
  end
end
<commit_msg>fix whitespace<commit_after>require 'helper'

class TestEmail < Test::Unit::TestCase
  should "recognizes academic email addresses and domains" do
    assert_equal Swot::is_academic?('<EMAIL>'),          true
    assert_equal Swot::is_academic?('<EMAIL>'),          true
    assert_equal Swot::is_academic?('<EMAIL>'),          true
    assert_equal Swot::is_academic?('<EMAIL>'),     true
    assert_equal Swot::is_academic?('<EMAIL>'),          true
    assert_equal Swot::is_academic?('<EMAIL>'), true
    assert_equal Swot::is_academic?('<EMAIL>'),                    true
    assert_equal Swot::is_academic?('<EMAIL>'),                true
    assert_equal Swot::is_academic?('<EMAIL>'),             true
    assert_equal Swot::is_academic?('<EMAIL>'),                 true

    assert_equal Swot::is_academic?('<EMAIL>'),              false
    assert_equal Swot::is_academic?('<EMAIL>'),                 false
    assert_equal Swot::is_academic?('<EMAIL>'),          false
    assert_equal Swot::is_academic?('<EMAIL>'),          false

    assert_equal Swot::is_academic?('stanford.edu'),                  true
    assert_equal Swot::is_academic?('slac.stanford.edu'),             true
    assert_equal Swot::is_academic?('www.stanford.edu'),              true
    assert_equal Swot::is_academic?('http://www.stanford.edu'),       true
    #assert_equal Swot::is_academic?('http://www.stanford.edu:9393'), true
    assert_equal Swot::is_academic?('strath.ac.uk'),                  true
    assert_equal Swot::is_academic?('soft-eng.strath.ac.uk'),         true
    assert_equal Swot::is_academic?('ugr.es'),                        true
    assert_equal Swot::is_academic?('uottawa.ca'),                    true
    assert_equal Swot::is_academic?('mother.edu.ru'),                 true
    assert_equal Swot::is_academic?('ucy.ac.cy'),                     true

    assert_equal Swot::is_academic?('leerilly.net'),                  false
    assert_equal Swot::is_academic?('gmail.com'),                     false
    assert_equal Swot::is_academic?('stanford.edu.com'),              false
    assert_equal Swot::is_academic?('strath.ac.uk.com'),              false

    assert_equal Swot::is_academic?(nil),                             false
    assert_equal Swot::is_academic?(''),                              false
    assert_equal Swot::is_academic?('the'),                           false

    assert_equal Swot::is_academic?(' stanford.edu'),                 true
    assert_equal Swot::is_academic?('<EMAIL> '),             true
    assert_equal Swot::is_academic?(' gmail.com '),                   false
  end

  should "returns name of valid institution" do
    assert_equal Swot::get_institution_name('<EMAIL>'), "University of Strathclyde"
  end
end

{'fraction_non_alphanumeric': 0.13405600722673894, 'fraction_numerical': 0.0014453477868112015, 'mean_word_length': 2.367396593673966, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2530730', 'n_tokens_mistral': 1773, 'n_tokens_neox': 1738, 'n_words': 271}