o
    XεiS/                     @   sJ   d Z ddlZddlmZ G dd dejZdd Zedkr#e  dS dS )	zx
Test sentence segmentation against the "Golden Rules":
https://github.com/diasks2/pragmatic_segmenter#the-golden-rules
    N	sentencesc                   @   s   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zd d! Zd"d# Zd$d% Zd&S )'GoldenRulesTestCasez*Test golden rules of sentence segmentationc                 C      |  tdddg dS )zSimple period to end sentencezHello World. My name is Jonas.zHello World.My name is Jonas.NassertEqual_get_sentencesself r   K/home/ubuntu/.local/lib/python3.10/site-packages/tests/test_golden_rules.pytest_rule_1      zGoldenRulesTestCase.test_rule_1c                 C   r   )zQuestion mark to end sentencez$What is your name? My name is Jonas.zWhat is your name?r   Nr   r
   r   r   r   test_rule_2   r   zGoldenRulesTestCase.test_rule_2c                 C   r   )z!Exclamation point to end sentencezThere it is! I found it.zThere it is!zI found it.Nr   r
   r   r   r   test_rule_3      zGoldenRulesTestCase.test_rule_3c                 C      |  tddg dS )z#One letter upper case abbreviationszMy name is Jonas E. Smith.zMy name is Jonas E Smith.Nr   r
   r   r   r   test_rule_4"      
zGoldenRulesTestCase.test_rule_4c                 C   r   )z#One letter lower case abbreviationszPlease turn to p. 55.zPlease turn to p 55.Nr   r
   r   r   r   test_rule_5)   r   zGoldenRulesTestCase.test_rule_5c                 C   r   )z?Two letter lower case abbreviations in the middle of a sentencezWere Jane and co. at the party?z#Were Jane and company at the party?Nr   r
   r   r   r   test_rule_60      zGoldenRulesTestCase.test_rule_6c                 C   r   )z?Two letter upper case abbreviations in the middle of a sentencez5They closed the deal with Pitt, Briggs & Co. at noon.z;They closed the deal with Pitt, Briggs and Company at noon.Nr   r
   r   r   r   test_rule_78   r   zGoldenRulesTestCase.test_rule_7c                 C   r   )z&Two letter (prepositive) abbreviationszI can see Mt. Fuji from here.zI can see Mount Fuji from here.Nr   r
   r   r   r   test_rule_10N   r   z GoldenRulesTestCase.test_rule_10c                 C   r   )z"Possesive two letter abbreviationszThat is JFK Jr.'s book.zThat is J F K Junior's book.Nr   r
   r   r   r   test_rule_12]   r   z GoldenRulesTestCase.test_rule_12c                 C   r   )z6Multi-period abbreviations in the middle of a sentencezI visited the U.S.A. last year.zI visited the U S A last year.Nr   r
   r   r   r   test_rule_13d   r   z GoldenRulesTestCase.test_rule_13c                 C   r   )zU.S. as non sentence boundaryz&I have lived in the U.S. for 20 years.z%I have lived in the U S for 20 years.Nr   r
   r   r   r   test_rule_17x   r   z GoldenRulesTestCase.test_rule_17c                 C   s   |  tddg dS )zNumber as non sentence boundaryzShe has $100.00 in her bag.Nr   r
   r   r   r   test_rule_19      z GoldenRulesTestCase.test_rule_19c                 C   r   )z&Double punctuation (exclamation point)zHello!! Long time no see.zHello!!zLong time no see.Nr   r
   r   r   r   test_rule_27   r   z GoldenRulesTestCase.test_rule_27c                 C   r   )z"Double punctuation (question mark)zHello?? Who is there?zHello??zWho is there?Nr   r
   r   r   r   test_rule_28   r   z GoldenRulesTestCase.test_rule_28c                 C   r   )z6Double punctuation (exclamation point / question mark)zHello!? Is that you?zHello!?Is that you?Nr   r
   r   r   r   test_rule_29   r   z GoldenRulesTestCase.test_rule_29c                 C   r   )z6Double punctuation (question mark / exclamation point)zHello?! Is that you?zHello?!r"   Nr   r
   r   r   r   test_rule_30   r   z GoldenRulesTestCase.test_rule_30c                 C   r   )z0Errant newlines in the middle of sentences (PDF)z5This is a sentence
cut off in the middle because pdf.z5This is a sentence cut off in the middle because pdf.Nr   r
   r   r   r   test_rule_40   r   z GoldenRulesTestCase.test_rule_40c                 C   r   )z*Errant newlines in the middle of sentencesz!It was a cold 
night in the city.z It was a cold night in the city.Nr   r
   r   r   r   test_rule_41   r   z GoldenRulesTestCase.test_rule_41N)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r#   r$   r%   r&   r   r   r   r   r      s(    *r   c                 C   s   dd t | dddD S )Nc                 S   s   g | ]}|j qS r   text).0sr   r   r   
<listcomp>  s    z"_get_sentences.<locals>.<listcomp>F)verbalize_numbersverbalize_currencyr   r+   r   r   r   r	     s   r	   __main__)	r*   unittestgruutr   TestCaser   r	   r'   mainr   r   r   r   <module>   s     	