Created pipeline to run ner sentiment and sql ingest (#314)

Created a dataprocessing pipline that enhances the raw mined data with
Organsiation extractions and sentiment analysis prio to moving the data
to the sql db.
The transfer of matched data is done afterword.

---------

Co-authored-by: SeZett <zeleny.sebastian@fh-swf.de>
This commit is contained in:
2023-11-11 14:28:12 +01:00
committed by GitHub
parent a6d486209a
commit 066800123d
12 changed files with 206 additions and 132 deletions

View File

@ -92,7 +92,7 @@ def test_sentiment_pipeline_existing_sentiment(
mock_collection.find.return_value = mock_documents
# Call the process_documents method
sentiment_pipeline.process_documents("text", "use_spacy")
sentiment_pipeline.process_documents("text", "spacy")
# Ensure that sentiment_spacy was called with the correct text
mock_sentiment_spacy.assert_called_once_with("This is a positive text.")
@ -124,7 +124,7 @@ def test_sentiment_pipeline_no_documents(
sentiment_pipeline.news_obj.collection = mock_collection
# Call the process_documents method
sentiment_pipeline.process_documents("text", "use_spacy")
sentiment_pipeline.process_documents("text", "spacy")
# Ensure that sentiment_spacy was not called
mock_sentiment_spacy.assert_not_called()
@ -159,7 +159,7 @@ def test_sentiment_pipeline_with_spacy(
mock_collection.find.return_value = mock_documents
# Call the process_documents method
sentiment_pipeline.process_documents("text", "use_spacy")
sentiment_pipeline.process_documents("text", "spacy")
# Ensure that sentiment_spacy was called with the correct text
mock_sentiment_spacy.assert_called_once_with("This is a positive text.")
@ -198,7 +198,7 @@ def test_sentiment_pipeline_with_transformer(
mock_collection.find.return_value = mock_documents
# Call the process_documents method
sentiment_pipeline.process_documents("text", "use_transformer")
sentiment_pipeline.process_documents("text", "transformer")
# Ensure that sentiment_transformer was called with the correct text
mock_sentiment_transformer.assert_called_once_with("This is a negative text.")