<commit_before>#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
    Copyright (c) 2014, <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
"""

#Kersten 13.06.2014:
#"python RunXapian.py -x" for indexing and searching
#"python RunXapian.py -f" for indexing
#"python RunXapian.py" for searching
#"python -h" for help

import xappy
import os.path
import sys
import os

from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

from SynonymParser import SynonymParser
from PubMedXapian import PubMedXapian

if __name__=="__main__":
    #new Code Kersten 08.07.2014
    from optparse import OptionParser

    parser = OptionParser()
    parser.add_option("-b", "--b_year", dest="b", help="year of the index to begin parsing (default: 1809)", default=1809)
    parser.add_option("-p", "--xapian_database_path", dest="xapian_database_path", help="Specify the path to the Xapian full text index.", default="xapian")
    parser.add_option("-e", "--e_year", dest="e", help="year of the index to end parsing (default: 2014)", default=2014)
    parser.add_option("-x", "--index", dest="x", action="store_true", default=False, help="Create Xapian index first (default: False)")
    parser.add_option("-s", "--synoynm_path", dest="s", help="relative path to synonym list (default: synonyms/pancreatic_cancer.txt)", default = "synonyms/pancreatic_cancer.txt")
    parser.add_option("-d", "--db_psql", dest="d", help="database in PostgreSQL to connect to (default: pancreatic_cancer_db)", default = "pancreatic_cancer_db")
    parser.add_option("-f", "--no_search", dest="f", action="store_false", help="find synonyms in Xapian database (default: True)", default=True)
    parser.add_option("-r", "--results_name", dest="r", help="name of the results file (default: results.csv)", default = "results")
    parser.add_option("-n", "--name_xapian_db", dest="n", help="name of the xapian database folder (default: xapian<e_year>)", default = "xapian")
    
    (options, args) = parser.parse_args()
    
    #in PubMed, first articles published are from 1809:
    #http://www.nlm.nih.gov/bsd/licensee/2013_stats/baseline_med_filecount.html
    #set range of years
    b_year = options.b
    e_year = options.e

    #set results filename
    filename = options.r

    #set Xapian database name (default: "xapian<e_year>")
    if options.n == "xapian":
        xapian_name = options.n + str(options.e)
    else:
        xapian_name = options.n

    #set PSQL database name
    database = options.d
    #set synonym path
    synonymPath = options.s<commit_msg>Default value for e_year changed to 2015<commit_after>#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
    Copyright (c) 2014, <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
"""

#Kersten 13.06.2014:
#"python RunXapian.py -x" for indexing and searching
#"python RunXapian.py -f" for indexing
#"python RunXapian.py" for searching
#"python -h" for help

import xappy
import os.path
import sys
import os

from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

from SynonymParser import SynonymParser
from PubMedXapian import PubMedXapian

if __name__=="__main__":
    #new Code Kersten 08.07.2014
    from optparse import OptionParser

    parser = OptionParser()
    parser.add_option("-b", "--b_year", dest="b", help="year of the index to begin parsing (default: 1809)", default=1809)
    parser.add_option("-p", "--xapian_database_path", dest="xapian_database_path", help="Specify the path to the Xapian full text index.", default="xapian")
    parser.add_option("-e", "--e_year", dest="e", help="year of the index to end parsing (default: 2015)", default=2015)
    parser.add_option("-x", "--index", dest="x", action="store_true", default=False, help="Create Xapian index first (default: False)")
    parser.add_option("-s", "--synoynm_path", dest="s", help="relative path to synonym list (default: synonyms/pancreatic_cancer.txt)", default = "synonyms/pancreatic_cancer.txt")
    parser.add_option("-d", "--db_psql", dest="d", help="database in PostgreSQL to connect to (default: pancreatic_cancer_db)", default = "pancreatic_cancer_db")
    parser.add_option("-f", "--no_search", dest="f", action="store_false", help="find synonyms in Xapian database (default: True)", default=True)
    parser.add_option("-r", "--results_name", dest="r", help="name of the results file (default: results.csv)", default = "results")
    parser.add_option("-n", "--name_xapian_db", dest="n", help="name of the xapian database folder (default: xapian<e_year>)", default = "xapian")
    
    (options, args) = parser.parse_args()
    
    #in PubMed, first articles published are from 1809:
    #http://www.nlm.nih.gov/bsd/licensee/2013_stats/baseline_med_filecount.html
    #set range of years
    b_year = options.b
    e_year = options.e

    #set results filename
    filename = options.r

    #set Xapian database name (default: "xapian<e_year>")
    if options.n == "xapian":
        xapian_name = options.n + str(options.e)
    else:
        xapian_name = options.n

    #set PSQL database name
    database = options.d
    #set synonym path
    synonymPath = options.s
{'fraction_non_alphanumeric': 0.1441476071497213, 'fraction_numerical': 0.018066500096098406, 'mean_word_length': 4.315628192032686, 'pattern_counts': {'":': 4, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6117244', 'n_tokens_mistral': 1811, 'n_tokens_neox': 1704, 'n_words': 475}