def main():

    parser = IdSelectionArgumentParser(
        description='Calcuates the comment sentiment taking emojis into account'
    )

    parser.parse_args()
    mark_if_comment_has_emojis(id_selection=parser.id_selection)
def main():
    parser = IdSelectionArgumentParser(
        description='Makes api calls to Google to \
        determine the language and the \
        english translation of comments \
        and store the results in a database')

    parser.parse_args()
    detect_lang_and_translate_content(id_selection=parser.id_selection)
def main():
    API_choices = {
        AkismetSpam.__name__: AkismetSpam,
        BlogSpam.__name__: BlogSpam
    }

    parser = IdSelectionArgumentParser(
        description='Uses Akismet lib to determine whether \
         the english translation or the comments\
         in original language are spam or not, & \
         it stores the results in the database')

    parser.add_argument_with_choices('-api',
                                     required=True,
                                     choices=API_choices.keys(),
                                     help='Choose from the listed api options')

    spam = parser.add_mutually_exclusive_group(required=True)
    spam.add_argument('--en', dest='use_en', action='store_true')
    spam.add_argument('--ol', dest='use_en', action='store_false')

    parser.parse_args()
    detect_spam(use_en=parser.args.use_en,
                id_selection=parser.id_selection,
                api=API_choices.get(parser.args.api)())
def main():
    API_choices = {
        ViveknAPI.__name__: ViveknAPI,
        IndicoAPI.__name__: IndicoAPI,
        IndicoHqAPI.__name__: IndicoHqAPI,
        TextProcessingAPI.__name__: TextProcessingAPI
    }

    parser = IdSelectionArgumentParser(
        description='Makes api calls to determine \
        the sentiment of a comment and \
        store the results in a database')

    parser.add_argument_with_choices('-api',
                                     required=True,
                                     choices=API_choices.keys(),
                                     help='choose from the listed api options')

    parser.add_boolean_argument(
        '--original-language',
        action='store_true',
        default=False,
        help='get comment sentiment in original language')

    parser.parse_args()

    if parser.args.original_language and parser.args.api not in (
            ViveknAPI.__name__, TextProcessingAPI.__name__):
        print(parser.args.api +
              ' does not support original language sentiment analysis')
        return
    elif parser.args.original_language:
        api = API_choices.get(parser.args.api)(parser.args.original_language)
    else:
        api = API_choices.get(parser.args.api)()

    run_sentiment_api_batch(api=api,
                            id_selection=parser.id_selection,
                            original_language=parser.args.original_language)
Beispiel #5
0
def main():
    parser = IdSelectionArgumentParser(description='Marks comments that \
         contain a url as spam \
         and updates the database')

    parser.add_argument_with_choices(
        '-type',
        required=True,
        choices=URL_QUERY.keys(),
        help='Choose from the listed spam type options')

    parser.parse_args()
    spam_json = {'is_spam': True, 'type': parser.args.type}
    mark_url_comments_spam(spam_json=spam_json,
                           url_query=URL_QUERY[parser.args.type],
                           id_selection=parser.id_selection)
def main():
    sentiment_api_columns = ('real_sentiment', 'sentiment_api1',
                             'sentiment_api1_en', 'sentiment_api2',
                             'sentiment_api2_en', 'sentiment_api3',
                             'sentiment_api4')
    parser = IdSelectionArgumentParser(
        description='Converts comments\' sentiment \
        string values (labels) to json  \
        stores the results in a database')

    parser.add_argument_with_choices(
        '-api',
        required=True,
        choices=sentiment_api_columns,
        help='Choose from the listed api column options')

    parser.parse_args()
    convert_comment_sentiment_to_json(id_selection=parser.id_selection,
                                      sentiment_api_column=parser.args.api)
def main():
    sentiment_api_columns = (
        'sentiment_api3',
        'sentiment_api4'
    )

    parser = IdSelectionArgumentParser(
        description=
        'Converts some sentiment_api3&4 labels to neutral')

    parser.add_argument_with_choices(
        '-api',
        required=True,
        choices=sentiment_api_columns,
        help='Choose from the listed api column options')

    parser.parse_args()
    convert_sentiment_api_labels(
        id_selection=parser.id_selection,
        sentiment_api_column=parser.args.api)
Beispiel #8
0
def main():
    API_choices = {
        ViveknAPI.__name__: ViveknAPI,
        IndicoAPI.__name__: IndicoAPI,
        IndicoHqAPI.__name__: IndicoHqAPI,
        TextProcessingAPI.__name__: TextProcessingAPI}

    parser = IdSelectionArgumentParser(
        description='Calcuates the comment sentiment taking emojis into account')

    parser.add_argument_with_choices(
        '-api',
        required=True,
        choices=API_choices.keys(),
        help='Choose from the listed api options')

    parser.parse_args()

    update_sentiment_emoji_stats(
        api=API_choices.get(parser.args.api)(),
        id_selection=parser.id_selection)
def main():

    parser = IdSelectionArgumentParser(
        description='Calculates posts\' sentiment \
        stats using comment labels and \
        stores the results in a database')

    parser.add_argument_with_choices('-api_column',
                                     required=False,
                                     choices=SENTIMENT_API_COLUMNS,
                                     help='Choose from the listed api column \
        options. If argument not specified, \
        algorithm runs for all listed columns')

    parser.parse_args()
    if parser.args.api_column is not None:
        sentiment_api_columns = (parser.args.api_column, )
    else:
        sentiment_api_columns = SENTIMENT_API_COLUMNS

    update_post_sentiment_stats(id_selection=parser.id_selection,
                                sentiment_api_columns=sentiment_api_columns)
Beispiel #10
0
def main():
    parser = IdSelectionArgumentParser(
        description='Script for manually updating real_sentiment of comments')
    parser.parse_args()
    update_real_sentiment_batch(id_selection=parser.id_selection)