<commit_before>#encoding: utf-8
require File.join(File.expand_path(File.dirname(__FILE__)),"/../lib/text")
require File.join(File.expand_path(File.dirname(__FILE__)),"/../lib/incomplete_date")
require "test/unit"
 
class TestDates < Test::Unit::TestCase
   
  def test_simple
    t=Text.new " 3 de diciembre del 77."  
    assert_equal(IncompleteDate.new(1977,12,3)  ,  t.dates.first )
    
    t=Text.new "3 de diciembre del 1977."
    assert_equal(IncompleteDate.new(1977,12,3),  t.dates.first )
    
    t=Text.new "julio del 78"
    assert_equal(IncompleteDate.new(1978,7),     t.dates.first ) 

    t=Text.new "6 de diciembre"
    assert_equal(IncompleteDate.new(0,12,6),     t.dates.first )

    t=Text.new "diciembre de 1978"
    assert_equal(IncompleteDate.new(1978,12),  t.dates.first )

    t=Text.new "27/11/77"
    assert_equal(IncompleteDate.new(1977,11,27), t.dates.first )

    t=Text.new "abril del ´78"
    assert_equal(IncompleteDate.new(1978,4),     t.dates.first )

    t=Text.new "fines de noviembre 1977"
    assert_equal(IncompleteDate.new(1977,11),  t.dates.first )
    assert_equal("1977-11-0",  t.dates.first.to_s(0), "fill unknowns with 0" )

    t=Text.new "juicio del 25 de junio de 2008. "
    assert_equal(IncompleteDate.new(2008,6,25),  t.dates.first )

    t=Text.new "1° de junio de 1978"
    assert_equal(IncompleteDate.new(1978,6,1),  t.dates.first )
    
    t=Text.new "18/19 de julio de 1977"
    assert_equal(IncompleteDate.new(1977,7,19),  t.dates.first )<commit_msg>incomplete dates<commit_after>#encoding: utf-8
require File.join(File.expand_path(File.dirname(__FILE__)),"/../lib/text")
require File.join(File.expand_path(File.dirname(__FILE__)),"/../lib/incomplete_date")
require "test/unit"
 
class TestDates < Test::Unit::TestCase
   
  def test_simple
    t=Text.new " 3 de diciembre del 77."  
    assert_equal(IncompleteDate.new(1977,12,3)  ,  t.dates.first )
    
    t=Text.new "3 de diciembre del 1977."
    assert_equal(IncompleteDate.new(1977,12,3),  t.dates.first )
    
    t=Text.new "julio del 78"
    assert_equal(IncompleteDate.new(1978,7),     t.dates.first ) 

    t=Text.new "6 de diciembre"
    assert_equal(IncompleteDate.new(0,12,6),     t.dates.first )

    t=Text.new "diciembre de 1978"
    assert_equal(IncompleteDate.new(1978,12),  t.dates.first )

    t=Text.new "27/11/77"
    assert_equal(IncompleteDate.new(1977,11,27), t.dates.first )

    t=Text.new "abril del ´78"
    assert_equal(IncompleteDate.new(1978,4),     t.dates.first )

    t=Text.new "fines de noviembre 1977"
    assert_equal(IncompleteDate.new(1977,11),  t.dates.first )
    assert_equal("1977-11-0",  t.dates.first.to_s(0), "fill unknowns with 0" )

    assert_equal(IncompleteDate.parse("1977-11-0"),  IncompleteDate.new(1977,11) )
    assert_equal(IncompleteDate.parse("1977-01-00"),  IncompleteDate.new(1977,1) )
    assert_equal(IncompleteDate.parse("1977"),  IncompleteDate.new(1977) )

    t=Text.new "juicio del 25 de junio de 2008. "
    assert_equal(IncompleteDate.new(2008,6,25),  t.dates.first )

    t=Text.new "1° de junio de 1978"
    assert_equal(IncompleteDate.new(1978,6,1),  t.dates.first )
    
    t=Text.new "18/19 de julio de 1977"
    assert_equal(IncompleteDate.new(1977,7,19),  t.dates.first )
{'fraction_non_alphanumeric': 0.14750076663600123, 'fraction_numerical': 0.08647654093836246, 'mean_word_length': 3.6800573888091823, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7006395', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1236, 'n_words': 199}