2023-02-02 03:34:05 +00:00
|
|
|
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
|
2023-02-02 03:34:05 +00:00
|
|
|
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
|
|
|
|
2023-02-02 03:34:05 +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)
|
|
|
|
|
2023-02-02 03:34:05 +00:00
|
|
|
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()
|