1
Fork 0
mirror of https://github.com/Steffo99/unimore-bda-6.git synced 2024-11-25 17:24:20 +00:00
bda-6-steffo/unimore_bda_6/__main__.py

30 lines
885 B
Python
Raw Normal View History

import logging
2023-02-01 16:46:25 +00:00
from .config import config
2023-02-02 01:56:37 +00:00
from .database import mongo_reviews_collection_from_config, get_training_reviews, get_test_reviews
from .analysis.vanilla import VanillaReviewSA
from .analysis.potts import PottsReviewSA
2023-02-01 16:46:25 +00:00
from .log import install_log_handler
2023-02-01 03:20:09 +00:00
log = logging.getLogger(__name__)
2023-02-01 01:33:42 +00:00
def main():
2023-02-02 01:56:37 +00:00
with mongo_reviews_collection_from_config() as reviews:
training_reviews = get_training_reviews(collection=reviews)
test_reviews = get_test_reviews(collection=reviews)
vanilla = VanillaReviewSA()
vanilla.train(training_reviews)
log.info("Vanilla evaluation results: %s", vanilla.evaluate(test_reviews))
potts = PottsReviewSA()
potts.train(training_reviews)
log.info("Potts evaluation results: %s", potts.evaluate(test_reviews))
2023-02-01 01:33:42 +00:00
if __name__ == "__main__":
2023-02-01 16:46:25 +00:00
install_log_handler()
config.proxies.resolve()
2023-02-01 01:33:42 +00:00
main()