<commit_before>#
# Copyright (c) 2014-2015 <NAME> Cancer Research Center
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


'''
    initial script of the Argos/NLP engine do deal with command line parsing and module outputs
    should exit with a non-zero status for any fatal errors and
    output warnings and results in json format to CWD in the file provided in cmd line arguments
    author@esilgard
    last updated October 2014
'''
 
import sys,os
import output_results,make_text_output_directory,codecs
from datetime import datetime

## timeit variable for performance testing ##
begin=datetime.today()
## path to the nlp_engine.py script ##
path= os.path.dirname(os.path.realpath(__file__))+'/'

## grab version number from txt file which updates with git post-commit hook scipt ##
try:
    __version__=codecs.open(path+'version','rb', encoding='utf-16').readlines()[0].strip()
except:
    sys.stderr.write('FATAL ERROR: could not locate or parse version file.')
    sys.exit(1)

## path to file containing flags and descriptions ##<commit_msg>added error handling to catch alternate utf-16 encoding in version script<commit_after>#
# Copyright (c) 2014-2015 <NAME> Cancer Research Center
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


'''
    initial script of the Argos/NLP engine do deal with command line parsing and module outputs
    should exit with a non-zero status for any fatal errors and
    output warnings and results in json format to CWD in the file provided in cmd line arguments
    author@esilgard
    last updated October 2014
'''
 
import sys,os
import output_results,make_text_output_directory,codecs
from datetime import datetime

## timeit variable for performance testing ##
begin=datetime.today()
## path to the nlp_engine.py script ##
path= os.path.dirname(os.path.realpath(__file__))+'/'

## grab version number from txt file which updates with git post-commit hook scipt (assume utf-8, but back up to utf-16) ##
try:
    __version__=codecs.open(path+'version','rb', encoding='utf-8').readlines()[0].strip()
except:
    try:
         __version__=codecs.open(path+'version','rb', encoding='utf-16').readlines()[0].strip()
    except:
        sys.stderr.write('FATAL ERROR: could not locate or parse version file.')
        sys.exit(1)

## path to file containing flags and descriptions ##
{'fraction_non_alphanumeric': 0.08749248346361996, 'fraction_numerical': 0.01413108839446783, 'mean_word_length': 4.314696485623003, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4373110', 'n_tokens_mistral': 916, 'n_tokens_neox': 882, 'n_words': 399}