<commit_before>import csv
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "templatesAndSettings.settings")  # noqa
from django.core.wsgi import get_wsgi_application  # noqa
application = get_wsgi_application() # noqa
import re
from datetime import datetime

from django.core.exceptions import MultipleObjectsReturned
from django.db import transaction
from django.db.models import Q

from ODM2CZOData.models import Actions
from ODM2CZOData.models import Annotations
from ODM2CZOData.models import CvAggregationstatistic
from ODM2CZOData.models import CvAnnotationtype
from ODM2CZOData.models import CvCensorcode
from ODM2CZOData.models import CvMedium
from ODM2CZOData.models import CvQualitycode
from ODM2CZOData.models import CvRelationshiptype
from ODM2CZOData.models import CvResulttype
from ODM2CZOData.models import CvStatus
from ODM2CZOData.models import Featureactions
from ODM2CZOData.models import Measurementresults
from ODM2CZOData.models import Measurementresultvalueannotations
from ODM2CZOData.models import Measurementresultvalues
from ODM2CZOData.models import People
from ODM2CZOData.models import Processinglevels
from ODM2CZOData.models import Profileresults
from ODM2CZOData.models import Profileresultvalues
from ODM2CZOData.models import Relatedfeatures
from ODM2CZOData.models import Results
from ODM2CZOData.models import Samplingfeatures
from ODM2CZOData.models import Units
from ODM2CZOData.models import Variables

__author__ = 'leonmi'

# searchTextString = some string to search a models charField for
# Model = the model in which to search
# columnName = the name of the charField column to search in
# return = if one model object matches the search string return the object
# if multiple objects are returned print those objects and return None.
# example: searchModelColumnFor(" milligrams per kilogram ",Units,'unitsname')
def searchModelColumnFor(searchTextString, Model, columnName):
    searchText = re.split(',| ', searchTextString)
    searchText = filter(lambda name: name.strip(), searchText)<commit_msg>This might do it.<commit_after>import csv
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "templatesAndSettings.settings")  # noqa
from django.core.wsgi import get_wsgi_application  # noqa
application = get_wsgi_application() # noqa
import re
from datetime import datetime

from django.core.exceptions import MultipleObjectsReturned
from django.db import transaction
from django.db.models import Q

from ODM2CZOData.models import Actions
from ODM2CZOData.models import Annotations
from ODM2CZOData.models import CvAggregationstatistic
from ODM2CZOData.models import CvAnnotationtype
from ODM2CZOData.models import CvCensorcode
from ODM2CZOData.models import CvMedium
from ODM2CZOData.models import CvQualitycode
from ODM2CZOData.models import CvRelationshiptype
from ODM2CZOData.models import CvResulttype
from ODM2CZOData.models import CvStatus
from ODM2CZOData.models import Featureactions
from ODM2CZOData.models import Measurementresults
from ODM2CZOData.models import Measurementresultvalueannotations
from ODM2CZOData.models import Measurementresultvalues
from ODM2CZOData.models import People
from ODM2CZOData.models import Processinglevels
from ODM2CZOData.models import Profileresults
from ODM2CZOData.models import Profileresultvalues
from ODM2CZOData.models import Relatedfeatures
from ODM2CZOData.models import Results
from ODM2CZOData.models import Samplingfeatures
from ODM2CZOData.models import Units
from ODM2CZOData.models import Variables

__author__ = 'leonmi'


# searchTextString = some string to search a models charField for
# Model = the model in which to search
# columnName = the name of the charField column to search in
# return = if one model object matches the search string return the object
# if multiple objects are returned print those objects and return None.
# example: searchModelColumnFor(" milligrams per kilogram ",Units,'unitsname')
def searchModelColumnFor(searchTextString, Model, columnName):
    searchText = re.split(',| ', searchTextString)
    searchText = filter(lambda name: name.strip(), searchText)
{'fraction_non_alphanumeric': 0.04592952612393682, 'fraction_numerical': 0.01117861482381531, 'mean_word_length': 6.795454545454546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2821782', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1168, 'n_words': 390}