Add sus updates

This commit is contained in:
Andras Schmelczer 2022-05-25 19:36:54 +02:00
parent a7e3dc11fd
commit 3ef1a72418
31 changed files with 2502 additions and 970 deletions

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@ import unittest
from src.great_ai.utilities.clean import clean
class TestClean(unittest.TestCase):
def test_xml_handling(self) -> None:
xml = '<strong>Hi, </strong> my name<br/>is <span style="color: hotpink;"> András</span>! &lt;&#51; <> < ></><> &lt;&gt; <|'
@ -59,6 +60,13 @@ class TestClean(unittest.TestCase):
self.assertEqual(clean(text), cleaned)
def test_T_I_T_L_E_case(self) -> None:
text = "an a r t i c l e is to F I N D the purpose of a tree"
cleaned = "an article is to FIND the purpose of a tree"
self.assertEqual(clean(text), cleaned)
def test_bracket_removal(self) -> None:
text = "something [0], and [frefe, ferf]"
cleaned = "something, and"

View file

@ -3,6 +3,7 @@ import unittest
from src.great_ai.utilities.get_sentences import get_sentences
class TestGetSentences(unittest.TestCase):
def test_default(self) -> None:
text = "This is a complete sentence. So is this. However this is n" # ot.

View file

@ -57,7 +57,7 @@ class TestLemmatizeText(unittest.TestCase):
"to_PART",
"create_VERB",
"a_DET",
"less_ADJ",
"less_ADV",
"resource_NOUN",
"-_PUNCT",
"intensive_ADJ",
@ -117,7 +117,7 @@ class TestLemmatizeText(unittest.TestCase):
"to_PART",
"create_VERB",
"a_DET",
"less_ADJ",
"less_ADV",
"resource_NOUN",
"-_PUNCT",
"intensive_ADJ",

View file

@ -3,6 +3,7 @@ import unittest
from src.great_ai.utilities.match_names.match_names import match_names
class TestMatchNames(unittest.TestCase):
def test_grid(self) -> None:
names = [

View file

@ -3,7 +3,17 @@ from pathlib import Path
from src.great_ai.utilities.publication_tei import PublicationTEI
from .data.parsed import authors, content, metadata, sentences
from .data.parsed import (
abstract,
authors,
bookmarks,
conclusion,
content,
introduction,
metadata,
sentences,
)
DATA_PATH = Path(__file__).parent.resolve() / "data"
@ -30,6 +40,20 @@ class TestPublicationTEI(unittest.TestCase):
def test_sentences(self) -> None:
self.assertEqual(PublicationTEI(self.test_xml).sentences, sentences)
def test_bookmarks(self) -> None:
self.assertEqual(PublicationTEI(self.test_xml).bookmarks, bookmarks)
def test_abstract(self) -> None:
self.assertEqual(PublicationTEI(self.test_xml).abstract_sentences, abstract)
def test_introduction(self) -> None:
self.assertEqual(
PublicationTEI(self.test_xml).introduction_sentences, introduction
)
def test_conclusion(self) -> None:
self.assertEqual(PublicationTEI(self.test_xml).conclusion_sentences, conclusion)
def test_empty1(self) -> None:
tei = PublicationTEI("<TEI/>")
tei.publication_metadata, tei.publication_metadata, tei.authors, tei.content, tei.sentences

View file

@ -2,6 +2,7 @@ import unittest
from src.great_ai.utilities.unique import unique
original = [
("a", 1),
("b", 5),