<commit_before>__all__ = ['process_pmc']

import json
import logging
import requests


logger = logging.getLogger(__name__)


default_output_fname = 'rlimsp_output.json'
RLIMSP_URL = 'https://research.bioinformatics.udel.edu/itextmine/api/data/rlims/pmc'


class RLIMSP_Error(Exception):
    pass


def process_pmc(pmc_id, output_fname=default_output_fname, with_grounding=True):
    """Get an output from RLIMS-p for the given pmic id."""
    if with_grounding:
        resp = requests.get(RLIMSP_URL + '.normed/pmcid/%s' % pmc_id)
    else:
        resp = requests.get(RLIMSP_URL + '/pmcid/%s' % pmc_id)

    if resp.status_code != 200:
        raise RLIMSP_Error("Bad status code: %d - %s"
                           % (resp.status_code, resp.reason))

    return<commit_msg>Use RLIMS-P Processor object.<commit_after>__all__ = ['process_pmc']

import logging
import requests

from .processor import RlimspProcessor


logger = logging.getLogger(__name__)


default_output_fname = 'rlimsp_output.json'
RLIMSP_URL = 'https://research.bioinformatics.udel.edu/itextmine/api/data/rlims/pmc'


class RLIMSP_Error(Exception):
    pass


def process_pmc(pmc_id, output_fname=default_output_fname, with_grounding=True):
    """Get an output from RLIMS-p for the given pmic id."""
    if with_grounding:
        resp = requests.get(RLIMSP_URL + '.normed/pmcid/%s' % pmc_id)
    else:
        resp = requests.get(RLIMSP_URL + '/pmcid/%s' % pmc_id)

    if resp.status_code != 200:
        raise RLIMSP_Error("Bad status code: %d - %s"
                           % (resp.status_code, resp.reason))

    rp = RlimspProcessor(resp.json())

    return rp
{'fraction_non_alphanumeric': 0.11632155907429964, 'fraction_numerical': 0.0036540803897685747, 'mean_word_length': 3.393048128342246, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5366466', 'n_tokens_mistral': 611, 'n_tokens_neox': 578, 'n_words': 115}