Fix tests
This commit is contained in:
parent
3b6134de2e
commit
2d71fceb54
18 changed files with 14 additions and 16 deletions
|
|
@ -35,6 +35,7 @@ install_requires =
|
|||
langcodes[data] >= 3.3.0
|
||||
segtok >= 1.5.11
|
||||
langdetect >= 1.0.9
|
||||
pyaml >= 21.0.0
|
||||
|
||||
[options.package_data]
|
||||
* = *.json, *.yaml, *.yml
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
import re
|
||||
from importlib import import_module
|
||||
from sys import argv
|
||||
|
||||
import uvicorn
|
||||
from uvicorn.config import LOGGING_CONFIG
|
||||
|
||||
from .great_ai.exceptions import MissingArgumentError
|
||||
from .great_ai.context import get_context
|
||||
from .great_ai.exceptions import MissingArgumentError
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
if len(argv) < 2:
|
||||
raise MissingArgumentError(f"Provide a filename such as: {argv[0]} my_app.py")
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ def main():
|
|||
module_name += ":app"
|
||||
get_context().logger.warning(
|
||||
'Service name (name of variable) is assumed to be "app",'
|
||||
+ ' such as: `app = create_service(predict_domain)`'
|
||||
+ " such as: `app = create_service(predict_domain)`"
|
||||
)
|
||||
|
||||
uvicorn.run(
|
||||
|
|
@ -50,6 +50,7 @@ def main():
|
|||
},
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
main()
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ from .logger import create_logger
|
|||
|
||||
logger = create_logger("parallel_map")
|
||||
|
||||
|
||||
def parallel_map(
|
||||
function: Callable[[Any], Any],
|
||||
values: Iterable[Any],
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ from typing import Any, List, Optional, Pattern, Tuple, Union
|
|||
|
||||
from bs4 import BeautifulSoup
|
||||
from bs4.element import NavigableString, Tag
|
||||
from sus.publication_tei.models.element import Paragraph
|
||||
|
||||
from ..clean import clean
|
||||
from ..lemmatize_text import lemmatize_text
|
||||
|
|
@ -20,6 +19,7 @@ from .models import (
|
|||
Element,
|
||||
Meta,
|
||||
MetaType,
|
||||
Paragraph,
|
||||
PublicationMetadata,
|
||||
Text,
|
||||
Title,
|
||||
|
|
@ -30,8 +30,8 @@ THIS_FOLDER = Path(os.path.dirname(os.path.abspath(__file__)))
|
|||
|
||||
|
||||
class PublicationTEI:
|
||||
# remove template sentenaces, such as copyright notices
|
||||
agressive_cleaning_enabled = True
|
||||
# remove template sentences, such as copyright notices
|
||||
aggressive_cleaning_enabled = True
|
||||
|
||||
def __init__(self, tei: str):
|
||||
self._document_order_counter = 0
|
||||
|
|
@ -324,7 +324,7 @@ class PublicationTEI:
|
|||
if text is None:
|
||||
return None
|
||||
|
||||
if self.agressive_cleaning_enabled:
|
||||
if self.aggressive_cleaning_enabled:
|
||||
filtered = filter_sentences(
|
||||
text,
|
||||
THIS_FOLDER / "templates.yaml",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from sus.publication_tei.models import (
|
||||
from great_ai.utilities.publication_tei.models import (
|
||||
Affiliation,
|
||||
Author,
|
||||
Bookmark,
|
||||
|
|
@ -3,7 +3,6 @@ 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>! <3 <> < ></><> <> <|'
|
||||
|
|
@ -3,7 +3,6 @@ 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.
|
||||
|
|
@ -3,7 +3,6 @@ import unittest
|
|||
from src.great_ai.utilities.match_names.match_names import match_names
|
||||
|
||||
|
||||
|
||||
class TestMatchNames(unittest.TestCase):
|
||||
def test_grid(self) -> None:
|
||||
names = [
|
||||
|
|
@ -3,7 +3,6 @@ from pathlib import Path
|
|||
|
||||
from src.great_ai.utilities.publication_tei import PublicationTEI
|
||||
|
||||
|
||||
from .data.parsed import (
|
||||
abstract,
|
||||
authors,
|
||||
|
|
@ -2,7 +2,6 @@ import unittest
|
|||
|
||||
from src.great_ai.utilities.unique import unique
|
||||
|
||||
|
||||
original = [
|
||||
("a", 1),
|
||||
("b", 5),
|
||||
Loading…
Add table
Add a link
Reference in a new issue